Introduction: 40x RGB LED Controller With 8-bit PWM and Selectable Patterns

About: Designing electronic creations from microcontrollers, LEDs and anything else I can pull out of a dumpster and make use of. Check my Profile


UPDATE: This controller has been replaced with the vastly superior 48 Channel Mono / 16 Channel RGB LED Controller, with USB Connection and ColorMotion Compatibility. Visit http://www.chromationsystems.com/48channled.html for details, links and to Purchase

A relativity simple driver I have designed for use in Infinity Mirrors, Case Mods and anything that could use some color.

Controls 40x Common Cathode RGB LEDs in 8 channels with 8-bit PWM, 16 million color combinations.

Five groups with 8 independently controlled RGB LEDs each, are arranged end to end (square or a loop) and together with seamless patterns it appears that all 40 of the LEDs are controlled by themselves.

Driver measures 2.5" x 3.5" x >1"

Kits including PCB+ all component parts and 40x 5mm RGB LED can be purchased in my store at www.ChromationSystems.com

or a Developer Package with all the files needed to recreate this project can be Found Here

Add a suitable PSU and matching panel mount barrel jack to your Order

The PCB for this project is easy for a moderately skilled solderer, wiring the light bars is confusing, be sure you know what needs to be done and can understand directions before attempting this project.

It is set up for 5 volts Input at 1.2 Amp ( Safe Estimate ). But there is a spot for a 7805 if the input current must be more than 6 volts. Not recommended as most 7805s can't handle enough current for all 40 RGB LEDs.

Complete Info is Found in The Datasheet

Kits with everything needed to recreate the Infinity Mirror Below can be purchased here.


Step 1: Layout the Parts

UPDATE: This controller has been replaced with the vastly superior 48 Channel Mono / 16 Channel RGB LED Controller, with USB Connection and ColorMotion Compatibility. Visit http://www.chromationsystems.com/48channled.html for details, links and to Purchase

Full kits with Controller, RGB LEDs, Wire Can Be Purchased
or a Download Package with the Eagle Files, PCB layout and HEX File Can Be Purchased.

Controller Parts List: 
- PCB, Eagle Files and PCB Layout
- Programmed 16F870 or get the HEX File
- 28 pin socket
- 3x 18 Pin Socket
- 2x TD62783APG, source driver
- 1x TD62083APG, sink driver
- 2x 10k 1/4w resistor
- 1x 20 mhz Series Oscillator
- 1x 2 pin Housing
- 1x 2 pin Header
- 4x 20 ohm 1 watt resistor
- 4x 16 ohm 1 watt resistor
- 4x 75 ohm 1 watt resistor
- 2x 10 uF capacitor
- 2x 1 uF capacitor
- 1x 5 pin terminal
- 1x 4 pin terminal
- 3x 3 pin terminal
- 1x 2 pin terminal
- Wire, 22ga dual strand works good, amount depends on how long your light bars are.

RGB LED bars:
- PCB or Perforated board to mount RGB LEDs onto, perf-board should be 3 holes wide.
- 40x 5mm RGB LED, common cathode (kit includes a few extra)

Tools:
- Soldering Iron
- Solder
- Wire Cutters
- Wire Strippers

Optional:
- Volt Meter

Step 2: Resistors & Jumper


- Start with placing the 10k ohm resistors (Brown - Black - Orange - Gold ) R1 & R2

- Placing all of the 1 watt resistors ( R3 - R14 ) can be a bit confusing but follow the diagram and take your time. They are arranged with seemingly no order, but it works out easier for the terminal blocks.

With a piece of solid-strand wire jump JC1 to JC2

-  IC3 will come jumped on a purchased PCB as it is not used.

 - Otherwise jump the two outer holes( 1 & 3) with some solid strand wire, and fill in hole "2"'s solder pad with some solder.

*If the input voltage needs to be more than 5 volts, a 7805 could be placed in as pictured.
Just make sure to mind how much power it will be dissipating.

JA1&JA2 and JB1&JB2, and header "POT" are unused and can be ignored

Step 3: Oscillator, Sockets and Capacitors


Oscillator:
- Oscillator has no polarity and can be placed in however.

Sockets:
- Note the top-side illustration and align the notch on the socket with the notch on the illustration.

- Align the sockets with the holes and check to make sure all the pins line up with their hole before pressing it in firmly. From the copper side, check to make sure no pins got squashed under the socket. Then solder all the pins, being careful not to create and solder bridges to adjacent pins.

Capacitors:
Capacitors are electrolytic and have polarity. Thus they must be placed correctly.

Power Header:
This is a polarizing header ( fits in only one way ) so think about how you will want it.

Step 4: Terminals & Button


Terminals:

- Place them where they fit. Make sure the opening is facing outward

Button:

- Measure the amount of wire you will need for your button. Usually 4"-6".

- Place the button as near to the center of the perf-board as it can be. A drop of hot glue helps out.

- From the back. fold the leads over and clip them shorter.

- Solder the wire to each of the leads.

- Solder the other ends of the wire into the holes labeled "SW"

Step 5: Preparing a RGB LED Bar


Depending on what you will be using your controller for will vary the size of RGB LED light bars you will need.  I find it easiest to use a strip of perf-board for this. Its cheap and works great.

For shipping reasons your strips may have to be cut into parts. Just lay them end to end, and glue if desired.

I will be building one for a 16"x16" Infinity Mirror. So I am starting with a 16" long piece of perf-board. I marked where the LEDs are going to go. They must line up with holesof the Inner walls of the Infinity Mirror later, so they have to be evenly spaced. The spacing on perf-board is a convenient 0.1" per hole. So 10 holes is 1".

Begin: Review all the images before starting. A Helping-Hand type device really helps here.

*Notes: All the RGB LEDs have a flat side on the case. All the the LEDs have to be orientated the same for the R-G-B pins to line up. Choose one side of your perf-board and face all of the LED's flat side to it. 
*Be Patient this can take a long time, but the end product is worth it.

- Lay down a piece of your perf-board and mark with a sharpie where each LED will go, Make them evenly spaced.

- Grab an RGB LED and holding it close to the top fold over the ground lead to a 90deg. angle.
- Then grab the Gnd Lead after the first bend, and bend straight down, parallel to the rest of the     pins.
- Grab another RGB LED and once again bend the Gnd lead to a 90deg, but do it in the opposite direction that you did on the first. So the R-G-B pins will line up with the first LED's. Then bend it parallel to the other three pins.
- Place the LED into its place, each pair should have their GND leads facing outward.

*Each pair should be Grouped like in the image below.

- Once you have a pair of LEDs, fold their R-G-B pins inward towards each other and solder.
- Adjust the leads so they do not touch. Later a drop of hot glue will keep them separated.
- Fold the GND leads flat to the board. They will be cut later.

And repeat till you have 5 pairs, and that's 1 bar.

3 more to go.  Repeat.



Step 6: Wiring a RGB LED Bar


This can be a bit confusing. A lot of wire is going to ran. I don't know quite how to describe this, but the overall idea is simple, each Group#'s R-G-B pins are in parallel, and then connected to correct terminal on the PCB.

And each LED GND pin is connected with the other GND pins of the same LED#.

Example: All the red pins in Group 1 are connected (in parallel) and attached to Terminal "Color 0". All LED's labled #1 have their GND(cathode) pins in parallel and attached to Terminal "GND 1"

The best way to do this is to make 2 halves, with 2 light bars per half. Then each half will have wires going into the controller. (each terminal will have 2 wires in it)
This is tedious so be patient.

Here are a list of tips, not so much step-by-step directions. Make two of these.

- Look over the 5th image in the gallery below, its the schematic of how to wire these, it only shows 1 group's worth of wires, but the rest of the groups are wired the same, just to their own LEDs and terminal.

- Place it in your third-hand or equivalent holder.

- Pick an end to be the end where the controller will be.

You'll be soldering a wire to every Group#'s Red, Green, & Blue leads, and also a wire to every LED's GND pin

- I prefer to use dual strand(which can be purchased with the kit) and run two GND pins per strand and use separate wires for the Colors(R-G-B) and GND.
   *It saves wire to offset cut the dual strand wire so it  can reach. See Images
   *Solder the wire to its LED first then measure and cut to length.

- Leave about 3" of extra wire hanging that will attach to the controller.

- Strip an 1/8" of insulation off the wire and solder it to its LED Lead.

- Cut the wire to length and then clip the extra GND leads on the LEDs down.

- It helps to label the wires with some masking tape and a pen.


Step 7: Wiring Part 2


Now with two wired light bars that each have enough wire to go to the controller later. And the remaining 2 RGB light bars.

This is where you attach one of the un-wired light bars to one of the wired ones. So when its finished you'll have two halves of a square(or what ever shape you are making) made up of two light bars each, one with wires for the controller the other is soldered to the other.

This method uses less wire and makes less of a rats-nest than running each light bar(side) to the controller with its own wires.

This step is similar to the last but instead of leaving extra wire for the controller, the wire will get soldered to its respective Group Color and GND#. Use the images below, and some images & tips from the last step.


Step 8: Test the Light Bar and Controller


After very carefully looking over the controller for solder bridges, dull solder joints and loose wires.

- Take your programmed PIC and carefully plug it into its socket. The notch in the socket goes on the same end as the white dot on the micro controller.

- Take the IC TD62083APG and carefully place it in its socket, label "SINK" on the top-side illustration. Again, line the dot up with  the notch.

- Last two IC's are the TD62783APGs. They go in the sockets labeled "SOURCE". Line the notch up with the dot.


Attach the Lightbar:

- Connect all the wires to their proper screw-down terminals and secure.

- When placing the wires into the terminals, make sure that bare wire doesn't hang out that could touch the wires surrounding it.

- If you do not want to hook up all the LEDs right away(for testing purposes). A resistor (100 - 500) could be placed in series with each GND terminal, which will allow the LEDs to not receive to much current.

*** Before continuing, the controller expects all 40 LEDs to be hooked up, and delivers enough current for them. If all the LEDs are not hooked up, the others will be get over-current and it might damage or destroy the LEDs. (I have done it and not damaged anything though)

Plug the 2-pin power header into your power supply, minding the polarity. If you purchased the kit you will need to attach crimps and a housing to your input power supply's wires. To do this follow a This Short Tutorial on Crimping

Check over everything once again and apply some power.

Step 9: Completed


That should be it. If all the LEDs are working then you did good. Use the button to flip through the different modes.

If some LEDs are the wrong color at the wrong time then a wire has been crossed somewhere or the LED was placed in wrong relative the the others. (flat sides all face one way)
Also, once and a while a LED is made out-of-specification and may steal all the current from the other LEDs in its Group Color or GND#, (which won't light up or will be lit dimly) that LED will have to be found and replaced. Extra LEDs are included in the kit, just in case.

Find something to stuff all the LEDs into and Enjoy.

Please send pics of your final result.


Subscribe or Look out for my Future Projects

- 32 LED Infinity Mirror with Driver, Build a store-quality Infinity Mirror from a kit. Like This but with a controller and glass mirrors.

- 9 watt LED Full Color Wash Light with DMX-512 and Sound Reactivity. Similar To This

- 8 Channel LED Driver, for Infinity Mirrors and Mods