One of the things I find oddly intriguing about working with microcontrollers is that they interact with the environment. This isn’t some amazing insight, of course — what would be the point of working with something whose name includes the word controller if it didn’t actually control things? — but it’s still kind of kicky. Particularly when all of your previous computer experience involves typing, clicking and interacting with a screen.
Which is why I really enjoyed tying a sonar module into an Arduino. Now I had a computer that could “see”! It was fun walking around the room and watching my laptop indicate where the Arduino could find me and where it couldn’t.
I got my sonar module, a MaxBotix LV-MaxSonar-EZ0 Sonar Range Finder MB1000, from Pololu. Interfacing it to the Arduino was really easy — +5V, ground and a connection to return a pulse-width modulated signal. The width of the pulse is directly proportional to the distance of the object the sensor is seeing, and the Arduino can determine the pulse width with one function call. Neat!