A fun little tilt-sensing toy I made using a MEMS accelerometer and some LEDs.
Tilt Sensor Demonstrator
For More on this Project
In late 2002 my team was getting started on the Pipe Crawler project, and considering the use of newly-cheap MEMS accelerometers and gyroscopes in an inertial navigation system for the robot. At the time I was also taking a course called “Electrical Machines” and needed to submit a simple circuit project of my own choosing. Naturally, I combined my two projects by building this accelerometer toy for the course.
I used an Analog Devices ADXL202E accelerometer chip to sense tilt; it's a two-axis device but I only used one output for this project. The output signal is a duty-cycle modulated pulse train; in other words a series of square pulses where the ratio of on-time to off-time is proportional to the acceleration measured on that axis. Analog Devices was kind enough to sample me this part, even though I was obviously a student and the potential, as component vendors like to put it, was obviously zero. Although the ADXL202E came in a surface mount LCC 8-pin package, they provided it to me already soldered on a little development board with a male header, so that made connecting it to the rest of the circuit easy.
The LM3914 bar-graph driver is a simple way to drive the half-circle of LEDs. This is an older chip but still popular for building VU meters and any other application where voltage levels are to be displayed as a bar graph. I filtered the pulse train from the ADXL202E with a capacitor and fed the resulting voltage-proportional-to-acceleration signal to the input of the LM3914, which drives one of 10 LEDs accordingly. A trimmer potentiometer provides an adjustable reference level to pin 8 of the LM3914, tune this to make sure that down looks like down.
I mounted the whole project in a PVC pipe coupler and provided power with a nine-volt battery and a 7805 regulator, switched with a toggle switch hanging off of its wires—a laughable kludge that's held up remarkably well all the same. Needless to say, don't emulate this aspect of the design! But don't judge it too harshly either—I knocked the toy together in a couple of hours and it was a surprising hit when I showed it off in class.
Of course, this thing is not very impressive in these late days when every smartphone, digital camera, game controller, and toaster oven has at least one sensor for tilt sensing (and some devices, like the iPhone 4, have full six-axis inertial navigation systems). If there's anything to be learned from something like this now, it's that every little toy and just-for-fun project doesn't need a microcontroller or FPGA in it; you can often get some very cool effects with analog ICs and the very simplest of circuits. Have a look at the datasheet for the LM3914; it's full of application suggestions sure to inspire and educate.