Controlling an RGB 5050 LED strip with Arduino and potentiometers

arduinocodeled strippotentiometer

I recently found and old amplifier with the speaker taken out of it and thought it would look nice as a light feature. The switches and potentiometers are still in place but have removed the power supply.

After finding this project from MAKE Magazine (http://makezine.com/projects/android-arduino-led-strip-lights) I was wondering instead of using an android device to control the LED strip, if I could possibly re-purpose the pots already on the amp box to control the LED's. Possibly one pot for each channel such as R G B.

Is there a way to do this? And if so, what would the code be?

Any help or tips are appreciated 🙂

Best Answer

This is doable and quite a simple task, very well suited for a beginner. You should work out the details and write the code yourself, or you won't learn anything.

Adafruit has a good tutorial on how to do the "dimming" of the individual colors. Use an n-channel MOSFET instead of a BJT. The used technique is called PWM. The Arduino software does the hard work for you, all you have to do is call the AnalogWrite function from your code. The Adafruit page has some sample code too.

Then you need to "read" the values of the potentiometers. You can use the analog pins of the Arduino and the AnalogRead function for that. Again, Adafruit has a nice tutorial, that shows how to hook it up.

Now you just have to figure out how to combine this into one script. It isn't very hard if you understand the individual parts.

You'll shortly find out that controlling R, G and B individually isn't very interesting. In general the resulting color will be hard to predict (for a human) and good looking transitions difficult to make. I suggest you treat the potentiometers as HSV input (a different color representation than RGB), it is much more natural in many aspects. Converting from HSV to RGB is a matter of a few calculation steps, but you'll find plenty of implementations on the internet (e.g. this).