Little background:I'm working on a model railroad where I want to control the lights in the houses, train stations, street lights etc.

That means I need to control multiple LEDs (total number not defined as of now, but I'm thinking of no more than 64, probably 32 outputs per one micro controller) with various effects (again, not strictly defined as of now, but include fading, flashing, flickering and continuous light) that are partially random (for example, multiple independent LEDs simulating the flicker of a broken neon light). The LEDs in question are again, not defined, since they will be used for various effects, but will be small SMD LEDs, counting no more than 15 for sure, but most likely no more than 5 per single output (various colours, of course )

I guess you get the picture by now, I want a standardized device I can install on multiple locations and just use minimal reprogramming to set the effects on the outputs.The idea is to use multiple pairs of 74HC595 and ULN2803A that can be easily daisy chained (just plug another board in) and adjust the software.

Since the code I'm writing uses randomized on/off times for flickering and other effects I can not be sure how many LEDs I will need to power on at the same time, so I guess I want to make sure to be able to drive all 8 from each 74HC595 / ULN2803A pair simultaneously. The question I have is, can ULN2803A supply enough current to do it or should I go for time-division multiplexing? I'm having some trouble understanding how much can this ULN supply over each output and can it output that amount over all the pins simultaneously.

http://www.datasheetcatalog.org/datasheets/90/366828_DS.pdf

So, long story short, can you help me read the datasheet? What's the maximum safe current per each individual pin I can draw from this ULN continuously over all pins simultaneously?

You can't draw any, it's an open collector output. It only sinks current. Each "driver" inside the chip can sink a maximum of 500mA. The datasheet doesn't specify a maximum current thru the ground pin that I could see. With all drivers active, I'd keep it below 100mA per driver. With about 1V of saturation voltage, the device will get hot in a hurry if you try to sink 500mA on all 8 drivers simultaneously.

the device will get hot in a hurry if you try to sink 500mA on all 8 drivers simultaneously.

I figured that much. But how do I figure out how much can I sink safely for extended periods (several hours)? I could always hook one up and load it progressively until it releases the magic smoke, but I reckon there's a better way.

majenko

TLC5940 sounds good, but I'm worried about the drive capability of only 160 mA. If I put four or five 20 mA LEDs on each output I'm again approaching total current that may be too high.

That's because you're thinking in the wrong way.

4 LEDs, at say 2V Vf, in series would be 20mA at a Vf of 8V. Don't increase the current, increase the voltage. The TLCs can work at up to 30V - so yuo can chain quite a few LEDs off one output and still be at 20mA.

DirtBiker

It looks like the (ULN2803A) package can dissipate a maximum of about 1.8 watts total at 25C ambient (room temperature). You might be able to increase that a bit by using heavy traces on the PCB, or as heavy copper wire as you can if you are hand wiring. But if you push it to it's maximum, it will be too hot to touch.

Just a suggestion here, but I would keep the total package dissipation to below 1 watt. The spec sheet gives the Vce as around a volt if you keep the current on any given pin below 300ma and that would suggest a maximum, if load is spread out across the device, of about 1 amp total. If you limit your LED drive current to 10ma, that would suggest you could run 100 LEDs per device with no more than about 30 on a single output. For 20ma, cut those numbers in half.

As has been said , if you needed more LEDs than that you could stack them in series and use a higher drive voltage. As an example, if you re using white LEDs with a forward voltage of 3.5V and drive them with 12V you could use 3 in series with a 150 0hm resistor to drive them all at 10ma. But since you said you won't need more than 15 per output, that shouldn't be a concern.

It looks like the (ULN2803A) package can dissipate a maximum of about 1.8 watts total at 25C ambient (room temperature). You might be able to increase that a bit by using heavy traces on the PCB, or as heavy copper wire as you can if you are hand wiring. But if you push it to it's maximum, it will be too hot to touch.

Just a suggestion here, but I would keep the total package dissipation to below 1 watt. The spec sheet gives the Vce as around a volt if you keep the current on any given pin below 300ma and that would suggest a maximum, if load is spread out across the device, of about 1 amp total. If you limit your LED drive current to 10ma, that would suggest you could run 100 LEDs per device with no more than about 30 on a single output. For 20ma, cut those numbers in half.

As has been said , if you needed more LEDs than that you could stack them in series and use a higher drive voltage. As an example, if you re using white LEDs with a forward voltage of 3.5V and drive them with 12V you could use 3 in series with a 150 0hm resistor to drive them all at 10ma. But since you said you won't need more than 15 per output, that shouldn't be a concern.

I think it's safe to consider the 1.8W and 25C to be mutually exclusive unless liquid cooling is involved. I would also add that most modern LEDs shine very brightly on just less than 5mA. They last forever that way too. 25mA just leads to short lives.

Thanks guys.I see I will need to give this some thought and list all the LEDs I intend to hook up on one chip and pick the voltage that will be most suitable for majority of outputs. Since I'll have multiple of these independent devices I can set each at different voltage.

Why not use TPIC6B595 instead? That way you'll save on output pins as well (it's a shift register). It has lower voltage drop than the ULN2803A, and you can sink about 100mA per output from all 8 outputs continuously, without it overheating.

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.