Sunday, June 29, 2008

Gif2led released, and with AVR LED Egg demostration!

We have worked on LED matrix for so many times, but mostly for text scrolling, so how about make some animations on it? But we are too lazy to make the animation patterns to the C header file in an array of bytes. We finally finished one tool may be useful for all led matrix lovers!

The gif2led project is written in Ruby, required Rmagick library for gif manipulation. It is mainly designed for 8 or less columns matrix, for instance 8x8 matrix, 10x8 matrix, 5x7 matrix etc. It output an pattern header file with a 2D array frame by frame from an animated gif input. We only tested with AVR-gcc, but it should be useful for other MCUs too. You can find more information on the gif2led project page,

Let start with our demonstration, the project is called LED Egg, it is based on a 10x10 matrix (but we only use 10x8 in our case) with an Egg case to hold the circuit board.

To prepare the animated gif, we use macromedia Flash, and here is the screenshot:

Noted that the frame 0 (marked as CAL above) is a special frame, which used for calibration. When used with gif2led tool, the frame 0 is the pattern of your led matrix with all led ON.

and then export the movie to an animated gif:

Then simply run the following command, we can obtain the 2D array header file:
ruby gif2led pattern.gif 20 > pattern.h
//selected ratio is 20.0%
//Cal result: LED Matrix (row*col) = (10*8)
const unsigned char pattern[63][10] PROGMEM = { //Frame 0 {0x42,0x00,0xa5,0x00,0x84,0x21,0x00,0x42,0x21,0x84} //Frame 1 ,{0x00,0xa5,0x00,0x84,0x21,0x00,0x42,0x21,0x84,0x42}
#define MAX_FRAME 63
#define ROWS 10
Now, we have to prepare the circuit part, we use AVR tiny13 together with 4017, please refer to the circuit diagram<here>. 4017 is used as a row counter, and such that we can only use 1 pin for row shifting. The remaining 4 IOs of the tiny13 would use for column output, we are using 10x8 matrix this time, so we assume the pattern is symteric to save pins, so 1 I/O drive 2 columns in our case. The circuit showed below:

So Lets add an egg case, the egg is made from pu foam plastic, it is used for Easter decoration.

Video demonstration:

Close look on the LED pattern:

To download the gif2led tool, AVR source codes, and flash template, please find in the following links:

Gif2led project page:

Gif2led Rubyforge page:


Anonymous said...

can u send me a copy of schematic diagram of your project in gif2led released w/ AVR LED egg demonstration? and if you can help us on what circuit should we used to drive the LED because i want to make just the same of your project but the waveform should be displayed

Andy Bardagjy said...

Wow, where did you get that LED array?

Bitartist said...

The LED array was bought from Japan, it looks pretty cool:)

Unknown said...

great project! do you have a part number or manufacturer name for the led array?