this is probably the first complete and usable device I have been able to make with an Arduino, so I am very proud of it!
Recently we have seen the explosion of bright, colored RGB LEDs everywhere. Their cost has been going down tremendously, so that now you can easily buy meters of LED chained in strips for few euros.
These strips usually come with some sort of controller which is OK for your home, or a Christmas tree, but may miss some functionalities in other contexts.
I want to use an LED strip as a complement to my VJing performances, for example, putting a strip on the front of the stage and making it flash according to the music. More concretely I want to have separate control for luminosity and for color (as in a performance you can be more interested in the amount of light than the color itself). Then I want to have some oscillators for both light and color and be able to control their speed, and I want to have luminosity and/or sound to be controlled by the music, or, more specifically, by the bass (to have lights in sync with the rythm).
It’s pretty simple to control an RGB LED strip with an Arduino and three TIP120 transistors, so I decided to build my own custom controller.
As the RGB color space does not separate color and luminosity I have adopted the HSV color space which has different dimensions for value (luminosity), hue and saturation .
The controller interface should have then:
- A pot for increasing/decreasing luminosity
- A selector for activating oscillation or music control
- A pot for controlling the oscillation speed
- A controller for the saturation value (from white to fully saturated)
- A pot for selecting the hue
- A selector for the color oscillation
- A pot for speeding up/down the oscillation
You can see how the final interface in the following picture:
For the electronics I have used an Arduino Diecimila as a controller, three TIP120 for controlling the 12V current needed to lighten the LED strip, a couple of commuters, and a bunch of linear, 10K potentiometers, with both horizontal and rotation controlled. Then, of course, a 3 meters LED strip, its particular 4 pins connector and a sufficiently powerful 12V source. For catching the sound I have used a pre-amplified mic kit form Sparkfun.
I have soldered all the components to a big protoboard, and soldered some pins to the back of the board so that you can plug it to Arduino as a shield (useful for replacing the board if needed!).
Everything is then put into a colored box, potentiometers with their caps, and some printed decorations have been glued on the box. I made the decorations with Inkscape. For making the HUE circle I have used this trick.
The code of the controller is pretty straightforward: it just needs reading some digital pins for understanding in which position the commuters are, then read the values of the potentiometers for getting the amount of saturation, hue and value, and control the oscillation.
As for the oscillation I have created three kinds: a triangular oscillation, which is nice and smooth, a square oscillation, for strobo-like effects, and a random oscillator.
There are two tricky parts in the code. One is the sound control, especially if you want to make the device reactive only to low frequencies. For this part please have a look at my previous post. The other tricky piece is the HSV to RGB conversion. Fortunately there are a lot of examples on the internet, and one specially thought for integers (much faster than float computation), though I had to slightly adapt it for Arduino has 16 bits integers and was making some errors in the calculations. You can download and use my code for free from my repository.
You can see a couple of pictures here:
And a video:
Hey. Love the custom light circuit you’ve built. I’m building a sculpture that slowly shifts hue based on sound intensity but am hung up on finding an HSV approach with non-addressable LEDs.
FastLED is new to me but I dont see any mention of being able to control non-addressable LEDs. Am i wrong?
Any tips would be appreciated, Thanks.
I haven’t sued FastLED because my LEDs were not addressable. Check the Adafruit tutorial on analog LED strips for some ideas.
My mistake, Thanks for the reply. I’m not using addressable either…was just curious about any tips on HSV code. I’ll dig through the code you’ve posted
Here are some hints, but I had to modify them a bit because integers in Arduino are only 16 bits long.
Would you be willing to share a wiring diagram?
I don’t have it ready, but it’s very simple, search for any tutorial about Arduino + RGB LED strip
Thanks for the quick reply. I already have a setup with TIP120 and led strip and understand the wiring setup for this. I was curious how you wired the linear pots and commuters into the system.
nothing really fancy, selectors were just plugged to one digital pin for each selection option, pots to analog input. Don’t forget the pulldown resistors.
Looks very interesting, reminds me these visuals https://limeartgroup.com/