One Challenge with working with RGB LEDs is getting the right Red, Green and Blue values to match a color you are trying to display. You can start with web colors, and then sometimes need to adjust them since the LEDs don’t look quite the same as they do on monitors.
So, this is a quick project to allow you to set the RGB values with a simple hand-held gadget – maybe useful when working offline with these LEDs.
This project shows a WS2812b digitally addressable LED, but could be adapted for other LED types.
- An Arduino – clones can be found for $10
- An Adafruit LCD Shield – this shield has a 16×2 LED display, and 5 push buttons that we will use for changing the red, green, and blue color values. Adafruit also has a shield where the backlight color is an RGB LED – might be worth trying!
- An LED – this one uses a single WS2812b LED from a 30 LED/meter strip of LEDs – we had this left over from another project. Adafruit sells them individually on carrier boards too.
- Some solid core wire – I used some 20 gauge wire since it was rigid and held the LED nicely.
Step 1: Construction
Build the LED Shield per the instructions that come with it (online). Test it our with your Arduino.
Now, we will solder the LED to the board. Since the LCD Shield is intended to be on the top of the stack of shields, the pins are not brought out in header sockets. But the pins are there to mechanically support the shield, so you can carefully solder wires to the tops of those pins. See the pictures for details.
We will solder digital pin 6 to the data in line – that has to be connected to the input end of the arrow on the LED since they have a direction on the data line. The other two wires are the +5v, and Gnd – those can be soldered on either end of the LED.
The LED is very bright, so one idea is to put a piece of white paper over it. Or perhaps aim it down and run it over a white surface.
Step 2: Code
- Down Button: reduce the selected color (R, G, or B) by the current step size
- Up Button: increase the selected color (R, G, or B) by the current step size
- Left Button: move to the previous color
- Right button: move to the next color
- Select button: toggle the step size from 1 to 5 to 10 to 20 to 50, then back to 1…
The code uses the Adafruit LCD Shield and Neopixel libraries. The sample code is below.
You could also add a connector and power a full string with this approach.
Read more: RGB LED Color Selector / Picker / Chooser