Accelerometer and USB Bit Whacker
Trying out new sensors for my PIC projects can be tedious with only LEDs or 2-line LCD displays to provide feedback. When I don’t quite know what you are looking for, there can be some fiddling around to get things going. The USB Bit Whacker makes this first prototyping step really easy. With the 18F25xx or 18F45xx USB enabled chips from Microchip and some software created by Brian Schmalz (the USB Bit Whacker software), you can see how your new sensors are going to act with a PIC chip in just a few minutes.
The UBW lets you control pin input and output though the USB port on your computer with a few simple commands. Using standard USB/Serial drivers on the computer (available from Microchip and elsewhere), you can interact with your UBW through a terminal application or any language the speaks serial. That’s all there is to it. I built an 18F4550 board that uses Brian’s UBW firmware with a minor modifications. But for real speed, just buy one ready to go from Sparkfun (shown in the photo).
I got a new +/- 2g accelerometer and a UBW from Sparkfun and wanted to see them in action right away. Using my UBW from Sparkfun, I added some header pins and used some jumper wires to hook things up as shown in the photo (this part takes about 2 min if you move slowly). The accelerometer is a 2 axis (x-y) device that offers voltages at the outputs between 0 V and Vcc (roughly) that are proportional to the acceleration along the x and y axes. Since there isn’t any difference between the acceleration due to gravitational force and that due to changing speeds, the device can work dynamically to measure motion (acceleration) or pseudo-statically, to measure orientation in a gravitational field.
(Click for full-size image)
With a few lines of Python code reading the serial port, I was able to log data from both axes of the accelerometer as I slowly rolled the accelerometer along my desktop. The resulting data is shown in the plot below. As you can see, I rotated the device through 360 degrees in about 22 seconds, taking a few readings per second.