Light Painting 2

This is an extension to my earlier light painting project.

My original light painting setup used images that were encoded with a separate script and pasted into the code on the Arduino. This was the simplest way that I could think to do things when I first made the project, but became limiting as my ambition increased because it’s only possible to have one or two images stored in the Arduino (they take up a lot of space) and you need to have a laptop with you to reprogram the code whenever you want to change the image.

Read Directly from the Card

The solution that I decided to use is to read the images directly off an SD card, which offers significantly more space and can be connected to a laptop to load up images whenever the image needs to be changed. My first thought was that I would need to devise a file format that matched the original encoding that I’d used and then parse that in the Arduino. I then realised that a binary format would be useful since it allows the data to be read straight from the card and sent to the LED strip. Since a great binary format for images is the humble bitmap, I decided to create some code to read bitmap images directly from the SD card and display them on the LED strip.

The advantage of this method is that you don’t need to pre-process the files before getting them ready to display, since they just need to be saved from the image editor. Furthermore, the small memory limit of most Arduinos is no longer a problem (I’d been using a Mega 2560 since it has 128K flash; most Arduinos have more like 32K flash memory available).


I bought an SD card reader on a breakout board from China via eBay. Actually I had to buy a couple because the first one was badly soldered and didn’t work at first (I reflowed the solder joints to get the excess flux out, and took the shield off to reseat a bent pin and it seems to be OK now).

For the microcontroller, I used an Arduino Leonardo (although one could use anything that’s available). I connected the SD card to the Leonardo ICSP header (the SPI pins aren’t broken out to one of the shield headers on the Leonardo) and made a little daughter board to span from the 5V connector to a couple of pins with a switch so that I could trigger the image producer. The LED strip is zip-tied to a strip of Aluminium extrusion, and the electronics are inside an old take-away container. There’s also a 1A, LM7805 5V regulator to provide power for the LEDs. A battery pack (either Lead-Acid or 6x AA rechargeables) is used to provide power and I made a little lead to connect the parts together.


The software is relatively similar to the previous version. The image data is read in pixel-by-pixel and pumped out to the LED strip. I had to massage the delays a little bit since the SPI read is quite expensive time-wise.

The current version of the code is available on github, rather than making this page enormouse.

Sample Images

The images that can be displayed are limited only by your imagination, so I’ve got a few wacky ideas. Get in touch if you’ve got an idea for a cool photo.