Posts Tagged 'rgb'

Arduino Lightshow

One of the first projects I started thinking about when I got my first Arduino was an RGB LED lightshow of some kind.  Eventually my goal is to incorporate some audio spectrum analysis stuff to have a lightshow that responds to music, but we must make baby steps.

Unfortunately I didn’t take pictures as I was doing the work but here are some after-shots. The basic setup is this: two boards about four feet long with six small holes drilled and RGB LEDs inserted in. The LEDs are diffused by jelly jars painted with frosted spray paint.  This is all controlled by an Arduino using two TLC5940 PWM drivers.

The LEDs are connected to the Arduino through cat5 cables, two LEDs per cable.  All the wire-stripping was a bit tedious but what’re you gonna do.  Eventually I’d like to use some RJ45 connectors to allow the lights to be connected and disconnected easily.  I thought about using some kind of ribbon cable, but it’s so much easier to find cheap/free cat5 at the kind of lengths I’d need.

And there you have it.

Finally here’s a shot of the controller.  Initially I was using a pro mini but I learned a very important lesson about drawing too much current, destroying my first Arduino in the process.  I then switched to a Boarduino which is why it’s like overlapping one of the TCLs.  From the picture it should be obvious why I want to switch to using RJ45 connectors.

So now that I have a series of RGB LEDs  I need to figure out what pattern to use in lighting them up.  I decided sine waves were probably the way to go and came up with this pattern.  Basically there’s a sine wave for each color and each wave has a slightly different frequency.  This results in some nice rotating overlapping of colors.  The picture below shows how the colors combine differently throughout the plot.

Here’s a video demonstration of this pattern. As the video progresses the base frequency of all the sine waves slowly increases. You may also enjoy the majestic sounds of the dryer off in the distance.

I decided the project could use an interactive component as well.  I incorporated a PING))) ultrasonic sensor and used it to adjust the base frequency of the pattern above depending on the distance reported by the sensor.  At first this didn’t work well at all; the sensor was so jittery and adjusting the frequency of a sine wave at each point (even if only by a small amount) results in some pretty chaotic output.  I used Paul Badger’s digitalSmooth code to make for smoother transitions between frequencies.  In the future I think an even better way to handle it would be to quantize the jumps in frequency between say 4 discrete levels.  I had hoped that as someone approached it would slowly start to speed up, but it ended up being jumpy anyway, so might as well go for the more controlled approach of a set of discrete frequencies.  Who knows.

I’ve been working on this project on and off for a while but I had some free time during the holidays to finally get it working completely; with our New Year’s party approaching, I figured the luge would be the perfect place to mount the lightshow. My wife took this video of the lights deployed on the luge. The video struggles a bit in capturing the color changing once the lights start going fast, but you can get the general idea.

Sourcecode is on Github.