Continue to Site

# Led driver circuit solution

Status
Not open for further replies.

#### Murugesh_89

##### Full Member level 5
Hi,
What value of R1,R2 should be placed in order to get a current through the LED to be 80mA.
The output voltage of microcontroller output pin will be between 4.5 - 5 V.

Can any one please tell me how to calculate it?

Murugesh

sure.

set R1 to 1kohm
set R2 to 22ohm

yugiraj

### yugiraj

Points: 2
thanks.. can you please tell me how to calculate this?

yugiraj

### yugiraj

Points: 2
one way is to look at the path : I/O pin -- R1 -- Vbe -- R2 -- LED -- GND

Assume that current through LED is 80mA
then voltage drop across LED is 1.6v (typical for red LED. use different value for other led's)
Vbe ~ 0.7v
drop across R1 = 80mA/110 * R1, where 110 is the minimum beta for bc547
drop across R2 = 80mA * R2

so we get I/O voltage = 5v = 80ma/110 * R1 + 0.7 + 80mA * R2 + 1.6

or R1 + 110R2 = 2.7v /0.73mA = 3.7Kohm

Then i simply chose R1 to be 1K ( seems like a reasonable value)
and then we get R2 ~24 ohms. So a standard value close to this is 22 ohms

However if the BC547 beta is higher, then the current will also be higher by some proportion

Points: 2

### Murugesh_89

Points: 2
thanks again.

I used the value you provided. The current values and the exact setup I have given here. Now what should I do to get the 80mA across LED?

Is there any other way to do this?

That's a completely different circuit!

Firstly, you will never get 80mA across a LED, current flows through components, not across it.
Secondly, whatever current flows through the LED has to flow into the 74138 and that causes you two problems: 1, the output of the 74138 will not go to zero volts when low and 2, the 74138 will fry!

Please tell us exactly what you want to achieve so we can advise you on the best strategy.

Brian.

Murugesh_89

### Murugesh_89

Points: 2
I am using 8 tricolor LED's in a PCB which obviously require 24 I/O pins. But i connect it as
a. All the anodes 1 of each LED are connected to one I/o pin
b. All the anodes 2 of each LED are connected to another I/o pin
c. All the anodes 3 of each LED are connected to another I/o pin
d. Channel 0 of decoder connected to cathode of Led 1 and so on as channel 7 of decoder connected to cathode of led 8

Hence i require only 6 I/O's as 3 for anodes and 3 for decoder channel select.

I enable an led for 800us and then switched off it, then the next led and so on.

But on doing this, i can not able to get the complete brightness of LED. LED looks some what dull.

What can i do so that i can get the full brightness of LED?

Your schemaic isn't the solution, this is why:

The anode voltage can't be taken to a higher voltage than the microcontroller pin voltage - voltage dropped in the resistor - Vbe of the transistor. Asuming you are using a 5V supply, the pin will be say 4.5V, Vbe will be 0.6V and the voltage dropped in the resistor will be Ib *1K which you state is 0.1V so the anaode can't go higher than about (4.5 - 0.1 - 0.6) = 3.8V.

The cathode current has to flow through the logic gate output - the 74138 has been out of production for many years so I'm guessing you have a 74LS138 which has a maximum sink current of only 8mA. When running at 8mA, the output voltage will be in the region of 0.8V so the total voltage you can possibly get to drive the LED is 3V, and that's assuming the LS138 didn't die first.

Lets suppose the LS138 didn't die, the 3V is shared between the LED itself and the series resistor, 2.01V is lost in the LED so the remaining 0.99V is across the 22 Ohm resistor so the current can't be more than 45mA.

You need to get much higher current through the LED, especially as it is only on for a short time. In fact to some degree you can overdrive the LED because it has a cooling off period between your 800uS pulses although you haven't mentioned it's actual duty cycle.

The way to do it is the use a PNP transistor to drive the anodes. Connect it's emitter to 5V and it's collector to the LEDs, you will have to invert the drive signal from the microprocessor or the LEDs will be on when they should be off. Driving the anodes this way will not lose the 0.6V in the transistors B-E junction and when the micro pin is low, it will saturate the transistor, makng it an almost short circuit. Then do the opposite in the cathode side, connect an NPN transistor with it's emitter to ground and drive the base from the LS138 through a resistor. The collector goes throught the LED current limiting resistor to the LED anode. Now when the LED is switched on, it will have almost full 5V available to it and the current will only be limited by it's series resistor. Again the signal will have to be inverted so you may need to use something like a 74LS04 or another transistor to do this. If you use a 74LS04 you can use it's 6 inverters, one to each of your six signals.

So instead of a limit of 3V/45mA to the LED, you now have almost 5V (you have lost 2 x VCEsat in the transistors) and a series resistor of (5 - LEDVf) /0.08 ~36 Ohms will give you the 80mA you want. As a little overdriving is acceptable, I would suggest 33 Ohms giving a current of about 90mA.

Brian.

Points: 2

### Murugesh_89

Points: 2
Two suggestions:

First, in your original schematic move the LED and R2 to the collector circuit instead of the emitter circuit. The emitter goes directly to ground. This way the output of the microcontroller chip does not have to overcome the Voltage drops of the LED and R2 and the additional chip when it turns the transistor on. This is a more common way to drive a load (LED).

Second, add some nor gates between the microcontroller outs and the transistor inputs. You will need one for each LED color or 24 nor gates. Your three color outs from the micro will each go to In 1 of eight of the nors. The other three micro outs are decoded with the 74138 and then these eight decoded outs each go to three of the nors In 2. You will have to make the outs of the micro Active Low.

The value given above for R2 is a bit off with this new setup.

R2 = (5 - LED Vd)V / 0.080A

R2 = (5 - 2) / 0.080

R2 = 37.5 Ohms

This should give you the full 80 ma current in the LEDs.

The 1K value for R1 should work OK. In fact, it could be a bit higher. It is calculated from the Hi level output of the nor gates to provide enough drive current to turn the transistors on.

R1 = 4.5V / (0.08A / transistor Hfe)

R1 = 4.5 V / (0.08 / 100)

R1 = 4.5 / 0.0008

R1 = 5625 Ohms

I would probably use 2.7K

You could probably find a better combination of chips to provide the wired logic needed to decode the three outputs. I leave that research to you.

Paul A.

Murugesh_89

### Murugesh_89

Points: 2
Thanks much brian.

Instead of going for an additional inverter, i planned to use 74hc237 decoder and the new design have attached here. Will this work as expected???

That's pretty much what I described and it should work fine.
You still have to invert the signal from the microprocessor but you might be able to do that in software.

Brian.

yes brian i have planned to do that in the software. Thanks much, it helped me lot.

One more question.
The life of some lights depends on how many times the light has been switched on and off.
Here i am refreshing the led on for 800 us and off for 350 us. So the continuous ON and OFF will have any adverse effect on its led life?

It shouldn't. The LED has almost infinite life when turned off and very slowly degrades when it's turned on. The actual process of turning them on and off should not make them deteriorate so the life expectancy is the total of only the 'on' periods. Most LEDs working like that should survive for several tens of years or more.

Brian.

Murugesh_89

Points: 2