16-channel LED driver for simple ON/OFF control with Arduino

Hi,

I have read many articles about PWM LED drivers and Arduino. The thing is that I do not need PWM dimming. I need to selectively turn on or off one, several or all of 16 LEDs. I also have only one PWM pin left on arduino (for example TLC5940 requires 3 PWM pins to function). What solution would you recommend? Preferably with existing library and tutorial :) Thanks

PCA9685PW is an I2C type of device that will drive up to 16 leds. The same device can be used for servos and h-bridge motor controls.

MCP23017 is another I2C that can give you 16 digital I/Os

Or just use 2 daisychained shift registers with SPI pins.

digitalWrite (latchPin, LOW);
SPI.transfer(bits0to7);
SPI.transfer(bits8to150;
digitalWrite (latchPin, HIGH);

Can be 74HC595, TPIC6C595, TPIC6B595 - how much current do the LEDs need?
Don’t forget current limit resistors.
That’s the nice thing about the PWM controllable chips, they control current and generally only1 resistor is needed.
Example, WS2803. You do have to send more data out, 16 bytes vs 2 bytes.

WS2803-preliminary-En.pdf (437 KB)

And these 'I2C' chips.. only take 1 pin/wire to control?

"I" was under the impression that all I2C chips required 2 pins? (SDA)/(SCL)

no?

If the one PWM requirement no longer is an issue.. maybe look at the MAX72xx chips? (which I think requires 3 pins)

(control 64 leds with each chip.. chain-able as well)..

CrossRoads: Or just use 2 daisychained shift registers with SPI pins.

digitalWrite (latchPin, LOW);
SPI.transfer(bits0to7);
SPI.transfer(bits8to150;
digitalWrite (latchPin, HIGH);

Can be 74HC595, TPIC6C595, TPIC6B595 - how much current do the LEDs need?

Thanks for the tip Found this one: STP16C596

What is SPI.transfer() function in your code?

pavelkh:
What is SPI.transfer() function in your code?

Ok. Found the library SPI - never used it before.
This is explanation: Arduino - SPI
I use UNO. According to the library description page SPI communication requires pins 10 - 13. I do not have this pins available.

In this picture however pins 2,3,4 are used. (STP16C596 Shift Register – code, circuits, & construction)

Anyway - just found that STP16C596 is obsolete. What is replacement for it?

Nasa: MCP23017 is another I2C that can give you 16 digital I/Os

This is a good one. Thanks a lot. Found a tutorial for this chip and arduino: link

The problem with I2C - I already have ADC on I2C :(

pavelkh: The problem with I2C - I already have ADC on I2C :(

So what is the problem. I2C is a bus. Many devices can be connected to it, as long as they all use a different address. Leo..

got it - thanks

Hi,
What is the application for your UNO that has taken all your I/O pins?
If we know what you are trying to accomplish we may be able to suggest some short cuts.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Can you please post a copy of your sketch, using code tags?
They are made with the </> icon in the reply Menu.
See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

Thanks, the more information we have the more accurate and relevant answers we can supply.
Tom… :slight_smile:

TomGeorge:
What is the application for your UNO that has taken all your I/O pins?
If we know what you are trying to accomplish we may be able to suggest some short cuts.

What’s this? Are you invoking the XY problem?