~40 RGB LEDs - too complicated?

chigley

Senior Member
Would it be above my level if I wanted to make a project which involved around 40 RGB LEDs, all of which need to be individually controlled? I've been having a read (http://www.picaxeforum.co.uk/showthread.php?t=9747), and it appears that 3 PICAXE output pins are required per LED.

Is there some way of doing it that doesn't involve multiple 40-pin PICAXEs to drive the LEDs?
 

Andrew Cowan

Senior Member
Option one:
One pin for the red cathodes
One pin for the green cathodes
One pin for the blue cathodes
One pin for each LED's's anode

That means 43 pins. Multiplexing would be needed, so a bit complex.

The other main option is using an output expander to control them via serial of I2C.

I'm sure Maxim do a LED driver chip which someone will reccomend - however, I have not experience with such a chip.

Do you need fully analogue control, so are discreet colours good enough (red, green, blue, red+blue, red+green etc)?

A
 
Last edited:

hippy

Ex-Staff (retired)
The best way would be to use dedicated IC's which have been designed for the task. For example the PCA9635 ( 16 channel, 12-bit PWM with I2C control ) and I am sure there are others.
 

chigley

Senior Member
Do you need fully analogue control, so are discreet colours good enough (red, green, blue, red+blue, red+green etc)?
Full control would not be required, the LEDs would need to be individually settable to 6 discrete colours (or off completely)

The best way would be to use dedicated IC's which have been designed for the task. For example the PCA9635 ( 16 channel, 12-bit PWM with I2C control ) and I am sure there are others.
Will have a look at that IC thanks. I thought there might be one, but didn't find any after a bit of searching.
 

Pfrogs

Member
If you don't require full colour control, then you could simple use logic gates like the 74HC logic ICs. It would only require 8 ICs (eg. 74HC374) to independently control each colour (on/off) of each RGB led (40RGB leds x 3 colours = 120 pins / 16pins of 74HC374 = ~8 ICs) with a single picaxe (eg. 8M). And these ICs are pretty cheap (~£0.2-0.5).
And if you wish, you can control the overall brigthness using the PWM output of Picaxe connected to a MOSFET and the common RGB anode/cathode.

If you go for full colour control, then multiplexing with a dedicated led driver IC would be a better option. Have a look at TLC5940 (16-channel, 12-bit PWM control and dot correction with a 120 mA output in each pin).
 

chigley

Senior Member
Could someone explain, in simpleman's terms, how the wiring of the LEDs are wired in combination with the PCA9635? I've read the datasheet a good few times, but still don't understand how the LED wiring works.

On page 23 there's a typical application diagram (figure 16.)

There appear to be 4 repetitions of the same 'block' on the right-hand side, but I don't really understand it, nor can I find any other reference to the output connections in the text.
 

hippy

Ex-Staff (retired)
It depends on what type of RGB LED's you are using but the simplest wiring would be as per the LED connected to LED0 on page 23; common anodes to +V, each of the RGB cathodes via an R to a LEDx output pin. If you need higher current or higher anode voltages the cathode would need to be switched by a transistor.

There may a way to use common cathode RGB LED's but I didn't read the datasheet in any detail.
 

chigley

Senior Member
It depends on what type of RGB LED's you are using but the simplest wiring would be as per the LED connected to LED0 on page 23; common anodes to +V, each of the RGB cathodes via an R to a LEDx output pin. If you need higher current or higher anode voltages the cathode would need to be switched by a transistor.

There may a way to use common cathode RGB LED's but I didn't read the datasheet in any detail.
I think I'll just order the IC and have a play on a breadboard when it arrives. Will let you know how I get on :)
 

westaust55

Moderator
Would it be above my level if I wanted to make a project which involved around 40 RGB LEDs, all of which need to be individually controlled? I've been having a read (http://www.picaxeforum.co.uk/showthread.php?t=9747), and it appears that 3 PICAXE output pins are required per LED.

Is there some way of doing it that doesn't involve multiple 40-pin PICAXEs to drive the LEDs?
I posted a project I constructed for 64 RGB LED's being controlled via two MCP23017 i2c 16-bit IO Expander chips and multiplexing.
A search of my old threads should find the details and code.
Does need a clock speed around 16MHz or better to avoid flicker.
 

Dippy

Moderator
I wish I'd seen that PCA9635 before embarking on an RGB driver. Obv, and to keep it simple, you would need 10 of those for 40 RGBs.

I did mine directly from PIC . 4 separate (R+G+B+W) PWM Channels plus 4 muliplex outputs.
Doing home-brew is dogged with speed problems. This could give 4 or 16 Channels depending.
I used a PIC @ 20MHz and each channel ran at about 200 Hz with 256 levels for each R, G , B and White level. (I later found that 100 levels per colour was easily enough for a good spread).
My only complication was an extra serial input for remote control but the principle is the same.
Nice chip.
 
Could someone explain, in simpleman's terms, how the wiring of the LEDs are wired in combination with the PCA9635? I've read the datasheet a good few times, but still don't understand how the LED wiring works.

On page 23 there's a typical application diagram (figure 16.)

There appear to be 4 repetitions of the same 'block' on the right-hand side, but I don't really understand it, nor can I find any other reference to the output connections in the text.
The Led wiring is a common anode configuration, with Led0-Led15 sinking current from the individual Leds, if that is what you want to accomplish. I think that chip can source current, although to a much lower value.

Figure 16 just shows how you can mix and match different source voltages, led strings, and drive transistors, nothing more.

Once you get the chip initialized correctly, writing to the pwm registers should be fairly easy.
 
Top