I happened to be poking around at the local Radio Shack the other day when I noticed — to my surprise and delight — that they had an accelerometer in their parts bin, so of course I bought it without a second thought. It turns out that it’s a part well known to hobbiests and Arduino junkies called the Memsic 2125.
Once I got it home, I had to figure out what to do with it. I thought about building something that my kids could play with. The POV (persistence of vision) projects looked like a good idea. A POV device is a little gadget that quickly blinks a row of LEDs while you move it through the air and, because of persistence of vision, your brain sees a continuous pattern of light rather than a blinky thing flying by. You can use a POV device to spell out words or draw pictures in mid-air so long as you’re in a fairly dark space.
For example, there’s a nice looking POV gadget that ladyada sells in kit form (along with a bunch of other cool wares).
I wanted to build one of these but include an accelerometer such that it would only flash the LEDs when it was moving quickly in one direction. That way, I could just shake it back and forth quickly and it would repeatedly write out its message over and over in the same place — making it much easier and more fun for little kids to use.
The next step was to search the web for “accelerometer POV arduino” and find out what the community had already produced along these lines. I found this project over on feemo blog. It was just the ticket except with a very different accelerometer part. So I copied some of the code (especially the handy font table which evidently came from sparkfun), and set about trying to get my own POV up and running.
The trickiest part of this project was in figuring out how to recognize when the board was moving in a particular direction. It is very easy to figure out that it’s shaking, but accelerating in one direction looks very much like decelerating in the other direction. I’m not sure I really nailed the algorithm, but my hack seems to work, and if the Memsic 2125 is fairly consistent, then it’ll work for others as well.
I haven’t figured out how to make a pretty schematic diagram to post. I’ll sum it up by saying that I connected 8 LEDs through 1K resistors to digital pins 0-7 on my trusty Arduino duemilanove. I connected the Y axis pin from the 2125 to digital pin 8. I soldered it all up on a little Radio Shack proto board that I hacked into a “shield” for my Arduino.
This is a really simple and fun project that I’d recommend to any other Arduino n00bs out there. It lets you play with LEDs, an accelerometer, a few resistors and a bit of code on the Arduino. What could be better?
I would eventually like to build this with a bare bones uC (like an ATTiny or something) and a much cheaper accelerometer (probably a mechanical thing), provide a simple way to program the message, and package it up in a nice little box for my kids. Any advice on the best ways to cost reduce would be much appreciated.
The sketch for this project is here.
I am glad you found the project on my feemo blog useful. I couldn’t find any email address on your site to contact you, hence this comment.
I suggest you put inyour email id so people can give feedback!!