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.
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.
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.
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!
uPOV source files (2576)
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.