Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Please comment on my LED driver.

Status
Not open for further replies.
Mike,
Why did you change my circuit so that it is not a constant current sink (with an emitter resistor)?
You show it as a simple common-emitter transistor as a switch so of course it needs a series base resistor.

If you have an input that goes up to 3.3V then the emitter voltage goes up to about 2.6V and if you want 16mA then the emitter resistor value is 162.5 ohms. Use 160 ohms for 16.25mA.

But it is not a constant current sink if its supply voltage is too low. The transistor must not be allowed to saturate because then the circuit is not a constant current sink and the base current increases dramatically.
 
Last edited:
Hello again,


Oh ok, so the PIC output pin goes 0v to 3.3v but the power supply Vcc is at +5v. That's a little different than having 5v for both.

I think i see what you are trying to do now audioguru, i think you are trying to make a constant current source for the LED. That is interesting, but im not sure how good it would work out in practice with all the other possible variations. Maybe you should look at that too.

However, there is a much simpler implementation that can be used here anyway. Since the LED always drops at least some voltage even when it is drawing a very small current (LED curve) all we have to do is force it to draw at least some current at all times and we can drive it with a port zero '0' (low output) rather than a port one '1' (high).
To achieve this, we connect a 100 ohm resistor in series with the LED, and a 10k ohm resistor in parallel with the port pin. The 10k resistor goes from the port pin to ground however, while the LED and resistor go from Vcc (+5v) to the port pin. In this way the port pin is always shunted by 10k so the LED always conducts at least some current. The idea is to get the LED to be out or very dim with the 10k resistor, so this might mean raising it's value to 20k or maybe even as high as 100k. The limits are: we can not go too low on this value or the LED will look a little lit up even when it is supposed to be out, and we can not go too high on this value or the port pin might see more than the max input allowed (less than about 4v with a 3.3v supply).
With the 100 ohm resistor and a range of green LED voltages, the LED current would range from about 12ma to about 20ma, or the 100 ohm resistor could be dropped to get that range from around 15ma to 23ma which should be good enough.

This solution only requires two resistors and does not require any transistors (plus the LED of course).

Drawing...
 

Attachments

  • LED_PortDrive-01.gif
    LED_PortDrive-01.gif
    5.3 KB · Views: 220
Last edited:
Sorry.
I was thinking about another thread where the OP wanted to adjust the LED current by changing the base voltage of a constant-current transistor driver.
 
Hi MrAl and Audioguro.

MrAl,
This MCU pin cannot sink nor source large current of more than 4mA, therefore I cannot use that method.

I don't see why Mike's circuit won't work well for variations of the BJT and the LED's VF.
Could you explain why won't it work please?

I'm referring to this circuit:
df47-png.45008


When you set RE to 62ohm, you get I(LED) = 20mA.
 
Last edited:
Hi MrAl and Audioguro.

MrAl,
This MCU pin cannot sink nor source large current of more than 4mA, therefore I cannot use that method.

I don't see why Mike's circuit won't work well for variations of the BJT and the LED's VF.
Could you explain why won't it work please?

I'm referring to this circuit:
df47-png.45008


When you set RE to 62ohm, you get I(LED) = 20mA.


Hi again,


Oh ok too bad. Well, you could double check to see if the LED looks bright enough with 4ma i guess if you feel like it. Otherwise the circuit you have posted looks like it should work ok. You may end up raising the resistor to 75 ohms though. Try it out.
 
Last edited:
Since the supply is only 5V and the LED is 3.3V then Mike's circuit with the emitter resistor will not work. When the transistor saturates its emitter voltage will try to be 2.6V but it can't because there is not enough supply voltage.

Instead, use the transistor as a common-emitter switch with its emitter grounded and a current-limiting resistor in series with its base and another current-limiting resistor in series with the LED.
 
Since the supply is only 5V and the LED is 3.3V then Mike's circuit with the emitter resistor will not work. When the transistor saturates its emitter voltage will try to be 2.6V but it can't because there is not enough supply voltage.

Instead, use the transistor as a common-emitter switch with its emitter grounded and a current-limiting resistor in series with its base and another current-limiting resistor in series with the LED.

NO! Look at the comparison between "Mike's" and "Audioguru's" circuit I posted 7 posts ago. Note the Current through the LED and the current that has to be supplied by the Port Pin!
 
NO! Look at the comparison between "Mike's" and "Audioguru's" circuit I posted 7 posts ago. Note the Current through the LED and the current that has to be supplied by the Port Pin!
If the LED current is 16mA then the base current supplied by the 3.3V port pin needs to be only 1.6mA. So what is the problem?
 
If the LED current is 16mA then the base current supplied by the 3.3V port pin needs to be only 1.6mA. So what is the problem?


All other things (resistor dissipation, transistor dissipation, Led Current) being almost equal, Mike's circuit draws only 245uA from the Port pin. If the external LED supply voltage increases beyond ~6V, Mike's circuit automatically keeps the LED current constant. Not a problem, just better.
 
Status
Not open for further replies.

Latest threads

Back
Top