Re: Handling current through a 74HC595

Nov 02, 2008 2 Replies


Hello,


>apologies if this question is very stupid. :)
>I have been toying with electronics for a little while, but I know I
>lack some basic knowledge to wrap everything up together so... here is
>my doubt.
>
>I am designing some Christmas decoration with a bunch of LEDs driven by
>an array of 74HC595s (controlled by an ATtiny45). The whole thing will be

...you kinda trailed off here..



>I did something similar in the past, using three 595s to control three
>7-segment LED displays, but I did it fairly randomly: I just connected
>each output to each segment, with a resistor between the two.
>Since this thing I'm planning to do is going to be simple yet much
>bigger -- involving twelve 595s -- I'd like to do things properly.
>The 96 LEDs could and probably will be all on at some point, so
>considering a current draw of 15 mA for each LED,

Typically there's a limit of something like 70mA total, so you can't get more than about half that and stay within the absolute maximum specs. In practice you could probably push it for something junky like an Xmas decoration, maybe to 15mA or even 20mA average since it doesn't have to work for long, or in extreme environments, and maybe all the LEDs on a single HC595 won't be on for very long-- but this is a calculated risk since you're sauntering past the most severe kind of warning in the data sheet-- the electronic equivalent of a "lethal force authorized" sign in the desert.


the whole thing would
>draw a total of about 15 A, which is pretty much impossible to handle.
>Correct?

Well, that's a fairly large power supply, but you do need that amount of current if you want to have 15mA average through ~100 LEDs. Layout would require some care (!). You can get a 5V 1.5A or 2A switching wall plug supply pretty cheaply these days.


I will probably have to investigate charlieplexing to such a
>big scale, or maybe make it so the 595s are working one by one at a fast
>rate (by pushing a series of logic zeros down the data line).

There's no free lunch. Your average current will go down and the LEDs will appear dimmer if you have less than ~1.5A. If you can live with


1mA/LED you can just use higher value resistors. If you used Charlieplexing for the entire array you'd not be able to get more than a couple hundred microamps average per LED, which is not going to give much light except with the best (and most expensive) LEDs. In any case, note that you cannot independently float outputs on a HC595.
In any case, let's assume for the sake of the example that I want to be
>able to drive eight LEDs with a single 595. The datasheet tells me that
>the maximum current load on each output pin is 35 mA, and the current
>load on the supply pins (Vcc and ground) is 70 mA. I am not sure how to
>interpret this: does it mean that the sum of the output currents can't
>be more than 70 mA?

Sort of. If you are driving some current in both directions, the sum of the absolute value of the currents could be higher.


If that is the case, I suppose that I could use transistors. Would
>connecting each output to the base of an NPN and the LED (with a series
>resistor) between Vcc and the emitter work?

Sure. Although something like a ULN2803 per HC595 would be a lot easier. And it would ease layout (but you'd still have to be a bit careful with the high current paths).


Also, I'd like to finally understand whether it's better to source
>current from a pin or sink current into a pin. I would think that
>sourcing is "cleaner" because one doesn't "overdo" the chip -- if the
>current is not enough, it simply doesn't work -- but I'm not sure about
>that at all, because on many schematics I have seen LEDs sinking into
>MCUs' ports.

Typically CMOS outputs sink current quite a bit better (ie. lower voltage drop) than source so that's how we usually do it. The circuit is the mirror image in either case-- an LED in series with a transistor across the supply-- so the difference are 2nd order (the n-channel transistors work a bit better than the p-channel kind).


Thank you in advance, and apologies again if I sound like an airhead. :D
>When it comes to these things, well... I am!

Best regards, Spehro Pefhany


"it\'s the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

Yes.

About 2 cents per driver in 1K. Not overkill. Good for about 50mA per channel (SMT package) if you allow all 8 to to be on at the same time.

ULN2003A (7-channel) is a bit cheaper per channel typically, but doesn't match up as neatly.

Best regards, Spehro Pefhany

"it\'s the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

Yes it is for a Christmas decoration. Just use suitable high efficiency LED's and run them at less than say 5mA each. Drive them direct with your 595's or micro.

Also, if this is just a one-off and not destined for production then you can exceed the limites on those 595's a tad ;-)

Dave.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required