74HC595 output voltage

I am using an Arduino Uno and a 74hc595 shift register which I need to power eight relays. The relays coil needs 5 volts and is about 170 ohms. So I rigged up the 74hc595 and one relay on a bread board to test it. The relay is drawing 5.3 milli-amps and not turning on. I found that it is only being supplied with 1.83 volts. I have confirmed that pin 10 and 16 of the 74hc595, the voltage supply, do have 5v. Does anybody know what could cause this?
Thanks as usual!

595s are not designed for high-current loads.

The relay is drawing 5.3 milli-amps and not turning on.

What does the relay spec say it needs [EDIT: 5v @ 170R = ~30mA, I could have worked that out myself :)). 5.3mA would not be enough I would think. The smallest I've seen need about 20mA.

You can add a darlington array chip (ULN2803 or similar) or use a shift reg that's designed to drive loads (TLC5927 or similar).


Rob

The 74HC series standard outputs can only drive 4mA, so can't drive those relays at all. You need a high-current buffer to boost the output drive current, or to use 74LS595 instead (schottky TTL family, much higher drive) as a pin-for-pin replacement.

Darlington buffer chips like the ULN2803 will lose you over a volt, which might be an issue with 5V relays. ULN2803 also has protection diodes built in which is convenient.

[edit: actually the 74LS595 can't provide the 30mA those relays need, the ULN2803 can provide 500mA... Hopefully 4V is enough to energize them - if not you will need separate transistors to do the job (and don't forget those protection diodes).]

Yeah, the relays take around 30 mA. I was planning on using the transistor/diode setup to drive the relays anyway but I was just doing it this way to test them and because I was kind of lazy. I'm still curious why I'm only getting less than 2 volts from the output pin of the shift register though.

I'm still curious why I'm only getting less than 2 volts from the output pin of the shift register though.

The output driver on the 595 was dropping the rest of it in a vain attempt at providing ~8 times the amount of current it was designed to output.

If a source appears to be providing less voltage than expected, it generally means it is (trying to) output too much current.

Well now I just put a 1k resistor and an LED in place of the relay coil and I got 2.24 volts between the output pin of the 74hc595 and ground and 1.3 mA between the resistor and the LED. Shouldn't I be getting 5v out of the shift register?

If you weren't using protection diodes across the relay coils you will likely have damaged the 595 already... You don't mention if you had diodes.

I used an 1n4002 across the relay coil

You've already established that you were over driving the pins of the 595. It is pretty likely you have damaged it.

I just tried two brand new, right out of the package 74hc595's and they did the same thing. Only 2.24 volts at the output pin across a 1k resistor and an LED to ground.

Does your DMM have a frequency function? Are you sure the output isn't toggling?

No frequency function. Could it be a programming error? This is the code pertaining to the shift register.

const int latchPin = 8; // Pin connected to latch pin 12 (ST_CP) of 74HC595
const int clockPin = 9; // Pin connected to clock pin 11(SH_CP) of 74HC595
const int dataPin = 10; // Pin connected to Data in 14(DS) of 74HC595

void setup(){
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
}
void loop(){
digitalWrite(latchPin, LOW);
shiftOut( dataPin, clockPin, LSBFIRST, 1 );
digitalWrite(latchPin, HIGH);
}

Thanks a lot for the help so far guys. I go around to a lot of forums during my boring day at work and this is by far one of the most helpful and knowledgeable ones.

Also, I don't know if this matters or not, but this is the second shift register my Arduino is running. The other one is powering an LCD using the ShiftLCD.h library. It uses pins 2,3 and 4 while the one I'm having problems with is using pins 8,9 and 10.

goPlayYourGuitar:
No frequency function. Could it be a programming error? This is the code pertaining to the shift register.

const int latchPin = 8; // Pin connected to latch pin 12 (ST_CP) of 74HC595
const int clockPin = 9; // Pin connected to clock pin 11(SH_CP) of 74HC595
const int dataPin = 10; // Pin connected to Data in 14(DS) of 74HC595

void setup(){
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
}
void loop(){
digitalWrite(latchPin, LOW);
shiftOut( dataPin, clockPin, LSBFIRST, 1 );
digitalWrite(latchPin, HIGH);
}

Thanks a lot for the help so far guys. I go around to a lot of forums during my boring day at work and this is by far one of the most helpful and knowledgeable ones.

That loop() function is repeated resending the data to the shift register so it isn't outputing a steady state. Add a delay(1000).

5 Volts! However then I have to time subsequent button presses carefully. I lowered the delay to 150. Any lower than that and the voltage starts dropping. It's getting better though. Thanks MarkT.

Any lower than that and the voltage starts dropping.

No it's still 5v but not all the time, your meter is taking an average.

That makes sense.

All is good now. The code,
digitalWrite(latchPin, LOW);
shiftOut( dataPin, clockPin, LSBFIRST, 1 );
digitalWrite(latchPin, HIGH);
was in a switch statement in the void loop() function. So, like MarkT said, the 74hc595 output pin was constantly going low and high causing insufficient voltage. So I put the switch statement in an if statement that is triggered when a button is pressed. It now successfully turns on the relay when the button is pressed and ignores that code until another button is pressed so it doesn't keep cycling through it.

If anyone is curious the relay is a Zettler AZ822-2C-5DSE I got from Allied. I rigged it up with a 2n3904 transistor, a 1n4002 diode across the relay coil to +5v, a 1k resistor from the shift register output pin to the collector of the 2n3904 and grounded the base. The collector draws 3.5 mA and the coil draws 27.8 mA.
Thanks for everyone's help!