DownloadGIFs_opener-6jb

For more on microcontrollers and wearables, check out Make: Volume 43. Don't have this issue? Get it in the Maker Shed.
For more on microcontrollers and wearables, check out Make: Volume 43.
Don’t have this issue? Get it in the Maker Shed.

Want to rock big animations on your LED wearables? There’s an easy way to download animated GIFs onto a 16×16 RGB LED matrix using Processing software, Arduino, and the Teensy microcontroller. We designed this project for our new MeU Square matrix but you can use it with any home-built NeoPixel LED grid. We’ve made it easy — all the required code and libraries are on our Github page at github.com/MeULEDs.

Check out our YouTube video on how to do it, then follow along with the step-by-step instructions below.

YouTube player

 

Project Steps

Find a 16×16 animated GIF

Pixels from an image file (GIF, JPEG, TIFF, PNG, BMP, etc.) can be broken down into red, green, and blue values, which is how the WS2812B-type LED displays a specific color. Using this principle we came up with a Processing sketch to convert an animated GIF file into an Arduino sketch that you can then download onto a 16×16 WS2812B matrix. In order for the sketch to work properly, the GIF file needs to be 16×16 pixels.

The best way to find 16×16 pixel animated GIFs is to do a Google Images search and use the Search Tools to narrow it down. First select Size→Exactly and enter 16 for height and width. Then select Type→Animated.

Or you can scale any existing animated GIF to 16×16 in image-editing software.

Turn your GIF into an Arduino program

Before running the GIF Converter sketch in Processing, make sure you have the proper Arduino and Processing libraries installed (see Tools list above).

Run the sketch and a simple interface screen should appear. Select your animated GIF. Remember it has to be GIF file format and 16×16 pixels or the sketch won’t work properly. Also, due to memory limitations, the animated GIF cannot exceed more than 255 frames.

Next, select a name for the Arduino file to be output. The name cannot contain any special characters including spaces, and it cannot start with a number, otherwise the sketch won’t output properly.

Choose a directory to output the Arduino sketch, then press the Run button. You’ll get a message saying “File Conversion Complete” if successful.

Configure your Arduino sketch

Open the newly written Arduino sketch in the Arduino IDE.

You can adjust the GIF playback speed by changing the Metro Animate Timer value in the code. Usually 70 to 100 is a fairly normal playback speed. The smaller the number, the faster the playback.

You can also adjust the matrix.setBrightness value but do not exceed 40! These LEDs suck up a lot of power, and a 16×16 matrix displaying white at full brightness will draw up to 15 amps! Unless your matrix is plugged into the wall and is designed for up to 15A of current draw, do not go past 40 or you’ll do some serious damage. (Consult the NeoPixel Überguide for power requirements.)

Upload the Arduino sketch to the Teensy

Connect the Teensy to your computer’s USB port, then press the Upload button in Arduino.

If Teensyduino is installed correctly, it should pop up and upload the code to the Teensy.

That’s it. Your LED matrix has got its GIF on!