Go Down

Topic: Analog RGB Strip color picker and more (Read 2323 times) previous topic - next topic


Sep 22, 2013, 01:32 am Last Edit: Sep 23, 2013, 03:22 pm by mdifilippo Reason: 1
Alright, so I am starting a new project that will eventually get installed in my car. What I hope to have once it is all done;
an arduino that controls a 5050 analog RGB led strip with the following options;
0) on\off button
1) a potentiometer (or digital encoder if needed) that when turned will control the color of the LEDS (one potentiometer though, not 3)
2) push a button and turn on/off leds change brightness based off of sound (color of LEDS stays constant to that picked from #1)
3) push a button and turn on/off leds change brightness AND COLOR based off of sound

I know next to nothing when it comes to arduino programming so this should be interested and I will really be relying on you guys a lot. I so far have my LED strip setup based off of this tutorial and have gotten the example code to work perfectly to fade the colors.

So now my next question is, how can i use a single potentiometer to pick the color of the LED strip, I have seen it done using 3 one for each color but I would love to do it with just one.

I will do this step by step and then I assume, combine all those steps into one final sketch that will execute what I laid out above. Any help is greatly appreciated guys.


Just found this!
Awesome, so I have some pretty nice control of the color now but I have no white (or r,g,b all at 255) is there anyway to add this in to the code? Also anyway to get MORE gradieting ? 


Personally, I would avoid potentiometers as far as possible.  You will note that modern equipment no longer uses them by and large as they tend to have problems with reliability and wear and tear (and in particular, noise when used as a volume control).

Not that that would be a major problem in your application, but rotary encoders are far more effective in digital systems.  For one thing, they provide digital inputs to what is after all, a digital system (though you do have to arrange de-bouncing).

They are available quite cheap (on eBay of course) and those have a push switch incorporated, usually to provide menu traversal and selection.  In your situation, this could be used for mode selection so that successive presses switch between chroma selection, saturation selection, and brightness.  You might need an extra (RGB?) LED to indicate which mode is current if you are using no other display (but you may wish to complicate matters later, and want a LCD display.

In the case of the chroma mode, continuous rotation (in either direction) can repeatedly cycle through different colours in sequence, but if you wish finer resolution, you can require more than one turn for a complete cycle (as you could do also for each of the other two modes).  So unlike the potentiometer, a rotary encoder facilitates as fine a detail as you ever want.


Thanks Paul, I am totally open to use an encoder instead, I wasn't sure which would be the better option. I could see a pushbutton encoder simplifying the setup greatly by using it instead of the individual buttons.


So now with using a digital encoder here is the new roadmap I made up.

Press the encoder in once: turn system on, last picked color appears
Turn digital encoder to pick color
Push the encoder again: goes into sound activation mode via an onboard electret mic. The color of the LEDs is that picked from previous selection
Turning the digital encoder at this point would change the color
Push the encoder once again; goes into sound activation mode via onboard electret mic where the color changes as it goes with the music
Turning the digital encoder at this point would do nothing
Push the encoder the last time and the system turns off

I want one encoder to pick the color with, at one end of the encoder I want red, and on the opposite pure white (or all LEDS on).

So with all this in mind where do I get started? The code for the encoder to pick color I believe I have found, but what I am struggling to locate is the second option, to have the sound activate control just ONE color. Any help with code is hugely appreciated


Go Up