uPOV with Better Firmware! (Pics, video, and source)
- April 26th, 2011
- Posted in Uncategorized
- By rucalgary
- Write comment
This time I am ready to give my source code, schematics, eagle brd files, even a script for uploading new messages!
BTW… uPOV stands for mirco Persistence of Vision.
Shots of the uPOV in it’s full glory!
So a little background…
I wanted to make a small fundraiser for my engineering department, and I thought this might be a sellable item. At ~$6 (CDN) per unit when buying in quantities of 30-100, we could sell them for 8-10 and still make some profit! Not to mention the idea of charging a little bit more for non default messages! (not my idea, but if it makes money, why not right?)
The problem I had with most of the current POV units is that they required skill to use effectively, timing your swings so that the message only goes in the one direction, appears in approximately the same spot, etc… So I decided to use an accelerometer in my design!
I settled on Freescale’s MMA7660 (because it is so darn inexpensive!). Now, this is an I2C device (pronounced eye-squared-see), so I ended up using the ATMEGA48a becuase it happens to have plenty-o-pins (such that I didn’t have to do a two sided board, more on this later), and has a built in TWI peripheral (Two-wire interface) that happens to be compatable with Phillip’s I2C.
Hardware:
Now, I set off to make this thing as cheap as possible, so I BASICALLY went to Digikey and Mouser and chose the first items that appeared with the lowest price that matched my needs. The main components are the microcontroller, the ATMEGA48A and the accelerometer, MMA7660. The LEDS are just some lower turn on voltage (~2V) 0805 SMD leds with 47Ohm current limiting resistors (which probably aren’t all that necessary when driving from a 3V lithium cell). I used two 4.7K pull up resistors for the I2C interface, and then a bunch of .1uF decoupling caps on the microcontroller and accelerometer. There is a standard SMD tactile switch, the battery holder, and a 6 pin programming header. That is it for components other than the battery itself, which is just a standard CR2032 coin cell.
All parts are SMD other than the programming header and battery holder, and the board is single sided to be manufacture friendly.
I printed off my eagle file out of my PCB printer and onto my blank board, etched it, and soldered everything up. Lo and Behold though, once I got down to writing software, I couldn’t figure out why I couldn’t talk to the accelerometer. I had crossed SDA and SCL! what is worse, is that I crossed them RIGHT next to where they are labelled on the accelerometer! A quick knifing and soldering job later I was getting values from it in no time. Note that the items in the zip file are corrected and do not have this flaw.
Firmware:
I settled on using the two timers (The first 8 bit, and the 16 bit) on it, where the 16 bit one times the oscillation, and the second is used to display the message at the right moments. As I was already using the available interrupt pins for the LEDs, I decided against bringing out the interrupt line on the accelerometer, and instead simply pole it for values. I store the message, message length, and message delay all in EEPROM, which is loaded on start-up. Currently, I am only reserving 200 of the 256 bytes of EEPROM for the message, and as I only use 3 other bytes (one for message length, two for the message increment delay) there is more room for additional features.
One of my friends suggested the idea of using the tap detection on the accelerometer to change messages, or the Xaxis (the Y is the lateral movement) to detect orientation and allow messages to be scrolled vertically instead of horizontally; all automatically! This will come soon I think.
Software:
I used AVR-GCC to compile the code, and AVRDUDE along with my cheapo clone of the USBTiny (from LadyADA) using a buffer to convert the 5V usb power and signals down to a usable 3.3v power and signals for my microcontroller (the microcontroller IS 5V tolerant, but the accelerometer isn’t). I then wrote a simple bash script to convert the message and delay into a EEPROM file that loads it onto the microcontroller.
I included ALL my source files (including my eagle files of my USBTiny clone programmer and the special buffer) in the zip below, and a new movie for your viewing pleasure!
Source files:
uPOV source files (1129)
P.S… Be sure to check back for my large RGB POV display. A protospace member (our local Calgary hackerspace) sugested tetris, breakout, and space invaders. I think this will come true in the future months.








THANK you rucalgary for the jump start and THANK you cell phones for making the accelerometer dirt cheap.
I wouldn’t mind paying a little extra to integrate a ATMEGA right into the accelerometer. I wonder if that’s difficult to do? Combine a analog mechanical device with a microcontroller? Front end pre-processing with some IO lines would be really useful.
I know right!? At least the MMA7660 is only about $1.60 in decent quantities. (30-100)
Congratulations, this is a excellent project and thanks for the files.
No worries and thanks for the compliment! I love sharing what I make.
Wonderfully done and I might give this a go myself. Thanks for all your hard work.
Realy nice project, great job !
Hi, when can I order one?
Sorry Paolo, but I’m afraid it will be local sale on campus only.
That’s awesome! I remembered making something like that, but accelerometers were expensive then, so I used a spring with a ball-bearing for weights and 2 contacts for the horizontal movement.
Well done man! This is how you design something cheap, to sell for a profit, that people will buy. Can I buy one that says “FightCube.com” – “There ARE” – “no rules.” ? If you don’t have any made up I suppose I could make one, but would love to send some money your way. My email is FIGHTCUBE AT “don’t forget to remove this” GMAIL and then a DOTCOM … think that will fool the robots?
why not to make a video describing all parts and the installation process, ( for those with the almost ZERO knowledge)
i’m pretty sure it’s easy to by all the parts from the internet.
I plan on it, but I am working on a USB version that will allow the message to be updated via USB. I have the hardware for that one working, but still designing the firmware.
Good call. Making it not require a programer to use will make it useful to non engineers. Impressive job on this.
Im having a problem trying to print the eagle file on your source download. The Povbadge.brd, one your photo the Grounds of the leds and a few other components are grounded to what looks like and out side trace. when I run my eagle setup I only get the signal traces and not the outside trace area. I think there might be a setting to give the outside trace area. this but I dont know were to look. I just ordered the parts for this build
are you referring to the ground-plane? When saving, eagle automatically reverts ground planes into their unfilled state. To “refill” the groundplane, just click on “ratsnest” or “auto-route” either one will complete the ground plane for you.
also, I noticed that I didn’t place a marker for the accelerometer pin locations on the actual PCB. make sure the little dot on the accelerometer matches with my photos. the dot should be on the closest corner to the push button.
Thank you also one more quick question did you solder the DFN package by hand?
Yup! It helps if you use a bit of Kapton tape around the package, brush a bit of paste flux onto the pads, run your soldering iron across to get some solder on the pads, remove the tape, DON’T clean the paste off just yet. Hold the part in place with some fine tweezers, brush the soldering iron tip along one of the sides until it stays. Then go to the other side, brush on flux paste, and do the same, adding a tiny bit of solder if needed. then go back to the first side, bush on flux, and wipe the iron along the pads. make nice little solder blobs on all the pads!
Afterwards to avoid headaches, check each of the lines (SDA, SCL, VCC, and GND) against eachother to make sure they are not shorted. if they aren’t, and you can clearly see (with a magnifying glass or microscope) the the pads are all properly soldered, you are done!
you can do it without the Kapton tape, but it is a bit messier.
Hi!! Nice project, congratz!! I made something similar, take a look
http://www.todopic.com.ar/foros/index.php?topic=35923
I was needing the mma7660 library, so I stole
Very nice! I like the minimal use of components.
Thank you so much for your work!!!! Your code is very good and it works perfectly. Very nice job!
great job
can i get the code and more details of the project
All the documentation is at the bottom underneath the youtube video.