Introduction: RGB LED Strip Controller

About: I'm programmer and an electronics hobbyist. I try to find that point where software meets hardware meets art. "Necessity is the mother of all creation, but laziness is the father." "The best way…




This is a remote-controlled multicolour LED-Strip controller box I made for a friend. We planned to install subtle lighting inside his car for which we got a tiny controller box + remote with the multicolour LED Strips. Unluckily, we couldn't open the door panels for wiring and had to take aid from professionals. While installing the strips, they probably shorted something (they did really shabby wiring) and all the magic smoke from controller box escaped. The lack of any protection circuitry in the controller box didn't help much.

So we were left with a functional but useless remote and LED strips directly connected to power, and so limited to being manually-wired to one of the 6 basic colours(red, green, blue, yellow, cyan and magenta). So it was time to make a better pimped-up RGB LED Strip controller box!

This was finished and installed 2 days before the Indian festival of lights: Diwali. Christmas is also round the bend and this could be put to use for christmas tree lighting. Christmas carol synched lighting anyone?

Here is a video of it in action. I forgot to show the clap-on function. Maybe a smaller video later... The amplifier gain sensitivity for audio is turned down so only the strong bass beats are picked up. Amplifier gain can also be turned up to even pick up normal human voice.



This Instructable is divided into four parts: design explanations(steps 1-4), building circuit(steps 5-7), building enclosure(steps 8-10), car installation(steps 11-13)

Step 1: Extra Features

I've added an amplifier so I could mix the lighting with audio playing in the car. The circuit uses my previous project ArrDrownHo! for powering the IC, easily uploading software upgrades and providing real-time serial data for fine tuning the amplifier gain. Here's the not-so-complete list of features:

• Set colours(as in original). Extra: each colour button has 5 layers of different colours which are programmable. So instead of 15 colours, we have 15x5 = 75 colours. Red, Green and Blue components of a colour can be set using knobs and then saved in one of 75 colour slots.
• Set flashing and smooth fading colour effects(as in original). Extra: 5 different layers for both flash and fade effects. Each effect layer can store 15 colours which are programmable and are selected from the group of 75 pre-saved colours.
• Adjust brightness/effect speed(as in original). Extra: Beside adjusting using remote buttons, knobs can be used to get precise brightness/speed instead of jumping forward or backward in huge chunks.
• Has an extra music effect which alters brightness of current colour/effect according to loudness of music. 5 layers are available in which colour during silence can be changed(usually best left to black).
• Ability to save settings. 5 layers of programmable settings. Each layer will store value for brightness, effect speed and audio sensitivity which can be recalled and applied instantly. The values of first layer will be applied whenever system is freshly started.
• Clap activated switch on function. The clap command is a 3-clap combination so LEDs do not light up accidentally due to loud music.
• Master Reset function. Set all the saved colours, effects and settings to default.
• Slow fade from black to previously selected colour when switched on. Whenever power is re-connected, the colour saved in 3rd row, 2nd column, 3rd layer of remote is selected by default.

Step 2: Stuff Required

  1. ArrDrownHo!                           x 1
  2. ATmega168/ATmega328     x 1
  3. TL072 (amplifier IC)              x 1
  4. 100K resistor                          x 5
  5. 150K resistor                          x 3
  6. 33K resistor                            x 3
  7. 20K trim potentiometer         x 1
  8. 0.1uF ceramic capacitor       x 4
  9. 10uF electrolytic capacitor    x 1
  10. 100uF electrolytic capacitor x 2
  11. IR sensor                                x 1
  12. Electret microphone             x 1
  13. TIP120                                    x 3
  14. LED 3mm                              x 1
  15. IC holder 24 pins                 x 1
  16. IC holder 8 pins                   x 1
  17. Push button                         x 1
  18. JST connector                     x 1
  19. Male header pins
  20. Female header pins

Additional:
  • LED Strip
  • RGB Remote
  • Acrylic
  • Various tools(soldering iron, pliers, wire cutters etc.)
  • Heat shrink

Step 3: Decoding the Remote Control

I followed ladyada's IR tutorial and got the signal timings for each button. Signal duration for Brightness Increase(B+ [0][0]) buttons is:

ON, OFF
  1. 882, 438
  2. 56, 52
  3. 56, 52
  4. 56, 52
  5. 56, 52
  6. 56, 52
  7. 56, 52
  8. 56, 52
  9. 56, 52
  10. 56, 162
  11. 56, 162
  12. 56, 162
  13. 56, 162
  14. 56, 52
  15. 56, 162
  16. 56, 162
  17. 56, 162
  18. 56, 52
  19. 56, 52
  20. 56, 52
  21. 56, 52
  22. 56, 52
  23. 56, 52
  24. 56, 52
  25. 56, 52
  26. 56, 162
  27. 56, 162
  28. 56, 162
  29. 56, 162
  30. 56, 162
  31. 56, 162
  32. 56, 162
  33. 56, 162
  34. 56, 4010
  35. 882, 218

There was no space for saving timings for 24 buttons on the AVR, so had to find a pattern in the signals. After a lot of experimentation, I managed to decode the signal encoding pattern for the remote. Since this is pretty generic, chances are your RGB remote might have the same signals. If not, you will need to modify readIR() and decodeIR() functions in code.

To decode the signals, I noticed that only values at position 18-22 and 26-30 are changing for different buttons. Also, the values in range 18-22 are always the same as 26-30. So reading any one range is enough. I chose to read both and compare to be 100% sure. The individual values in the range are either near 52 or 164. So I assumed time signal in vicinity of 52 as 0 and 164 as 1. Then decoded their values in binary. I've treated the buttons as 6x4 matrix and named the buttons accordingly from [0][0] (top left) to [5][3](bottom right).
Button position [0][0] B+ [0][1] B- [0][2] OFF [0][3]ON [1][0] – R [1][1] – G [1][2] – B [1][3] – W [2][0] [2][1] [2][2] [2][3] [3][0] [3][1] [3][2] [3][3] [4][0] [4][1] [4][2] [4][3] [5][0] [5][1] [5][2] [5][3]
Timing position 18 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Timing position 19 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
Timing position 20 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
Timing position 21 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
Timing position 22 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
Decoded Decimal Value 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

Note: To improve speed, I hard coded the time duration values in code. Also, I used interrupt-based IR signal reading so other functions, like fade effect, can function in parallel and I get maximum speed.

Step 4: Circuit Explained

For picking up and processing audio signals from an electret microphone, it has to be amplified first. A very neat explanation of amplifier working can be found in this Instructable by amandaghassaei. I'm using a slightly modified version of her circuit by using a single power source instead of double. The values for capacitors and resistors were selected after a bit of trial-and-error. The output is centered about 2.5V by R2-R3 voltage divider and fed into AVR's analog input pin.

For controlling intensity of each colour channel, PWM is used. The LED strip needs a lot more current than AVR can provide, so TIP120 transistor is used to control power to each of the 3 colour channels. Follow the excellent tutorial by ladyada for more information. C8 and C7 are added as close to the connector as possible to lessen load on power source due to power draw by LEDs during PWM switching.

The PCB board design file has two unrouted air-wires. One is for VCC and other is GND. Do not worry, these two are connected through the ArrDrwonHo! board which will be connected to this PCB later.

Step 5: Fabricate That PCB

Time to make the PCB. Download the Eagle files, print, iron-on transfer, etch and drill. If you don't know how to fabricate a PCB, there are plenty of good instructables out there to get you started.

In my excitement, I forgot to take a picture of the silkscreen I did with toner-transfer. Only after all the component for amplifier were soldered and I had tested the amplifier section to satisfaction, did I realize my mistake. Enjoy the half covered view of silkscreen.

I will put up the files later as I messed up the collector and emitter gates in the transistors and had to cut traces in the PCB to fix it. Will fix it up and upload it as soon as possible. 

Edit: Uploaded the corrected schematics and board files.

Step 6: ArrDrownHo! Headers

To let the ArrDrownHo! to be removable(in case AVR needs to be removed), I have added female headers beside the IC holder. The pins of the headers are connected to the adjacent IC pins in the PCB design. ArrDrownHo! easily snaps in and sits confortably atop the AVR IC.

Finish soldering the rest of the components. Last image shows the ArrDrownHo! inserted along with amplifier IC and AVR.

Step 7: Finished: PCB Fabrication and Soldering

Connecting potentiometers(pots):
I do not have close-ups of this connection so I'll try to explain in detail. Connect first pin of all 3 potentiometers together (I used black wire). Then connect the third pin of all pots together (I used white wire).
Now solder 5 wire ribbon cable to the holes in PCB for pots The 5 wire connections are: 5V, GND, wiper for pot1, wiper for pot2 and wiper for pot3. Connect the wire for pot vipers to the middle pin of respective pots. Also select any 1 pot and solder the GND wire to the first pin and 5V to the third pin.

Solder ribbon cable for connection to LED Strip. The pin-out is 12V, Green, Red, Blue(unluckily, the ribbon cable colours do not match). Attach a standard LED strip connector at the end. Cover joint with heat shrink. You're done!

Upload the arduino code to an ATMega168 or ATmega328P IC and insert it into the IC holder. You can make a simple Tic-Tac USBtinyISP programmer to program it.

Now time to test the circuit. Set ArrDrownHo! to use 5V regulator and supply 12 volts to it and the PCB (through JST connector). Plug in LED Strip to the connector and switch on using remote. It's alive!!!

Step 8: Making the Enclosure Top

My original plan consisted of using an old tiny plastic lunch box I used for storing parts as enclosure. But my friend wanted something classier and we decided to go with clear acrylic enclosure. I found cutting acrylic the most difficult task. I used a hacksaw initially but soon gave that up and moved to scoring and snapping. I scored the acrylic about 50 times each side with the notch at the back side of a cutter blade. Much easier but with 50% chances of messing up. Either the break wasn't clean, the acrylic cracked or I would put a deep scratch while scoring. In the end I managed somehow after wasting and re-using the wasted acrylic.

I created a basic design in MS-paint for what I had in mind. The dimensions got altered by a few mm but was mostly true to the design. The acrylic used was about 2mm thick. The thickness of acrylic plays significant role in selecting dimensions.
First, cut a rectangle of acrylic of dimensions 20.4cm x 5.5cm. This was bent 5.7cm from both ends to form a U-shaped piece. Then drill 3 holes for the potentiometers.
Then cut 2 pieces of dimension 9cm x 5.3cm for the sides. Round off 2 lengthwise adjacent corners so it fits with the curve of our bent acrylic. One thing I overlooked was to drill holes for push button, DC jack and microphone beforehand. Do that before attaching sides. Use any super-glue, acrylic glue, araldite to attach them and hold them in place for curing with vise(or rubber bands like me :).

Attach the peripherals with connectors to the enclosure top:
An electret microphone with wires soldered to a 2-pin male header is glued to a hole drilled on the enclosure side.
Another wire pair is soldered to 2-pin male header and passed through 2 of the 4 holes drilled for push button. A push button is soldered to these wires, it's leads pushed through the 4 holes, and glued to the box's outside.
Take a DC jack. Solder a JST connector and 2-pin male header connector in parallel to it. Glue DC jack from the inside to hole drilled in one of the sides.
All the 2 pin male connector connections were covered with heat-shrink.

Step 9: Making the Enclosure Base

The base is a rectangle of acrylic of dimensions 9cm x 5.5cm. To attach the PCB, nuts were glued to the top of 4 small squares of acrylic with holes drilled in them. These were glued to the base, matching the location of holes in the PCB.

To attach the base to the top part of the enclosure, two small squares of acrylic were cut and holes drilled in them. One had a hole just big enough to let the bolt through while the other's was big enough to fit the nut inside it. The two pieces were glued together and the nut glued in the bigger hole. 4 such squares with nut inside were made and glued vertically standing near the corners with a slight offset.

Also, 4 holes were drilled in the base so the enclosure could be screwed to the car's side panel.

Step 10: Finished: Assembling Controller Box

To assemble, the top part of enclosure is put on top of the base and holes drilled in the sides aligned with the vertical nut holds. File a notch in the enclosure’s top part’s side so the LED Strip ribbon connector can come out.

Attach the PCB to base with screws. Attach potentiometers to enclosure top, tighten with nuts and add knobs.
Connect the power connectors to ArrDrownHo! and JST socket, the microphone and button connectors to their respective female headers.
Note: While connecting power to ArrDrownHo!, make sure of the orientation as shown in image notes. I later added a white stripe to both male and female header's 12V side to mark the orientaion.

Screw the base to the top and you're done!

Read on to see how it can be installed in a car...

Step 11: Prepare LED Strips

Plan out where you want the strips to go. We wanted it to be placed discreetly so the LED strip is not visible, but the diffused light is. We placed it in the area under front panel where our feet rest, below the front seats, below the rear seats, inside the space in side door for putting stuff, around back side of the perimeter of the bass tube and small pockets in the sides of the back.

Measure out the strips needed for all these locations. Measure twice, cut once!
Solder wires to one end of these LED strips. Cover the joint with heat-shrink.

Step 12: Installing LED Strip

The most challenging part was installing LED strip in the side door panels. The images show how we went about installing them. This was repeated for all 4 front and back side door panels. The wiring was hidden and connections brought to the panel near the foot pedals.

Step 13: Finished: Car Installation

This looks great in car but can be used other places as well. Christamas tree can be adorned with it or for mood lighting your room.

There was some noise in amplifier circuit whenever the car engine was started. Maybe the microphone's picking up engine noise(being so close to the engine) or RF interference. Need to investigate more. It's working perfectly with engine switched off but power on.

Microcontroller Contest

Second Prize in the
Microcontroller Contest

Make It Glow Contest

Second Prize in the
Make It Glow Contest