A microcontroller is a kind of miniature computer that you can find in all kinds of gizmos...If it has buttons and a digital display, chances are it also has a programmable microcontroller brain. Try making a list and counting how many devices with microcontrollers you use in a typical day. Here are some examples: if your clock radio goes off, and you hit the snooze button a few times in the morning, the first thing you do in your day is interact with a microcontroller...
So microcontrollers are everywhere. However, a microcontroller is simply a chip. As you see on my microcontroller on the right, there are a lot of chips. So I didn't just buy a microcontroller, I bought an Arduino. An Arduino is an embedded computer system, allowing a developer easy access to program, power, and use a microcontroller. The biggest allure of the Arduino is that it is inexpensive, yet will work with a variety of additional components (in my case, sensors and motors and whatever else I'll need). Also, the Arduino comes with an easy to use interactive development environment (IDE) to help write programs for it. The microcontroller programming language is a modified version of C, and Arduino modifies that a little more to make the language even more accessible. While I haven't coded yet in this language, I suspect it won't take too much time to get used to.
To talk about my sensors, I need to change from talking about programming to talking about trigonometry and Newtonian physics. I acquired two different kinds of sensors, as I was not sure which kind would be best. These two kinds are Infrared and Ultrasonic. I keep using the word sensor, even though technically what I ordered are rangefinders that find the range to an object. The reason for my renaming of these components is simple - I am using them to detect the distance to objects in order to "sense" where objects are, thus they are sensors as opposed to merely electronic meter sticks.
Infrared sensors send out a beam of light and detect where it returns to the sensor. Using trigonometry, the circuit is able to calculate the angle of reflection of the light off an object, and from that angle compute the distance to the object. For this sensor, distance to an object is represented by a certain voltage being emitted from the sensor, and as the distance changes the voltage will change non-linearly. As that picture (kind of) shows, I appear to be missing something; by what I assume to be a purely benevolent mistake, I was only sent one wire to connect the sensor to my Arduino. That will be taken care of by the end of the week, I'm sure.
Ultrasonic sensors. These work by sending out a sound at ultrasonic frequency, meaning above the range of human hearing. We can only hear up to 20kHz, and my sensor operates at 42kHz. While humans cannot hear it, dogs and bats and even mice can. So a good rule to follow is probably operate this sensor out of the range of animals. But how does it work? It doesn't use the fancy triangles that infrared sensors do. Instead, it sends out its sound, and then simply waits for that sound wave to return to the sensor after having bounced off an object. The reason it uses time is because the speed of sound is between 300 and 400 m/s. Infrared sensors don't use time because the speed of light is a million times that. This particular sensor is overly complex in that it can output the distance it discovers in three different modes. One is basically telling the microcontroller how long until the sound has bounced back, and then through programming I have to figure out the actual distance that time represents (it's actually just 147 microseconds per inch). Another mode works similarly to the infrared sensor in that it outputs an analog voltage based off the distance (thus, there is a microcontroller in the sensor that computes the distance). And the third mode sends a digital representation of the distance (using 1s and 0s). I only need to use one mode, though I am unsure right now which mode will be best.
So that is a basic rundown of what I plan to use to make my robot car. Up next is finding a suitable host and beginning stage one.
'Til next time, stay classy!
Linday, Andy. What's a Microcontroller? Student Guide, Version 2.2. Rocklin, CA: Parallax, 2004.