LED Light Painting

Description:

A project to make light paintings using an LED strip and an Arduino.  The idea for this project came mainly from the LightScythe, but the implementation is quite different!

Parts List:

Here are the major components if you would like to build your own:

All of the parts together now!

Schematic:

Here is a rough schematic for the circuit.  I used Fritzing to make the diagram, and I’m still figuring it out, so there is room for improvement!

Click for Full-Size

Code:

Warning!  This code is a mess, but if you are looking for the gist of how the firmware works, it might be interesting.

Arduino Code

Matlab Code

Functional Overview:

  1. First bitmaps are loaded onto the microSD card and the card is put into the micro SD shield.
  2. When the battery is plugged in the Arduino and the LCD Screen power on.
  3. The first button is used to cycle through the pictures.  The pictures are displayed on the LCD along with relevant info.
  4. The second button is used to write the bitmaps to the LED strip in the correct order to make the light painting.
  5. As the LEDs are written with the bitmap pixels, I walk along with the LED strip while taking a long exposure picture with my camera.

Bitmap Generation:

I use a matlab script to prepare the bitmaps, which is way overkill, but I like being able to plot the results!

First the image is resized.  Because the LED strip has 64 LEDs, any picture that is displayed needs to be 64 pixels tall.  The image can be any width.

After being resized, the picture is rotated 90°.  The reason for doing this is that bitmap data is stored line by line horizontally.  When making the light painting, however, I need to display the image line by line vertically.  Rotating the picture before hand makes this easier.

Generating 7-Bit Color:

Each of the 64 LEDs is made with a red, blue, and green LED.  The strip has built in 7-bit Pulse-Width Modulation to generate additional colors.  7 bits = 128 levels for each LED.  128^3 = 2 million colors!  Sweet!

The original LED strip I used with this project had a different chip, that only allowed each LED to have an on/off state, which meant only 8 colors.  With only 8 colors to work with, I had to get creative when down-converting full-color images.  Here’s a shot I took of the old LED strip, where I used dithering to bring the picture down to only 8 colors:

Gamma Correction:

When using PWM with LEDs, it is important to use gamma correction.  This is necessary because there is a non-linear relationship between luminescence and brightness.  Check out this app-note from Maxim-IC for more details.

Basically the color values need to be corrected with a gamma of 2.5.  Here is an image without gamma correction:

The same image with gamma correction:

As you can see, the colors are much less faded in the gamma-corrected image.

The only downside to doing gamma correction is that you can loose a lot of data at the low-end(darker pixels), but it’s usually not too noticeable.

It’s possible to have the Arduino do the gamma-correction, but it would require a lot more processing power.  I gamma-correct the images before hand on a computer to get around this.

LCD Screen:

I originally had just 2 LEDs to display the status of the Arduino, so I decided to get a little fancy and include an LCD screen.  It works much better than expected!  It shares the SPI interface with the microSD Shield, so they need to take turns.

The screen is used to display:

  • The name of the Bitmap file
  • The width of the Bitmap file in pixels
  • The amount of time it will take to write the whole image to the LED strip
  • The maximum instantaneous current that the LED strip will need to display the picture.
  • The current battery level.
  • A preview of the picture.

Writing text and pictures to the screen was easy using the Adafruit tutorial and library.

Note: I store a non-gamma-corrected image on the microSD card as well as the gamma-corrected version.  This is so that I can display the non-gamma-corrected version to the LCD and the gamma-corrected version to the LED strip without having to do any gamma correction calculations in the Arduino.

More Pictures!

Space Invaders Ahhh!

Creative Commons License
Scott-Bot.com by Scott-Bot is licensed under a Creative Commons Attribution 4.0 International License.



8 Comments

  1. [...] Another user who became interested in light painting, but through the LightScythe, continued the evolution of this art form with the development of a more elegant system. He utilized a MicroSD to store bitmap images, so no receivers or laptop required out in the field. This user also outfitted an LCD screen to his box, which displays battery life, how wide the Bitmap is, and how long it will take to display the entire thing. In order to prep the bitmaps, he used a matlab script to plot everything out. For the non-programmers, there are other light stick DIY projects that use spreadsheets to plot out images. The board and code used in this version were all Arduino. [...]

  2. [...] Another user who became interested in light painting, but through the LightScythe, continued the evolution of this art form with the development of a more elegant system. He utilized a MicroSD to store bitmap images, so no receivers or laptop required out in the field. This user also outfitted an LCD screen to his box, which displays battery life, how wide the Bitmap is, and how long it will take to display the entire thing. In order to prep the bitmaps, he used a matlab script to plot everything out. For the non-programmers, there are other light stick DIY projects that use spreadsheets to plot out images. The board and code used in this version were all Arduino. [...]

  3. [...] Another user who became interested in light painting, but through the LightScythe, continued the evolution of this art form with the development of a more elegant system. He utilized a MicroSD to store bitmap images, so no receivers or laptop required out in the field. This user also outfitted an LCD screen to his box, which displays battery life, how wide the Bitmap is, and how long it will take to display the entire thing. In order to prep the bitmaps, he used a matlab script to plot everything out. For the non-programmers, there are other light stick DIY projects that use spreadsheets to plot out images. The board and code used in this version were all Arduino. [...]

  4. [...] Another user who became interested in light painting, but through the LightScythe, continued the evolution of this art form with the development of a more elegant system. He utilized a MicroSD to store bitmap images, so no receivers or laptop required out in the field. This user also outfitted an LCD screen to his box, which displays battery life, how wide the Bitmap is, and how long it will take to display the entire thing. In order to prep the bitmaps, he used a matlab script to plot everything out. For the non-programmers, there are other light stick DIY projects that use spreadsheets to plot out images. The board and code used in this version were all Arduino. [...]

  5. [...] Scott Bot developed a similar system that light paints full colour bitmaps: Scott Bot [...]

  6. [...] Another user who became interested in light painting, but through the LightScythe, continued the evolution of this art form with the development of a more elegant system. He utilized a MicroSD to store bitmap images, so no receivers or laptop required out in the field. This user also outfitted an LCD screen to his box, which displays battery life, how wide the Bitmap is, and how long it will take to display the entire thing. In order to prep the bitmaps, he used a matlab script to plot everything out. For the non-programmers, there are other light stick DIY projects that use spreadsheets to plot out images. The board and code used in this version were all Arduino. [...]

  7. [...] Another user who became meddlesome in light painting, though by a LightScythe, continued a expansion of this art form with a growth of a some-more superb system. He employed a MicroSD to store bitmap images, so no receivers or laptop compulsory out in a field. This user also given an LCD shade to his box, that displays battery life, how far-reaching a Bitmap is, and how prolonged it will take to arrangement a whole thing. In sequence to prep a bitmaps, he used a matlab book to tract all out. For a non-programmers, there are other light hang DIY projects that use spreadsheets to tract out images. The house and formula used in this chronicle were all Arduino. [...]

  8. […] Pixelstick is not unique — other artists have experimented with LED strips and Arduino before — but it makes the process more simple for […]