64pixels are enough

Posted by on Mar 21, 2009 in avr, led | 35 Comments

I love Blinkenlights. And all kinds of other blinking and flashing LED stuff. I think, it’s already a form of addiction. When I ran across an LED matrix with square pixels, I thought it would be cool to build a small animated display with it. To keep things simple, the display is attached directly to the microcontroller the “Evil-Mad-Scientist-way”.

The display performs really well, the pixels are bright and the batteries last for over two weeks running non-stop. The microcontroller has 2 k flash RAM. That’s enough for three simple animations and a couple of messages.

If you want to see the guts, then follow me to the 64pixels howto.

And grab a 64pixels kit from the Tinker Store, if you want to build your very own.

35 Comments

  1. 64pixels are enough - Hack a Day
    21. March 2009

    [...] put together this lovely minimal LED project. The square pixel matrix is soldered directly to the microcontroller in the same style as [...]

  2. Marcus
    21. March 2009

    This is marvelous! Clean build. Great idea and just simple!
    Want one! ;)

    And big respect

  3. joe bleau
    22. March 2009

    Seems like a bad idea to rely on the micro’s output pin drivers to limit the LED current. I understand it’s a hobby project so you should do what you want, but it wouldn’t pass a design review in the real world.

  4. Alex
    23. March 2009

    I know, but sometimes you have to break the rules.

  5. Nick
    23. March 2009

    Anyone care to elaborate on why the current limiting in the microcontroller is a bad idea?

    As much as I love smug nay-sayers, I’d much rather learn something from this “bad idea” than accept unsubstantiated criticism into what I “know.”

  6. Alex
    23. March 2009

    Okay, this may give you some background, why it’s supposed to be a bad idea, to drive an LED without an limiting resistor.

    The matrix datasheet only states:
    Forward Voltage matrix: 1.8V-2.2V and a maximum rating of
    Forward Current: 25 mA. No curves.

    To calculate how much current goes thru the LED (and so thru a source and a sink pin) we assume, that the LED runs with 4 mA at 1.8 V. That’s somewhat reasonable when you look at other LED datasheets. One thing to remember is, that forward current vs. forward voltage is not a straight line.

    Now we take a look at the I/O pins of the microcontroller. The datesheet can be found at: http://www.atmel.com/dyn/resources/prod_documents/doc2543.pdf

    It states: DC current per I/O pin: 40 mA. That should be the maximum current.
    Then we take a look at the figures 106 and 107, which show the ability of an I/O pin to source and sink current.

    If we insert our 4 mA from above, we get:
    I/O Source current (Fig. 106): 4 mA at 2.5 V and 2.7 V Vcc
    I/O Sink current (Fig. 109): 4 mA at 0.2 V and 2.7 V Vcc
    == 2.5V – 0.2V = 2.3V

    That means, the I/O pin sources 2.5 V, then comes the LED and at least another I/O pin sinks the current at 0.2 V. That leaves 2.3 V for the LED. More than we assumed (1.8V).

    Okay, now lets use the same figures with new values. We assume a current of 15 mA thru the LED (more current, because of more voltage).

    I/O Source current (Fig. 106): 15 mA at 2.1 V and 2.7 V Vcc
    I/O Sink current (Fig. 109): 15 mA at 0.5 V and 2.7 V Vcc
    == 2.1 V – 0.5 V = 1.7V
    That look quite ok to me. Ok for the LED and ok for the micro.

    As you see, the voltage, that the microcontroller delivers is tied to the current, that it sinks or sources. That means, the more current you demand, the lower the voltage. The current goes up from 4 mA to 15 mA and the voltage drops from 2.3 V to 1.7 V.

    In the simplified design for the matrix there are no current limiting resistors. That means, the LEDs suck as much current as they could and as the micro delivers. If more LEDs are lit, the current rises and the voltage drops. So, the more LEDs are lit, the dimmer they get. In real, you can notice that, but you have to look at it very thorough.

    Does this clear things up? Maybe I should do an extra post about that.

  7. mightyOhm » Blog Archive » Space Invaders Button
    13. April 2009

    [...] at Interactive Matter made this awesome space invaders button, inspired by Alex Weber’s 64pixels project.  It uses almost entirely SMT components and an ATmega164P [...]

  8. remmelt
    14. April 2009

    Would this be programmable in-place? I would think so, but I’m not sure. The SpokePOV is pretty similar and that one is programmable, so I’d assume this should be as well.

    Any thoughts?

  9. Alex
    14. April 2009

    The pins for ISP are all used for the matrix. Furthermore, the LEDs directly attached to the micro may pose a problem to a programmer, because they will need some mAs to get the voltage up. And they might just burn down, if you attach a 5V ISP programmer.
    But, you could solder a 20-pin socket to the matrix and then pop the micro out, if you want to reprogram it externally.
    Or, set it up on a breadboard first.

  10. remmelt
    15. April 2009

    The pins on the 2313 of the minipov3 are also used for LEDs, but still it can be programmed in place. I guess the main difference is that the minipov uses resistors before the LEDs (very informative post on when to use resistors, thanks for that!) so it won’t burn out when programmed. The LEDs do light up somewhat when it’s being programmed.

    http://www.ladyada.net/images/minipov3/minipov3schem.png

  11. Alex
    15. April 2009

    Yes, you’re absolutely right.

  12. Nate
    23. April 2009

    Awesome idea, and I’m working on a slight modification of it for my own devious uses… :D I’ll post pics, build, and proper credit on my site once it’s done.

    Have you (or anyone else) had any trouble with Futurelec, though? It’s been over a week since I ordered a few of the LED matrices from them, and I haven’t seen anything except a “we received your order” email.

  13. Alex
    23. April 2009

    Cool, I would love to see that.

    Futurelec? Once I waited a couple of days. Then I wrote an email and received a very kind mail back almost instantly. They were waiting for some parts and offered to ship the parts they had already. Worked fine for me.

  14. Mischka
    6. May 2009

    Hey Alex,

    i tried to flash the Attiny by myself but always getting an Error-Message while flashing the firmware..:

    [...]
    avrdude: reading input file “matrix.hex”
    avrdude: ERROR: address 0×0810 out of range at line 129 of matrix.hex
    avrdude: write to file ‘matrix.hex’ failed
    [...]

    can you tell me whats wrong with it?

  15. Alex
    6. May 2009

    Hi Mischka,
    I just learned, that the avr-gcc 3.4.6 (comes with CrossPack) packs the code much tighter as the newer gcc 4.x compiler.
    The newer WinAVR 20090313 compiles the matrix.c to 2310 bytes. The old compiles it to 1958 bytes. For now I would suggest to install an older version of avr-gcc (WinAVR) and try again.
    In the meantime I will try to squeeze the code a bit.
    Cheers,
    Alex

  16. Alex
    6. May 2009

    Please try WinAVR-20060421-install.exe, that one comes with gcc 3.4.6.

  17. Mischka
    6. May 2009

    Hey Alex, Thanks for your reply. I am using Linux, so WinAVR would not work, but i’ll try an older version of avr-gcc.

  18. Nate
    13. May 2009

    Alex, Mischka…

    I’m getting the same error when I try to burn the hex file.

    Basically, it boils down to “the file’s too big”?

    I already have two versions of avrdude on my box just to accommodate the fact that I’m using my Arduino Diecimila as the programmer (FTDI, etc.), and I’d really rather not build a “spare” version of gcc.

    Could I simply trim the final size down by removing some animations and/or scrolling text?

  19. Alex
    13. May 2009

    Hi Nate,
    yes, at the end it’s a “the file is too big”.
    You can try to cut things down by removing some messages and/or animations.
    Cheers,
    Alex

  20. 64 Pixels Roundup | Interactive Matter
    20. May 2009

    [...] Tinkerlogs 64 Pixel Project [...]

  21. robotguy.net/Blog » Welcome to the Mazetrix
    18. June 2009

    [...] My board is for a project based on the Tiletoy, and incidentally not unlike the Space Invaders Button, the Awesome and 64Pixels. [...]

  22. Chris
    22. June 2009

    Is there anything special about a 3V CR2032 lithium battery that would make it unsuitable to power one of these?

  23. Alex
    22. June 2009

    Chris,
    a CR2032 would work. Marcus did his Space Invader Button with it. http://interactive-matter.org/2009/04/space-invaders-button/
    Maybe the battery life is a bit limitted.
    Cheers,
    Alex

  24. saw0
    25. September 2009

    Hello :)

    I am trying to build this with a 8×8 Led-Matrix:

    http://www.jsweihao.com/pro/dz-6.jpg

    It has the same witing as the one from Futurelec, but somehow i only end up with the whole matrix lit constantly. Any hints?

    Thanks

    saw0

  25. Alex
    26. September 2009

    Hi saw0,

    the pinout looks the same, but the LEDs of your matrix is common anode, while the one I used, was common cathode.
    There is a code snippet (display_active_row) in the source that is commented out right now. Try to use that part.

    Cheers,
    Alex

  26. saw0
    26. September 2009

    Hey Alex!

    Thanks for pointing this out, now i also see that the wiring is different.

    I uncommented the part, It works flawlessly now.

    Thanks for this nice Blinky, my girlfriend loves it :)

    Just another question: I don’t quite understand how to make own animations:

    0×18, // ___XX___
    0x3C, // __XXXX__
    0x7E, // _XXXXXX_
    0xDB, // X_XXXX_X

    how can i translate the “0x##” part so i know which pixel i actually lights?

    Greets and thanks in advance!

    saw0

  27. Alex
    26. September 2009

    Hi saw0,
    0x## is the hex notation.
    As an example: 0×18 is one byte in hex. In bits it looks like this: 0001 1000, so first 4 digits is the 1, that last 4 is the 8. So that lights up the two LEDs in the middle.
    Cheers,
    Alex

  28. saw0
    28. September 2009

    Thank you so much :)

    I found a Conversion table in the net.

    Greetings

    saw0

  29. tgfuellner
    12. September 2010

    Simplicity rules!

    I like this small thing. You can compile with current AVR-GCC instalations by using the compiler option
    -fno-inline-small-functions

    In the Makefile:

    COMPILE = avr-gcc -Wall -Os -fno-inline-small-functions -DF_CPU=$(CLOCK) -mmcu=$(DEVICE)

  30. Lo and Behold, 64 Pixels are Enough! | Coffeebot Labs
    13. November 2010

    [...] enamoured with Alex Weber’s 64 Pixels project from the moment I saw it. When I happened across it (via Make:blog, I think), I was just [...]

  31. Charlieplexed animated heart hoodie « RobotSkirts
    9. October 2011

    [...] The heart uses a technique called Charlieplexing to drive the 27 LEDs using just 6 pins. To finally get the device working, I just soldered wires directly to the heart. My favorite feature of this project was the simple Flash based animation tool Jimmie included to generate the Arduino sketch. It really made what could have been an arduous process of generating animation frame arrays very very easy. You can see the final few animations I programmed embedded below. I liked this badge idea so much, I ordered 2 of Alex’ 64 pixel kits. [...]

  32. dani
    24. April 2012

    Hi Alex,
    great idea and look nice, uuummm how can I get full text size? (using all 8 row instead of 5), i’ve try to edit font.h but without luck, can you help me. i just want to displaying 2 words, but at full sized font. it is possible?

  33. Alex
    24. April 2012

    Hi Dani,
    all characters in font.h are at max 3 pixels wide. Every byte stands for a single column, the last byte stands for the length of the character, e.g. if you want to light up the up most 2 pixels, that would be 0×03, or binary “0000 0011″. That way you can design you own font. Making the font wider would be a bit more complex.

  34. G'Duino
    7. May 2012

    Hi Alex, this is an awesome project. I want to build this project myself but before that, can you please give some detail about fuse bit’s setting of Attiny2313 for this project. Thanks!

  35. Alex
    8. May 2012

    Hi G’duino,
    take a look at the Makefile, included in the zip, at the end of the howto article.