TUTORIAL

HELP OUT

If you feel that my videos are helping and you would like to contribute, you can toss some coins in the Tip Jar via PayPal.

Select amount then click the “Donate” button.

Brainy-Bits Tip Jar Amount

OVERVIEW

Couple of years ago, I saw someone create an animated picture frame using a 16×16 matrix of RGB LEDs and I thought it was the coolest thing ever!

Since I’m a big retro arcade gaming fan, *I grew up in the 80’s when arcades were still a thing*, I wanted to create one for myself.

The one I saw was using a Raspberry Pi to drive all the LEDs, but I wondered if you could do the same kind of thing using the Arduino.

Since the Arduino’s have no where near the amount of memory available on the Raspberry Pi, I wasn’t sure how many animated characters I could create on an Arduino.

I realized that since the character information which is stored in arrays doesn’t change (meaning that I never update the info) I could save it in Flash memory instead of SRAM where the sketch gets executed normaly.

Since Arduino’s have much more Flash memory available than SRAM, I could store all my character information there and have more space available to create many more. I was worried that using Flash memory might be too slow, but it worked just fine.

Here’s an example of the amount of memory available on the UNO:

Flash 32k bytes compared to only 2k bytes of SRAM.

The Arduino MEGA has even more:

Flash 256k bytes compared to 8k bytes of SRAM.

In this tutorial I’ll be using the Arduino MEGA, but you could use the UNO as well but of course you will have less space to store the characters.

To create the 16×16 matrix of LEDs, I used regular WS2812B LED strip, the one I used have 60 LEDs per meter, which gave adequate spacing between the LEDs.

You also need to create some sort of grid to isolate the LEDs from one another, I used my Laser Cutter to create the grid but you could also find something that works at the hardware store.

CONNECTIONS

Since I’m using a WS2812 LED strip, I only need one connection from the Arduino to control all 256 LEDs.

The led strip I’m using has 60 LEDs per meter and have 3 pins: 5V, GND, and DATA.

Pin 3 of the Arduino MEGA is connected to the Data Pin at the start of the LED strip.

I also connected a 470 ohms resistor inline to protects the Arduino output port from over voltage that could damage the first LED in the strip, this is good practice but never had a problem without one, so it’s optional.

At the end of the first strip you then connect the VCC, GND, and DATA pin to the LED strip below it, and keep doing this until you reach the end.

To power all these LEDs you will need a pretty beefy 5V power supply since the Arduino cannot supply power to that many LEDs.

In theory if all 256 LEDs are lit at 100% brightness and white in color, then the total power consumption would be around 16A.

I connect a capacitor to smooth out the fluctuating current draw by the LED strip, in this case a 1000uF 10V, again this is optional but good practice.

Since I’m only use 15% brightness and not all the LEDs will be lit up white at any time, I’m using a 5V 10A power supply which is enough for my purposes.

To make sure I don’t get a big voltage drop, I’m connecting the VCC and GND from the power supply to the VCC and GND at the start end end of the LED strip.

THE CODE

Like I said at the beginning I want to save the character animation frames to Flash instead of SRAM.

To achieve this I’m using the PROGMEM command to save the arrays to Flash. You can see this in the code when I create the array and when I read from it.

In the sketch below you will see 6 arrays for a total of 3 characters.

Each character has 2 array or frames to create a simple animation for each one. Of course you can create as many as you want as long as you have Flash memory available.

Each array has 256 HTML color values that represent each LED in the 16×16 matrix.

Hi! Thank you for this, you’re amazing! I’m doing a similar project on a slightly larger scale with WS2811 LED pixels that come in 50 pixel strands (needing 5 strands plus 6 more pixels to make a 16 x 16 256 pixel matrix). These strands have 3-pin JST-SM connectors (5V, Data, Ground) to chain strings together and extra pigtails for “5V” and “Ground” at the beginning and end of each strand. I was wondering if it’s okay to use one power supply but run the 5V and grounds in parallel to distribute (inject) and solve any voltage drop issues. What do you think?

Hi Brian, you can use the same power supply to inject 5V and GND to the Start and the End of the LED strip, as long as the power supply you are using is strong enought (Amp wise) to supply all the LED’s connected. Hope this is what you meant by your questions? Cheers!

After reading your comment again, I understand what you meant: You have a JST connector at the Start and End of your LED strip, but also have 2 extra wires (5V and GND) as well. I believe those extra wires are connected to the same connector that the 5V and GND on the JST are, so if that’s the case, it shouldn’t matter which one you use. But you could use only the Data wire on the JST to connect the Arduino, and use the separate 5V and Ground wires to supply power at the Start and End of your LED strip. Hope that helps! Cheers!

One other great hack I discovered while building this: I did not cut up my 5M LED strip into pieces and use connectors. If you bend it at each turn, it takes up two LEDs (wasted) on each turn. There are 15 turns, which uses up 30 LEDs. Then there are about 8 or so left over at the end. Then you can plug into both connectors built into the ends of the strip (no soldering or cutting wires). And you do not need those plastic connectors. I found some connectors that worked fine, but there are many that do not work well. And one bad connection and you’ll be pulling your hair out. To compensate for the extra LEDs in the strip, I just wrote a quick translation program that takes the incoming sprite and ignores the LEDs in the turns. It is lightning fast and works great! Had to share because it is MUCH easier than the connectors! Thanks for a great tutorial!

Would there be a conceivable way to maybe link the display to say an IR Proximity sensor so that when I am close to it, the character changes to show maybe the date or the time? or since everything is done in flash at runtime there is not a way to change things like that? Also, thanks for the tutorials they’ve been a great teaching resource for myself.

This has been a really fun project and I am definitely learning a lot. I have been making my own graphics and got to the point where I wanted to make a scrolling text. I couldn’t find any code to help me do it the easy way…..Sooo I did it the hard way and just put a bunch of single files at faster refresh rate to make an animation of scrolling text. My text is simple and is 64 frames big. I’m using a Mega and it seems that I am using about half the available memory. I placed this code for the 64 frames at the end of all my other pics/animations, but for some reason it seems that I don’t understand the order in which the code works. I just put the code for each picture after the other in order I wanted them to run, but the code runs from the bottom of my script. I placed the same code at the beginning and all my code run in about 2 seconds. I have only copy and pasted making everything exactly like your example script. Is there something that you can put in a script to make it run a different order? OR is there a way that some scripting could get stuck in the memory and not re-write when I give it new one? If I run each piece separate it seems to work fine….its only when I put the two together that it throws me off. I was going to try it on my uno, but the file is too big. Maybe there’s a simple explanation? Thank you again for such a fantastic website!

I tried it on my Nodemcu, it worked rly well. But after a short time the array or so broke up? So sometimes the picture got ripped off and idk why – can’t fix it. Maybe it’s the delay or the data connection? Maybe you know what happend (sry for the english im from germany :D). Btw thank you for this great project !

This is great I even went out and bought the 16 x 16 led board to use with my Arduino as well. Thanks for the code and tutorial, definitely. My question is does anyone have a link possibly for more arduino codes for the 8bit characters?? I am dying to find more of them been searching w/ not much luck…. PS I am somewhat new to all of this as well.

Just finished putting this together, have added several sprites to it. Great instructions. This is going on display in my arcade room.
The Laser cut files would be sweet if you could share those. Added a few bucks to your tip Jar Thanks for this. Awesome.

Hi, I’ve checked for the files, but the only ones I have left are from LaserCad and it seems I’ve deleted the Adobe Illustrator versions… Doohhh! Sorry about that, but next time I create anything that involves the Laser Cutter, I will put the Illustrator or DXF files available for download.

Like I told Nick, it seems I’ve deleted the Adobe Illustrator versions… and only have the LaserCad versions. Next time I will make available the Illustrator version or DXF files for download. Sorry about that…