Driving 25 leds at once with micro-controller.

Thread Starter

nepdeep

Joined Sep 14, 2011
140
Hi ,

I want to drive 25 led(may be at once) with a µ-controller. The maximum current the µ-controller can source is just 400[mA]...if i limit the current of each LEDS ... i want to as well... to be 20[mA] for each LED....what is the clever method of driving all these leds 20[mA] each.....may be i can use some external LED driver or something...i tried google..most of them show transistor current driver..something other than that would be real help.
 

panic mode

Joined Oct 10, 2011
2,749
how many I/Os you want to use for this? there are LED drivers that do just that - drive LEDs and at the same time limit current to each LED so you don't need external resistors. also such chips are usually controlled serially so you only need few pins. check for example TLC5928.

you can also use standard shifters like 74hc595 etc. (require current limiting resistors for leds).

you can also do some multiplexing but this would limit current through LEDs (duty cycle).

finally, you could also try better LEDs, 20mA is pretty old these days.
 

THE_RB

Joined Feb 11, 2008
5,438
Agreed, you can get high intensity LEDs now that cause eye damage at 3mA, who needs to drive individual LEDs at 20mA?
 

Markd77

Joined Sep 7, 2009
2,806
The clever way is to have half the LEDs connected to the positive rail, half to ground because PICs can source about as much as they can sink. You just have to invert the levels in code for half.
 

panic mode

Joined Oct 10, 2011
2,749
hi Mark,

Can you please elaborate? How is that supposed to make a difference?
When all LEDs are on, they all draw current and the entire current still goes through the chip, regardless if LEDs are wired as sink or source load.It is not like current going through one LED get's to flow through another.
 

takao21203

Joined Apr 28, 2012
3,702
From a datasheet for commercial LED matrix driver I saw the difference explained.

a) multiplexed which is pretty much standard for indoors.
b) not multiplexed, high intensity which is required for instance in daylight applications.

If you multiplex, you can reduce the supply voltage and in some cases don't need any driving circuitry. Practical real world current will be 10s of mA for a small matrix all together. For instance blue LEDs at 3V don't really need resistors or drivers if they are used with a PIC.

X/Y matrix is pretty straightforward but also charlieplexed exists, which is more complex, and brightness is reduced further.

If you want high intensity and/or professional reliability at higher voltage and/or larger LED currents, you need to use LED driver ICs.

Constructiing a driving circuitry from serial buffers and digital MOSFETs is a solution however the more components, the more the chance one of them statistically will fail.

74hc595 don't need current limiting as well as they have about 150 Ohms equivalent resistance. If you use 3V effective LED current will never even reach 20mA.

I use a 5x5 (25 LEDs) matrix with 2x 74hc164 buffers.
It displays the time, and the circuit is actually used 24/7 as timer.

Power supply is done with a 78L05 from 12V.

It heats up just a little. You can see the current from that heat production.

If you wanted for instance to drive an array made from 1W LEDs, serial buffers are no longer appreciate even if they could be used to work these LEDs at lower intensity.

Prices for 1W LEDs have fallen and are in the 30 cents range now for white, so it is thinkable to produce a small matrix board from them.

How could you drive an array of these at 100mA each? One solution for instance is to use a SMPS and produce the precise voltage required for that, even to measure current through one LED.

The efforts for that are so much it is almost like using a ready-made driving IC.

For indication only, it is often possible to wire to PIC I/O directly, use low voltage, and no resistors or extra components.

However for outdoors you will need a non-multiplexed matrix.

Some circuits I constructed can work days from a 3V button cell or even from 2.4 volts, currents are some mA all together.

OP writes 400mA for a uC. This is quite high, many controllers only can tolerate 200mA or even less all together. Also 20mA for each LED is not possible with (simple) multiplex.

If you use 4 phases @ 20mA, effective current is only 5mA.

The main reason why multiplexing is done is to reduce wires, PCB tracks, and driving ICs.

OP should visit a components distributor, and look up Semiconductors, IC, LED drivers, also maybe under opto Electronics.

There will be numerous ICs offered for this purpose.

As I say for indication only, you do not need any extra components, but it has it's limitations. I have even sometimes added 2.2K for each column since I needed indication brightness only, and my LEDs are still bright with that resistance.
 

Markd77

Joined Sep 7, 2009
2,806
hi Mark,

Can you please elaborate? How is that supposed to make a difference?
When all LEDs are on, they all draw current and the entire current still goes through the chip, regardless if LEDs are wired as sink or source load.It is not like current going through one LED get's to flow through another.
The reason for the specifications "Maximum current sunk by all ports (combined)" and "Maximum current sourced by all ports (combined)" is almost certainly to stop the tiny wires that connect the chip die to the power pins from melting.
When the chip is sinking current through a load, the current flows through the Vss pin and the load; the current through the Vdd pin is tiny, about what you would expect if the chip wasn't sinking any current. The reverse is true if the chip is sourcing current so it's fine to combine the two.
Power dissipation is a separate specification and should also be considered:
Power dissipation is calculated as follows: PDIS = VDD x {IDD – ∑ IOH} + ∑ {(VDD – VOH) x IOH} + ∑(VOl x IOL).
This is due to the resistance of the output transistors, which is pretty hard to find good data on, but I think is around 25-50Ω
 

takao21203

Joined Apr 28, 2012
3,702
The reason for the specifications "Maximum current sunk by all ports (combined)" and "Maximum current sourced by all ports (combined)" is almost certainly to stop the tiny wires that connect the chip die to the power pins from melting.
When the chip is sinking current through a load, the current flows through the Vss pin and the load; the current through the Vdd pin is tiny, about what you would expect if the chip wasn't sinking any current. The reverse is true if the chip is sourcing current so it's fine to combine the two.
Power dissipation is a separate specification and should also be considered:
This is due to the resistance of the output transistors, which is pretty hard to find good data on, but I think is around 25-50Ω
As long as you don't get a significant drop in the output voltage, you don't really need to worry much about that.

Basic controllers might use a more coarse manufacturing process, while complex chips use thinner traces.

If your chips get hot you need to worry, not so if they basically remain cold.

The bonding wires are very short typically only a few mm.

Calculate for instance 1mil bonding wire, 3mm length, and 0.2 Amperes.

Larger chips even have more than one supply rail, often they read zero Ohms, but you should connect them if you run them with large currents.

The most exotic explanation I saw was this:

Bonding wires weakening from so-called electromigration. Or maybe the junction between the die or the wire and the "spider" (the metal frame). Many different methods are used for this bonding, including ultrasonic and lasers.

As far as I know it is uncommon to use different bonding wire gauge for a controller. All the same for all pins.

I made the experience what you can get out from a TQFP44 PIC is limited, if you add more stuff, the voltage goes down, resulting in brightness variation. Heat you only really get from full 5 volts. Never experienced a I/O or supply pin failing from overcurrent.

I use tiny TSSOP PIC 16f54 for 4-digit LED displays, they do that happily from full 5 volts.
 

Markd77

Joined Sep 7, 2009
2,806
You won't be able to tell if the bonding wires are in danger of melting. Because they are tiny they won't make the package warm. A drop in output voltage will largely be because of the output transistors, not the bonding wires. The same is true for the chip getting hot.
 

takao21203

Joined Apr 28, 2012
3,702
You won't be able to tell if the bonding wires are in danger of melting. Because they are tiny they won't make the package warm. A drop in output voltage will largely be because of the output transistors, not the bonding wires. The same is true for the chip getting hot.
Never saw it mentioned in literature or datasheets, only on public forums.

I don't think bonding wires are an issue they are not designed just on the margin of melting.

Think of a PIC 16f5x- if you were not supposed to use these for LED displays.

They'd be pretty much essentially useless.

I even think they have on purpose been designed for electronic calculators and LED display clocks in the late 1970s.

These were still common in the 1980s I took apart quite a few. Never saw resistors, a very few times transistors. Not PIC based guess but typically for this era.

There is a correlation between voltage, number of LEDs or displays, and heating.

If you for instance use 2x 3 digit LED displays, and use 6 phases, only one digit will be on at any time.

Someone would have to chain as many LEDs as possible on a PIC 16F, at 6 volts, and see how long it survives or if it burns out at all.

Chances are if you do not multiplex and use all ports for red LEDs at 5 volts, the PIC will heat up considerably.

I'd also bet 100 dollar it will survive a year at least. Really kind of a gamble- so, maybe you should not stretch it too much. Reasonable circuits are possible with no problems.
 

Markd77

Joined Sep 7, 2009
2,806
Yes it will probably survive. Some specifications are for a worst case of temperature, manufacturing processes, voltage, etc.
Often the PIC will survive and function correctly at higher than the maximum ratings, maybe indefinitely. Sometimes it may fail.
 

takao21203

Joined Apr 28, 2012
3,702
Yes it will probably survive. Some specifications are for a worst case of temperature, manufacturing processes, voltage, etc.
Often the PIC will survive and function correctly at higher than the maximum ratings, maybe indefinitely. Sometimes it may fail.
Again correlation between environmental temp. and survival. Think in a car it can get very hot under worst case in a hot summer in southern Europe. For instance.

I have boiled a PIC in water it worked normally after that.

I have baked PICs for 10 minutes at 220C or even more- work normally.

It is different if you have a cold room or really hot climate in an already hot enclosure.

But this will be a problem for the power supply already it will likely fail before the PIC burns out. Caps drying out as well at 80C already.

If you only use 3V there are not really large currents, and good enough for indication.
 
Top