Light Painting with an Arduino and RGB LED light strip

Light painting is an easy and fun activity to do with friends and any camera that has shutter speed control.  After playing around with this a few times, I wanted to take it to the next level, and stumbled upon someone’s very informational post.  It became my goal to make this happen, as cheaply and simply as possible of course.  Being in possession of an Arduino Uno, I just had to acquire a few more components and write up some easy code (with the help of some libraries) to be able to make a picture like this:

Megaman light painting

The circuit is pretty simple.  All the complexity is taken care of within the Arduino Uno and the digital addressable RGB LED waterproof flexi strip (no PWM, 1 meter for $35 from Adafruit).  Other than that, I just used a couple diodes to drop the voltage from a 6V SLA battery to what I needed to power both the Arduino and the LED strip.  To store images, I used an SD card shield from Seeed Studio Bazaar ($14) on the Arduino.

Light wand components

With some cheap parts, I finished the construction.  I used rubber bands to bind the LED strip to a 1×2 piece of wood and used a cardboard box to house the Arduino and battery.  This obviously could be made much more high quality and permanent, but I just wanted a quick cheap build and wanted to be able to reuse parts later for other projects.

Light strip wired up

Buttons, switches, and knobs are always fun.  I bored holes in the cardboard box at just the right size, and these components fit nice and snugly.

Light strip box buttons

Here’s what it all looked like inside the box.  Again, a very temporary setup, but it worked fine for what I knew would be something I’d only use for a little while.

Light strip box under the hood

I created a quick utility to convert images to simple binary, so that the Arduino could use it quickly.  For each pixel, each color (R, G, and B) was approximated to be completely on or off (1 or 0).  It worked well for images that had bold colors that are close to red, green, blue, cyan, magenta, yellow, and white (the colors the LED strip is capable of making).  I did it in C# using the built-in image processing, but if I’d known Python at the time, I would have used Python.

Adafruit links downloads to libraries that work with the LED strips they sell.  With these libraries, it is sickeningly easy to do whatever you want to do, even if it’s just creating fun color patterns that run up and down the strip.  Here’s what my Arduino code ended up looking like.  loop() and lightpaint() are the functions of interest.  Basically, it reads a row of pixels from the SD card, then flashes that row quickly.  Then it moves to the next row and repeats.  Here’s a (low quality) video of it working.  All I have to do is put my camera on a tripod, set it to do a long exposure, hit the button so that the rows flash on the LED strip one after the other, then hold the LED strip vertically and move it across the shot smoothly so that the pixels get drawn by the LEDs across the image.

Here are some of the images I was able to create.

Digital light painting Boo

Advertisements

2 thoughts on “Light Painting with an Arduino and RGB LED light strip

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s