Introduction: Wearable Message Board
I had several 8x8 LED matrices with a MAX7219 driver board lying around for a clock/message board project i'm working on. I'm heading to RobotFest in MD this weekend with my kid and thought it'd be fun to make a wearable message board to clip on my backpack since I had the parts lying around.
Time to build: 4-6 hrs
Cost: $20-$30 depending on parts and how much stuff you have laying around and if you want to make it bluetooth enabled.
I am using a bluetooth module I have for another robotics project that was very simple to integrate, and I wanted to build my first stand-alone ATmega328 project instead of doing everything on an arduino all the time.
This project is fairly simple and inexpensive. The "MAX7219 8x8 LED matrix kit" boards can be found on ebay for as low as $2.70 with free shipping, ATmega's with the arduino bootloader are about $4, the capacitors and oscillators are only a 10-50 cents per part if you buy a bunch at a time. The bluetooth module is more expensive but i am using a much more expensive model than what is really required for the project. You can do the same thing with a cheaper version that is only around $8. Or leave out the bluetooth all together and just run a pre-set series of animations or text.
(estimated costs in USD)
1 x ATmega328P-PU ($4)
1 x 28 Pin DIP IC Socket ($0.20)
1 x 16Mhz Crystal Oscillator ($0.50)
2 x 22 pF capacitors ($0.20)
1 x Bluetooth Module ($8-30)
1 x 8x8 MAX7219 LED Matrix board kit ($3)
1 x 3AA Battery Holder ($2.50)
3 x AA batteries ($3)
1 x piece of breadboard ($2.50)
Total: $24 - $46
Various header pins (male and female), hookup wire, solder, some kind of enclosure, Arduino for programming the ATmega328
Soldering iron, dremel for enclosure
Step 1: Prototype Circuit
It is recommended to prototype every project on a breadboard before soldering everything on a board. This project is no exception. I had no problems going from my prototype to my breadboard and it actually made development much easier because I had enough parts to keep the prototype in-tact and then use it for programming on a full arduino so i didn't have to keep re-burning my ATmega over and over. (I really need to get an FTDI programmer for future projects.)
The included schematic is SIMILAR to what you'll be building. I couldn't find a fritzing part for the led matrix i used so i just grabbed a sparkfun one but it actually is a 3 color display instead of a single color matrix like i'm using.
I didn't bother adding the reset button, or the led's etc because i was just popping the chip out of the arduino and dropping it right onto a DIP socket. This is the EASIEST (and laziest) way of transferring an arduino project to your own PCB. If you want to do this the right way, you'll add an ftdi header and also probably want at least a reset button in case you need it.
study these and you'll know just what to do...
Arduino to Breadboard
Based on reference above:
- Put your ATmega on your breadboard first.
- Add the oscillator to the board between pins 9 and 10 of the ATmega (be sure to note which way the chip is facing so you don't put them on the wrong pins)
- Place your capacitors between the pins of the oscillator and the ground line of the breadboard
- Run lines from the VCC and AVCC pins on the ATmega into the positive lines of the breadboard
- Run the 2 ground pins from the ATmega into the ground lines of the breadboard
- Plug in your battery holder (without batteries) to the positive and ground lines of the breadboard
As of now you have a fully functioning standalone arduino. If you burn an arduino sketch to this board it should function exactly like the arduino did. You can try it with a blink sketch to be sure everything is working correctly. Just load blink onto the chip then add it back onto the breadboard and attach an led with resistor up to pin 13. LINK TO BLINK
NOTE: You may need to burn the bootloader If your atmega doesn't already have the arduino bootloader on it, you may have to burn a bootloader onto it. You'll know you have to do this if arduino gives you a message like "avrdude: stk500_getsync(): not in sync:..." This can be done using an arduino and you can just follow the instructions on the arduino site.
Now onto our project...
- Add a presoldered 8x8 LED matrix on MAX7219 board to the circuit with the inputs into the breadboard (mine have 5 input pins and 5 output pins)
- Run a jumper between the positive line on the breadboard and the VCC pin of the 8x8 Matrix board
- Run a jumper between the ground line and the GND pin of the 8x8 Matrix board
- Run a jumper from D10 of the Atmega and CS of the 8x8 Matrix Board
- Run a jumper from D13 of the ATmega (SCK) and the CLK pin of the 8x8 Matrix Board
- Run a jumper from D11 of the ATmega (MOSI) and the DIN of the 8x8 Matrix Board
(look at this reference for explanation of SPI)
You can also now add a bluetooth module if you want to use bluetooth to update the messages. I used an Adafruit BlueFruit EZlink but like i said before, they're a little pricey especially for this.
Attach the bluetooth module and connect VCC and GND. Then run TX to RX and RX to TX on your breadboard and bluetooth module. TX=transmit (pin 3 on the atmega, RX=Recieve (pin 2 on the atmega). So what is transmitted to the bluetooth needs to be recieved by the ATmega and vice versa. BE SURE TO REFERENCE YOUR PINOUT on the atmega datasheet to make sure all your pins are correctly attached.
You can now test your build by burning the included arduino sketch onto the chip and popping it back on the breadboard. If everything went well you'll have a series of several icons i put on there showing up in sequence and looping.
If you have the bluetooth module on it... install Bluetooth Serial Controller on your android. Go into the terminal view and send a text string to the device. It should start a ticker rolling of the text you just sent. you can start the animations again by sending the string "ani" (without quotes).
Step 2: Enclosure
I built my enclosure out of an old baby monitor. you'll want to find something that works for you.
I recommend something with a clip that can be attached to a backpack or belt or guitar strap or something. The whole point is it's wearable so you want to be able to attach it securely and remove it easily.
The big points to consider are that your enclosure:
A) Fits all the parts
B) Can be easily modified with a tool (like a dremel)
C) Looks snazzy enough
Using a dremel and cut off wheel its easy to cut a window in the front of a plastic enclosure. Mine isn't a perfect square but you can't really notice when you're looking at the final device without REEEEEAAAAALLY looking at it.
You could go the more professional route and have something laser cut or 3-d printed, but this is supposed to be a cheap project and can easily be done with a found enclosure.
You'll notice on the back of my enclosure i cut out space for the circuit to poke out the back because it wouldn't fit all inside the body of the baby monitor. You could probably make it fit in something like this if you wired the PCB differently.
I would also suggest spraying your final box down with a coat of plastic-bonding spray paint as it might get knicked or dirty while cutting.
Step 3: Build Board
NEWBS: If you've never soldered before you will definitly want to practice on some other kits or just practice with some spare parts first. If you've never worked with a perfboard and hookup wire i think this is a great tutorial on how to make that jump to building circuits on a perfboard: Collin's Lab Circuit Skills: Perfboard Prototyping Collin Cunningham is Amazing and his videos are so helpful to beginner elctronics hobbyists. I've probably watched all of them 10 times each and if he had his own tv station with just his videos playing 24 hrs a day i'd probably watch it more than was healthy. A diresta/cunningham channel would be a dream come true.
I built this project to specifically fit inside of my enclosure as you should too. Make sure to layout your enclosure and work slowly to ensure that you can connect your finished board to the led matrix inside your enclosure tastefully. In order to achieve this, I built my board to have a downward facing right angle female header that slid onto the male headers from the LED Matrix Board. This is how it can be easily taken apart for maintenance etc. I think this design could be improved, but it definitely worked very well for me for this project. The thing to note is that the LED matrix sits directly below the perfboard on top so i put a buffer of cardstock from a business card between them so that none of the solder points would touch. I don't know if this is safe or not but it got the job done. Plastic might be better or some other method of separating the two. Please note: i am not liable if your device catches on fire while you're wearing it!
The way I achieved the connection between the board and the led matrix was to take a female extension header (in my case 6 pins but i'm only using 5 of them) and bend the pins up to go into the perfboard at the correct height. Then solder the leads onto the bottom instead of through the top. this was tricky but worked pretty well. I then also filed down the pins on the top of the board to prevent any accidental shorts.
I'll try to take a better picture of this but it can be seen in the attached images.
One great trick i've picked up while soldering boards is to only solder one pin of your component (header pins or sockets etc.) then make sure they are flat or aligned correctly. If not, hold the soldering iron on the solder point until the solder melts then align it correctly while the solder is liquid and quickly remove the iron to let it set. Then solder the other points on.
My board has a lot of sloppy connections to make buses for GND and VCC. you might want to do this a bit cleaner, but this style works well and is expandable in the future. It also cuts down the wires all over the top of your board.
Use male or female header pins where necessary to make your board modular. You don't want to have to desolder stuff that should be removed.
Additionally use dip sockets for IC's so you can easily pop them out and swap them if they are bad or something is broken.
Step 4: Program Microcontroller
I programmed my board by simply swapping out the atmega chip into the socket directly from my arduino. You can do this to easily build a project like this, or you could go to the extra several minutes of effort to add a programming header pins and get a cheap FTDI programmer. In the future that is how i would go about other projects, but i didn't have the FTDI interface available and I was too lazy to use an arduino for it. You can read up more about it on the links i provided on the prototyping step.
DOWNLOAD ARDUINO SKETCH
I also included the Schematic (note: it shows an RGB LED matrix instead of a single color... disregard this)
This sketch is kind of sloppy and not well commented (if anyone wants to clean it up feel free to send me a copy of the updates). The things to note are that it has several examples from the MAX72XX library rolled into one sketch as well as a custom 8x8 Animation format. You can extend this very easily by making new animations as explained below. If you have any trouble with this sketch, just feel free to shoot me a comment and i'll try to answer it.
MAX72XX Panel library
Adafruit GFX library
Current list of commands:
You can trigger a bunch of different animations and icons by sending any of the following commands to the device via serial:
If one of the above listed items isn't sent the sketch assumes you're sending a Ticker Tape message and will scroll through the message. Any command or message will repeat until you send another command (except "boom");
"ani" is a loop of several of the icons and you can see the function at the bottom of the sketch to see the timing etc.
You can personalize your message board with custom animations. I built in a standardized method of writing out bitmaps that are stored as a 64 byte byte array. this allows you to have up to 8 frames of 8x8 animation for a single function. The animations are generated by writing new byte values into memory and can be written as binary representations of the led's on the matrix. So you can use a 1 for high (lit) or 0 for low (dim) to make a picture. If you add new images or animations please share them... i'd love to see what other people do with this.
if you squint your eyes at this you should be able to see the 2 frames of the ghost animation:
memset(mBitmap,0,sizeof(mBitmap)); //Clear mBitmap byte array
aniFrames=2; //Tell the arduino how many frames you're animation is
dBitmap(); //run dBitmap to draw the bitmap frames onto the matrix
the dBitmap function just loops through each byte in the array and does a bitwise comparison to see if the corresponding LED should be high or low.
You'll need to play around with this a bit to get it to look right. You'll also want to add the command into the loop so when a new serial command is sent to the tape variable it can trigger the function. (you'll see what i mean in the code... if not ask and i'll help you out)
Step 5: Go Out in Public
You should now have a completely working wearable message board.
Clip it on your backpack or other strap and show the world.
If you make one of these send me a link to a pic or video... I'd love to see what you create.
Add a power switch so you don't have to unplug the batteries to turn it off.
Add a serial function to accept animations/images from a custom android application.
Hook up a gyroscope and use it for input.
Cascade some more matrices.
Make it RGB
I hope you enjoy your LED Matrix Message Board. If you have any questions or suggestion to make it better, please feel free to share.
We have a be nice policy.
Please be positive and constructive.