Instructables

Flames effect with a 8x8 LED Matrix and ATMega328

Featured
A while ago I found some blog posts explaining how to use a LED matrix as a pendant (http://hackaday.com/2013/01/10/8x8-led-matrix-pendant-sealed-in-a-block-of-epoxy/ and https://sites.google.com/site/tinymatrix/ ). The 8x8 matrix pendant looked cool, but it was missing detailed information on which parts to use and how to solder everything together.

With help from a friend, Uriel Guy, we managed to figure out how to make it work. Well, actually, Uriel did most of the work… including of cleaning up the code, modifying it to work with Arduino, and optimize it. I’m just writing the instructable because he got lazy :-)

By the way - the code itself is a piece of art. Check it out if you want to see how to implement 16 levels of red using the dot matrix.

 
Remove these adsRemove these ads by Signing Up

Step 1: Materials

Picture of Materials
You'll need the following -
  • ATMega328
  • 8x8 LED matrix. I used the 38mm x 38mm  (see the comments below)
  • Metal pins
  • 10k ohm resistor
  • 100uF capacitor
  • 2 x 22pf Capacitor
  • 16 MHz crystal
  • AVR programmer
  • Soldering iron and assorted accessories
  • Power source. I used  2 x CR2032 cell batteries connected in series
Note about LED Matrix – I used a 38mm x 38mm matrix because it hides the ATMega328 well. The code in this instructable is designed to work with a SZ*21588 matrix, where rows are ground and columns are positive (attach link to schematic and bad schematic). If you are not sure what I am talking about, make sure your schematics look like the one I attached to this instructable. Note that when I ordered mine I ordered two pieces from EBay, and I got two different models – SZ*21588 and SZ*11588. So make sure you know what matrix you ordered. Or just modify the code accordingly.
d4ng1 year ago
Thanks for the quick response! I'll have to give it a shot! Any good resources I should be aware of in terms of creating that flame affect? I've started to mess around with writing individual bmp's but can't shake the feeling there's an easier way to go about it.
d4ng1 year ago
Any ideas on wether or not this code could work with an 8x8 matin backpack from adafruit? It's so awesome I would love to replicate it!
OrenLederman (author)  d4ng1 year ago
I am not sure whether it will work. I think that Adafruit's backpack only allow you you to turn the LEDs on and off (but no gradient). I actually bought one an Adafruit matrix to try it out, but never found the time to actually do it :)
khanman861 year ago
I wanna make an arch, and I wanna put these LED displays. Can someone do an instructable! Or gear me in the direction of how to program multiple Boxes. maybe what the easiest book of instruction is for programming these LeDs? Or something!!! Thanks
stewo1 year ago
Hello.

PLS. I use different matrix too:

(http://www.ebay.com/itm/170667263843?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649),

but not work-(all leds is on and sometimes flash) - I try more connecting but with same result. (I trying googled, of course)
Can You help me pls? How to change wires or code?

Thanks.
shichimi stewo1 year ago
I have same problem.Just swap rows with columns - Arduin Pin:PB1 to Matrix Pin: 13 , Arduin Pin:PC2 to Matrix Pin:9 and so on.
Matrix Pin:     13    3        4     10       6    11   15    16
Arduin Pin:  PB1 PC3 PB0 PC1 PD0 PD7 PD1 PD5

Matrix Pin:        9    14     8      12     1        7      2      5
Arduin Pin:  PC2 PD2 PD3 PB2 PD6 PC0 PC4 PC5
Could you possibly point me (on ebay) in the direction of the 'avr programmer' i need, and maybe even a tutorial somewhere on how to program up that chip. Very new to this, eager to learn. Thanks.
OrenLederman (author)  mrA4Awesome1 year ago
You can either use an Arduino as an avr programmer (Google it... I haven't tried it) or get a USBTinyISP from ebay (see how to use it here - http://www.instructables.com/id/Atmega-Programming-with-USBtinyISP-and-Arduino/)

If you are going for the USBTinyISP, just search for it on ebay, there are plenty of them there. I also recommend you get one of these adapters, they come in handy (and save you time when you first try to figure out the wiring) - http://www.ebay.com.au/itm/10PIN-6PIN-ISP-Adapter-to-breadboard-for-Atmel-AVR-ISP-/121083178910?pt=US_Audio_Cables_Adapters&hash=item1c311eaf9e
holidayv1 year ago
I used a different model matrix and had to switch some wires but it works great! It definitely looks better when diffused.
RPKH1 year ago
I would put resistors in series with the leds to limit the current. Sure, there is some internal resistance in the led matrix, atmega, battery, etc. but it's not reliable.
Other than that nice project :)
jtechian1 year ago
Why not save the crystal as timing on this is not that important, and set the chip to internal RC oscillator. Still I like this. Also maybe port this to an ATtiny 84 to cut cost more.
OrenLederman (author)  jtechian1 year ago
It should be possible switch to the internal oscillator, haven't tried it. You can't use ATtiny 84 though (unless you add more components) - you'll need something with enough pins to match the pins on the matrix. Maybe an ATMega8.
Yes, after writing I realized that, and to add another chip to this negates the cost saving. Looks the mega 328 is best here. Thanks for the share of this..
It looks like there is something going on with the 4 LEDs in the upper left.
Yeah, I know. There are a few quirks that we couldn't figure out. I'm not sure if it's the code, or something about how this matrix work.
Mynasru1 year ago
Burns like a charm now ;)

Thank you.
OrenLederman (author)  Mynasru1 year ago
Great. Glad to hear that :)
Mynasru1 year ago
I have a problem with pin 1 (on the matrix), and pin 1 on the atmega328. the column on pin 1 doesn't light up (I did check the connections a couple of times), and the row connected to pin3 of the atmega lights up very bright for some reason (but it does blink). Maybe I'm just retarded or there is something else. I did program the arduino bootloader first and uploaded the sketch afterwards.
OrenLederman (author)  Mynasru1 year ago
Oops. I got the schema wrong! All the yellow wires should be one pin down! The first one should be connected to ATMega pin #2, not #1 (which is reset). I'll update the sketch.

Let me know if you are still having this problem after the fix

(Sorry about that. I know that "debugging" this matrix can be a pain)
qquuiinn1 year ago
will you ever take the components from the pendent and make an 8*8 led matrix watch?
OrenLederman (author)  qquuiinn1 year ago
Or this - http://learn.adafruit.com/3d-printed-enclosure-for-the-timesquare-diy-watch-kit
OrenLederman (author)  qquuiinn1 year ago
Probably not. I don't wear a watch :)
But, it that's what you are looking for, check out this kit - http://www.adafruit.com/products/1223
Love your work. The fire effect looks great
OrenLederman (author)  lonesoulsurfer1 year ago
Thanks :) Putting a thin diffuser in front of the matrix improves the effect