Arduino + Led Matrix + Bad Apple!!

I've seen "Bad Apple!!" video ( and the wonderful stop motion version (, and I wanted to make my own really small tribute with my really small Arduino and my really small led matrix ! ;-)

Here is the result, pretty simple.

  • On Arduino : led matrix initialisation, waiting for incoming data over serial port and sending them on the display. I can't do easier ! Next version will be with SD card and 30fps synchronisation.

  • On the computer : video resize (24x16), black&white, conversion to the led matrix display format. Music was added after the shoot, over the video.

Have fun with Arduino ! ;-) Frederic, Strasbourg, France

Very cool, i would like to know how did you convert it to led matrix format?

Hi !

The problem with this matrix is that data is not written from top-left to bottom-write. You have to read 8 pixels blocks from left to right, but rows inside a block from right to left. Like if matrix was put upside down… :frowning:

Here is my PHP code (used in command line interface, and with 24x16 one bit PNG format) :

$image = imagecreatefrompng($argv[1]);

for( $x_block = 0 ; $x_block < 3 ; $x_block++ ) {
    for( $x_pixel = 7 ; $x_pixel >= 0 ; $x_pixel-- ) {
        for( $y_block = 0 ; $y_block < 2 ; $y_block++ ) {
            $octet = 0;
            for( $y_pixel = 0 ; $y_pixel < 8 ; $y_pixel++ ) {
                $x = ($x_block*8)+$x_pixel;
                $y = ($y_block*8)+$y_pixel;

                $color = imagecolorat($image, $x, $y);
                $octet = $octet*2;
                $octet = $octet+$color;
            echo chr($octet);

PHP is returning data in the good way for the display. The Arduino have juste to copy incoming data to the led matrix.

I hope it will help you.

how did you send the data over? what was the data you sent over

From what I see, I think he's sending the picture over in a straight bitmap. He mentions that decoding is not done topleft to bottomright, his looping code (on the PC, done in PHP in the code he posted) takes care of that. He's just using a serial connection, I think.. The Arduino is then displaying that bitmap on the LED grid. 24x16=384pixels. One pixel per bit, so that's only 48 bytes for the full image, probably passed as just a stream of CHAR or BYTE values, 48 bytes long. Serial handles that even at slow speeds.

Pretty good framerate.. now you need a way to produce the PNGs downconverted from uncompressed AVI frames... so that on one side you just feed in a video file and on the arduino, the best approximation is mapped on the LED matrix..


You're right. The computer do all the job and send data in the raw format for the display. I send bytes via serial port. Arduino just read each byte and send it to the display.

As I said, it's just for fun. Not a big work. But it was funny to learn how to display on this matrix.

I'll send Arduino's code here. I don't have it here. Sorry.

For AVI->image conversion, you can use for example ffmpeg ( :

ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg


incredible project.