Author Options:

How to control a RGB LED with a button or knob? Answered

I would like to create an led powered by batteries that can change from Green to Yellow to Red and off. 
I can use either one RGB led or 3 different leds (Reg, green and  yellow obviously)

If having a yellow light makes this more challenging, then I can change the yellow to blue. 

Do I need a controller? Can I just use wires and resisters? I would like to keep this as simple as possible to start out. 
The whole idea is to have someone be able to either turn a 4-position knob, or push a button to change the color of the LED. 

I saw another question on Instructables about this topic, but I could not find any solid answers. 
Thank you for any help you can provide. If you need me to provide more information just ask. Thanks again. 




4 years ago

You don't say you need to fad between the colours so you could use 3 switches to control the LEDS.


Will calculate the resistor value. this depends on your power supply and the forward current of the LEDs.

LED switches.jpg

4 years ago

To properly control an RGB LED's color you'll need to use a PWM signal. This pulses the 3 colors of the RBG to produce just the right color you are looking for. Once you have set the right frequency for each color channel. The easiest way would be to use 3 different LEDs in the color of your choice. Connect each LED to the correct resistor and wire each to it's own switch or through a 3 position switch. Then connect it to your power source. Use an online LED calc to figure out the correct resistor to use with each LED.