Go Down

Topic: Extending LED's with their own power using the 74HC595 (Read 709 times) previous topic - next topic


Hi Arduino,

I have a question: Is it possible to feed the led's with their own power with the 74HC595 or do i need relais to do that? I have the following wiring that seems to work now. But i dont know if that is good.

I am using the following code:
Code: [Select]
const int pinLatch = 8;
const int pinClock = 12;
const int pinData = 11;
unsigned long registerState     = 0;

void setup()
// Shiftregister Pin's
pinMode(pinLatch, OUTPUT);
pinMode(pinClock, OUTPUT);
pinMode(pinData, OUTPUT);

// Initiate the Serial (COM)

writeRegister(0, HIGH);
writeRegister(1, HIGH);
writeRegister(2, HIGH);

void loop()
writeRegister(0, HIGH);
writeRegister(1, LOW);
writeRegister(2, LOW);
writeRegister(0, LOW);
writeRegister(1, HIGH);
writeRegister(2, LOW);
writeRegister(0, LOW);
writeRegister(1, LOW);
writeRegister(2, HIGH);

void writeRegister(byte pin, byte value)
bitWrite(registerState, pin, value);
digitalWrite(pinLatch, LOW);
byte shiftRegisters[3];
shiftRegisters[0] = registerState >> 0;
shiftRegisters[1] = registerState >> 8;
shiftRegisters[2] = registerState >> 16;
//shiftOut(pinData, pinClock, MSBFIRST, shiftRegisters[2]);
//shiftOut(pinData, pinClock, MSBFIRST, shiftRegisters[1]);
shiftOut(pinData, pinClock, MSBFIRST, shiftRegisters[0]);
digitalWrite(pinLatch, HIGH);


Yes that is fine so long as the resistors such that the current from each pin does not exceed what it is rated at. Also note that there is a limit on the total ammount of current drawn from all the pins. This is less than the maximum current for any one pin.
Time to look at the data sheet of your device.


Jan 13, 2013, 02:33 pm Last Edit: Jan 13, 2013, 02:43 pm by tack Reason: 1
You've commoner up on the positive rail there, but you take the positive for your IC from the +5v of the UNO and the Gnd from your batteries. The Gnd will be different between the two. E.g if your batteries are 3 x AA giving 4.5v then your UNO Gnd and battery Gnd has a PD of 0.5v.

This means that you may not be putting 5v onto that Ic as you expect. You also have the !OE pin from the UNO Gnd so there might be a PD existing internal to the IC. If you did this with two pins connected internally to Gnd (such as a uC that has two or more Vcc and Gnd pins) then you'd effectively be putting a 0.5v 'short' between the two power supplies and have current flowing that would only be dependent on the resistances in that path.

The same thing goes for your signals. You think you're providing 5v signals from the output pins, but they are actually at a lower level. If you were using a 3v supply for Red LEDs then your signals would be at 3v because of the way you've effectively wired your IC across the battery and not the UNO. You haven't got the UNO Gnd connected to the Gnd of your 595.

My choice would be to common up the Gnds and use the 595 as a current sink to switch the Cathodes of the LEDs. Obviously it will mean that setting the 595 bit low will turn the LED on, but you can easily code this inverting in.

Failing that, you need to remember that the positive is your common rail here, so your Gnd needs to be taken from the same rail when connecting a single device, and being mindful of the PD you actually want, and which levels you are making common throughout your circuit.


Have a look at the following thread regarding maximum current for 74HC595.

6mA per output.
The "typical" 20mA current for a LED is often unnecessary high. 6mA may be enough.

70mA maximum current for the chip.


Go Up