Maker Pro
Maker Pro

Handling current through a 74HC595

J

Jollino

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

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, the whole thing would
draw a total of about 15 A, which is pretty much impossible to handle.
Correct? 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).

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?
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?

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.

Thank you in advance, and apologies again if I sound like an airhead. :D
When it comes to these things, well... I am!
 
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

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, the whole thing would
draw a total of about 15 A, which is pretty much impossible to handle.
Correct? I will probably have to investigate charlieplexing to such a

No. 1.5A. Ten times less. It would help if you said which LED you are
using. The usual little LED that goes on a PCB can blind you at 1mA
these days....
I don't know what charlie plexing is.
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).

If you do that, you can have brightness control too.
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?

That's right. These are not "power drivers", but logic chips.
If you want to drive a hungry load, use something like the ULN2003.
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?

Yeah but just re-think your approach first. Tell us what kind of LEDs
you are using and what kind of light output you want.
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.

Traditionally, a long time ago, it was easier for chips to sink
current. They were only able to source small amounts of current.
There are entire classes of outputs with no sourcing at all, like
"open-collector" outputs.
This is why people prefer sinking. At least I do.
Thank you in advance, and apologies again if I sound like an airhead. :D
When it comes to these things, well... I am!

Your post belongs in the basics group but overall it's better than the
usual spam, politics, or trolls in here.

Just tell us what size of project you are working with here. Is it 6
feet tall and needs to be visible from across the street, or is it a
christmas card that sits on a table?
Once we have that, we'll be able to judge the current.

You don't want a Christmas card that will leave a retinal after-image
for half an hour, do you??? :)
 
S

Spehro Pefhany

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
 
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

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, the whole thing would
draw a total of about 15 A, which is pretty much impossible to handle.
Correct? 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).

96*15mA is "only" ~1.5A, and lots of modern leds will be plenty bright
with
much less than 15mA try it.
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?
yep

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?

resistor from output through a resistor to base, emitter to ground,
led and resistor
from Vcc tc to collector
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.

TTL was much better at sinking than sourcing, guess that just stuck


-Lasse
 
M

M.Randelzhofer

You can use "charlieplexing" with '595 function (not pin) compatible
TPIC6C595 or STPIC6C595
http://focus.ti.com/lit/ds/symlink/tpic6c595.pdf
or
http://www.st.com/stonline/products/literature/ds/7726/stpic6c595.pdf

with a drive capability of 100mA per pin (250mA peak).

If you want to mux only 2,4 or 6 lines use 74LVC2G79 which can drive up to
50mA per output. The second register of the '595 is not really needed for
your application.

MIKE

--
www.oho-elektronik.de
OHO-Elektronik
Michael Randelzhofer
FPGA und CPLD Mini Module
Klein aber oho !
Kontakt:
Tel: 08131 339230
[email protected]
Usst.ID: DE130097310
 
J

Jollino

No. 1.5A. Ten times less. It would help if you said which LED you are
using. The usual little LED that goes on a PCB can blind you at 1mA
these days....

My bad, I realized that shortly after posting. I guess I should get the
habit of re-reading what I write before posting. :)
I don't know what charlie plexing is.

Its correct name would be 'complementary drive'. The idea behind it is
that LEDs need a certain voltage to turn on, so you can arrange LEDs in
a matrix between several pins and there will be only one "shortest path"
that will allow the relative LED to work. Googling up "charlieplexing"
returns several articles with schematics that will explain it much
better than words.
If you do that, you can have brightness control too.

Indeed. I plan to be well below the 100 MHz limit!
That's right. These are not "power drivers", but logic chips.
If you want to drive a hungry load, use something like the ULN2003.

That makes sense. I am not sure if LEDs would be a "hungry load", though.
Yeah but just re-think your approach first. Tell us what kind of LEDs
you are using and what kind of light output you want.

I will probably be using off-the-shelf high brightness red LEDs. It
doesn't have to be perfectly readable off the street, but I do suppose
that with proper tweaking it could attract attention.
Traditionally, a long time ago, it was easier for chips to sink
current. They were only able to source small amounts of current.
There are entire classes of outputs with no sourcing at all, like
"open-collector" outputs.

Thank you very much. :)
Your post belongs in the basics group but overall it's better than the
usual spam, politics, or trolls in here.

I had planned to post it there, but I saw that this group had more
articles and I went for the 'better visibility' route... oops.
Just tell us what size of project you are working with here. Is it 6
feet tall and needs to be visible from across the street, or is it a
christmas card that sits on a table?
Once we have that, we'll be able to judge the current.

It's medium sized, I suppose. The idea is to have six letters built with
LED in a "virtual" 5x7 matrix; in other words, I'm not making full 5x7
matrix -- I am merely placing the LEDs that will be needed. All of the
letters need no more than 16 LEDs (actually one, an 'R', would have
required 18 but I simplified it to 16) so that I need two 595s to drive
each of them.
Each letter's matrix is about 4 x 7 cm big and is made with 5 mm LEDs. I
already made a specimen of the first letter ('A') with a drill on a
piece of wood, as I plan to try it out with just one first.
The goal would be having this thing hung on the outside wall, where it's
sheltered by the balcony above, or on the front door where it's also
fairly sheltered. I plan to keep the controller board on the back where
it's insulated, and protect the "naked" connections with some hot glue
or something similar. The LEDs will stick out from the holes made in the
wood, and will be connected with flying wires (there is no way I'm
making a huge PCB for this!)
You don't want a Christmas card that will leave a retinal after-image
for half an hour, do you??? :)

Now that would be a neat idea. :D
 
J

Jollino

Spehro Pefhany said:
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).

I never used Darlington arrays so I'm going to sound dumber than I have
already done, but isn't that a little overkill? Or can it just be used
as a convenient alternative to individual arrays, since each load will
only draw the current it needs and having more current available won't
hurt?

Thanks!
 
S

Spehro Pefhany

I never used Darlington arrays so I'm going to sound dumber than I have
already done, but isn't that a little overkill? Or can it just be used
as a convenient alternative to individual arrays, since each load will
only draw the current it needs and having more current available won't
hurt?

Thanks!


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
 
J

Jollino

Spehro Pefhany said:
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.

Whoa, 1K? Too many for my amateur needs. :)
I'll check at the local store tomorrow. Distrelec seems to have them for
little over one euro in DIP packaging, which is what I'd need.
ULN2003A (7-channel) is a bit cheaper per channel typically, but
doesn't match up as neatly.

Indeed, I'd better just buy a few 2803s!
 
D

David L. Jones

Jollino said:
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

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, the whole thing would
draw a total of about 15 A

96 x 15mA = 1.44A

15mA is actually a lot for a LED, you can run them at much lower current for
a roughly proportional drop in luminosity.
High efficiency LED's can be insanely bright at only several mA.

Dave.
 
D

David L. Jones

Jollino said:
I never used Darlington arrays so I'm going to sound dumber than I have
already done, but isn't that a little overkill?

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.
 
J

Jollino

David L. Jones said:
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.

I am going to use 595s because I need a bunch of LEDs (96 of them!) and
it's really better to have a line of 595s driven by a little ATtiny. ;)

I have a few high brightness LEDs somewhere. Tomorrow night after work
I'm going to look for them and try them out at something between 5 and 8
mA and see how they look. :)
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 ;-)

Yes, it's going to be a one-off project. I'd rather stay within the
limits too -- if it's decent enough, I'll reuse it next year. :D
 
Top