Introduction: RGB LED Controller
This is an entry in the
Epilog Challenge 9
10 days before Christmas I still needed a present for my Husband, who lives in the age of Amazon, which means purchasing something of the shelf was not an option.
He needed a light for his office and he likes to change things up every now and then. His desk is also conveniently placed in front of a window sill. So controllable RGB lighting came to my mind immediately. It had to be bright enough to illuminate his desk and he had to be in control of the color.
I present, the RGB LED Controller.
(See Video below)
Step 1: Parts:
I used the following parts:
1x Sparkfun Pro Micro 5V/16MHz (https://www.sparkfun.com/products/12640 )
I looked up Arduinos first, but just before Christmas everything was sold out of course. The Sparkfun turned out to be just as good and the instructions on their website make it very easy to use the Arduino programming software. To make it fit onto the Protoboard I had to put pins into the Pin holes. It worked best to solder them on while they were plugged into the ProtoBoard with the Micro controller in place.
2x 1m 60LEDs/m Sealed RGB LED strips (https://www.sparkfun.com/products/12023 )
Not to expensive and bright enough to illuminate the Desk with 14W/m
1x Protoboard (https://www.sparkfun.com/products/9567 )
Because of the 2 days I had to test, debug and assemble the whole thing I used a Protoboard. It holds onto the wires tight enough and I can move connections around easily. Also the current of 2-3A for the two LED strips I am using is not to high.
3x Power MOSFETs (https://www.digikey.com/products/en?keywords=IRF84...
They had to be able to handle quite a bit of current, and these can do just that with over 3A/Unit at 12V D/S and 5V switching voltage. I know they are overkill, but I wanted to play it safe.
3x 100mm slider Potentiometers 10k (https://www.digikey.com/products/en?keywords=987-1...
I know I could have used regular potentiometers, but big sliders are just so much more satisfying to use.
1x Switch (https://www.digikey.com/product-detail/en/zf-elect...
To turn the whole thing On and Off.
1x 12V 3A Power supply (https://www.amazon.com/ANVISION-2-Pack-Adapter-5-5...
The 2 LED Strips will need max 2.4A on full brightness. The Arduino needs almost nothing, so a 3A Supply I found to be enough.
1x Barrel Receptor (https://www.digikey.com/products/en?keywords=%09EJ...
So we can plug our power supply into the controller we need this little guy. I prefer to connectorize things that come in from the outside, because I find devices that have a bunch of wires dangling on them not very convenient.
2x Pairs of CPC Connectors
Chassis Mounts (https://www.mouser.com/productdetail/te-connectivi...
Other things: Some 20-24AWG wire in various colors, a small regular potentiometer I had in my drawer for brightness control, an interrupt button, 4x 5kOhm resistors and 3x 5V LEDs with integrated resistors.
Step 2: Printed Parts
For an enclosure I designed one in Fusion 360.
I needed the main Enclosure for all the electronics and some knobs for the Potentiometers. Since I did not know yet where this thing will be mounted only two sides may be accessible.
We have 1/4" holes on the top for the LEDs, the Interrupt button and the brightness control Potentiometer (5 Total).
On the Left side I have a large cutout for the Switch, a small cutout for a micro USB cable, so the Arduino can be reprogrammed without having to take the controller appart, 2 holes for Female 4Pin CPC Receptacle connectors and and 8mm hole for the Barrel Jack.
On the Front there are just the 3 slits for the Potentiometer handles and holes for 4-40 screws.
I printed the Knobs on a raft and in a group, which always leads to better results on FDM printers for small objects. The Enclosure I printed on the back panel standing for minimal support.
The Baseplate screws into the Enclosure. I didn't have flat head screws so I had to stick felt squares to the bottom of the enclosure so it does not rest on these screws and scratches the table.
Step 3: Wiring
First I Soldered long wires to all the parts I needed (Potentiometers, Barrel Jack, Buttons, Switches etc.) so I didn't have to do that in the enclosure. Then I assembled the electronics on a bench to test the different functions and troubleshoot any software or wiring bugs. I found that connecting the MOSFET Gate to the 8Bit PWM on the Arduino leads to stepping in color changes and no smooth operation. Using the 10 (Pins 5,6) and 16 bit (Pin 9) PWMs instead leads to fades as smooth as butter (I'm still writing only 8bit to the PWM Pins though).
(See the wiring Diagram for what is connected to what)
Step 4: Assembling
After I tested the wiring I assembled everything inside of the enclosure. The fact that I soldered as much as possible outside of the enclosure helped a lot, as well as preassembling the connectors.
I found that pliers are very helpful to get the wires into the right holes on the Protoboard. I cut the wires to length just before I plugged them in, so everything is as clean as it can be.
Finally I screwed on the Base plate and attached some felt pieces to it, so it rests nicely on the table.
Step 5: Programming
The Sparkfun gets programmed via the Arduino software (See for instructions: https://www.sparkfun.com/products/12640 )
The Program includes the EEPROM library to save the last operating mode, so the controller does not loose the state it is in when cycling power to it.
The additional Potentiometer on top regulates Brightness in all modes without affecting the displayed color.
There are 3 Modes, hence the 3 Status LEDs on top.
Mode 1: RGB Mode (only 1 Status LED is on)
The 3 Potentiometers control the brightness of Red,Green and Blue individually. A steady color is displayed.
Mode2: RGB Fade Mode (2 Status LEDs are on)
In this mode all three colors are on a Clock (Red on 12, Green on 4 and Blue on 8 for example). The Hand of the clock rotates clockwise and a mix of all three colors depending on it's position is displayed.
The first Potentiometer controls fading speed (Speed of the Hand)
The second Potentiometer determins which Color is at 12 o'clock. (Rotates the Clock)
The third Potentiometer determins how far the Clock Hand rotates before it turns back.
This mode let's you fade between any two colors on the Clock.
Mode 3: RGB Dispersion (All 3 Status LEDs are on)
In this mode each color has it's own clock and each Potentiometer controls the speed of one handle.
Potentiometer 1 Controls Red, potentiometer 2 controls Green and potentiometer 3 controls Blue.
This way a seemingly random color pattern is displayed due to the long time before it repeats. (My favorite mode)
We have a be nice policy.
Please be positive and constructive.