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.

Challenge of the day : Dual color LED

Status
Not open for further replies.

TechnoGilles

New Member
Hi all,

I have an application where I use a dual color LED with only two terminals. When polarized one way, the LED is green; when polarized the other way, it's red.

So I thought I would use two MCU ports (say P[1:0]) and connect the LED through a current limiting resistor. So when P[1:0] = 10, the LED would be green and when P[1:0] = 01, the LED would be red.

The nominal current for both sides is 20mA. But the problem is that the forward voltage is different : 2.2V for the green side and 2.0V for the red side. So, as you might have guessed by now, choosing the resistor value becomes the challenge !!

At 2.0V, the green side current drops to 5mA (4 times less bright). At 2.2V, the red side current jumps to more than 50mA and the LED blows !!!

So how can I setup that LED to get 20mA in both direction ?

Needless to say that I would like to achieve that with as few parts as possible !

Thanks !
TG
 
With a load of 20mA, the output of one MCU port might be 4.0V and the voltage of the other port might be 1.0V for a total voltage of 3.0V. Then the resistor for the red LED is (3.0V - 2.0V)/20mA= 50 ohms. The green current is (3.0V - 2.2V)/50= 16mA which is nearly the same as the 20mA red current. Green looks brighter than red so they might look the same.
What resistor value did you use and what is the actual loaded output voltage from each port?
 
That doesn't seem right, the MCU cant source 50 Ma. What value resistor did you use ?

One MCU port will source -20mA and the other MCU port will sink 20mA. Both ports are rated for ±24mA. At ±20mA, the output voltage VOH-VOL = 4.45 - 0.48 ≈ 4.0V
 
With a load of 20mA, the output of one MCU port might be 4.0V and the voltage of the other port might be 1.0V for a total voltage of 3.0V. Then the resistor for the red LED is (3.0V - 2.0V)/20mA= 50 ohms. The green current is (3.0V - 2.2V)/50= 16mA which is nearly the same as the 20mA red current. Green looks brighter than red so they might look the same.
What resistor value did you use and what is the actual loaded output voltage from each port?

The problem I see with that is the voltage drop acrosse the green side is not 2.2v @ 16mA. It's bit less (see datasheet : https://www.electro-tech-online.com/custompdfs/2011/07/WP937EGW.pdf ). And also the output ports voltage @ 16mA would not be 3.0V as in your example, but a bit more. It becomes a puzzling non-linear system to solve !!
 
It is not puzzling, it is simple.
The LED voltages should be measured by you since they can be as low as maybe 1.8V or as high as 2.5V.
The MCU output voltages should also be measured by you since their DIFFERENCE could be as low as 3.0V or as high as 4.6V.
Then calculate the series current limiting resistor value.

You didn't show us the value of your resistor that caused 5mA and 50mA.
 
You didn't show us the value of your resistor that caused 5mA and 50mA.

I did not build the circuit yet. I'm in the design phase. Those values come from the data sheet :

Green side : 2.0V @ 5mA and 2.2V @ 20mA
Red side : 2.0V @ 20mA and 2.2V @ >50mA

So I'm wondering how can I get 20mA in both directions with such different voltage drops.
 
The LED voltage IS NOT 2V for the red and 2.2V for the green. Those are "typical" voltages. But you cannot buy LEDs that are typical, you get somewhere from minimum voltage that they do not spec (it could be 1.8V) to the max spec'd voltage which is 2.5V.

The resistor has a lot more voltage across it (1V or 2.6V) than the small difference between the 2.0V red and the 2.2V green so the currents between them will also have a small difference.

The resistor is calculated to limit the current to 20mA so 50mA is impossible unless the LED is a dead short.
 
Listen to audioguru -- unless you know the process distributions, you have a difficult design task because the forward voltage "spec" is a stochastic variable. Since it sounds like you're building a one-off and not a product to be manufactured, the easy thing is to get the actual LED and measure its characteristics. Then the design is easy.
 
You could always use 4 diodes and 2 resistors, just remember to factor in the voltage drop for 2 diodes when calculating the resistor value.
 
Hi,
The values in datasheet are ideal which may not necessary be the same in practice.
Since you really want to work it out to the ideal values, here is my suggestion: you will need 2 resistors & 2 diodes. Now calculate the value of the resistance of the resistor for red & green remembering p-n junction voltage of diode.
Connect resistors for the red and green accordingly, then connect each of the diodes in parallel to each resistor with anode connected to LED's leads & cathode to the P[1:0].
Good luck
 
You could always use 4 diodes and 2 resistors, just remember to factor in the voltage drop for 2 diodes when calculating the resistor value.
Why are you confusing everything by talking about diodes instead of dual-colour two-terminal LEDs?? A dual-colour LED uses only one current-limiting resistor.
 
You could use the uC pins to drive an H-bridge of transistors, in turn driving the LED. Use a resistor in each upper arm of the H, the left and right resistors being different values to give the colour balance you want.
 
One MCU port will source -20mA and the other MCU port will sink 20mA. Both ports are rated for ±24mA. At ±20mA, the output voltage VOH-VOL = 4.45 - 0.48 ≈ 4.0V
This is not right. Just cause one port can source 20ma and the other will sink 20ma, thay do not add you still only get 20ma total.
You are over thinking this hole thing. It is pretty standard practice to use one current limiting resistor with the Bi color LEDs. Just use a value that is a happy medium between the two.
Andy
 
Last edited:
This is not right. Just cause one port can source 20ma and the other will sink 20ma, thay do not add you still only get 20ma total.
You are over thinking this hole thing. It is pretty standard practice to use one current limiting resistor with the Bi color LEDs. Just use a value at a happy medium between the two.
Andy

I did not add the current. I just said that at 20mA, one port will be at around 4.5V while the other will be at around 0.5V. So the voltage available to drive the LED will be around 4.0V.
 
Ok. I should have simplified the question. Sorry about that !

Given the following schematic and datasheet :

Dual Color LED question.png

I would have normally calculate R as such :

R = (Vsource - Vled) / I
R = (Voh - Vol - Vled) / I
R = (4.5V - 0.5V - Vled) / 20mA

Normally, I would simpley get Vled at 20mA from the datasheet.

In this case, I'm not sure which value of Vled one should pick and what would motivate his choice. I know it probably doesn't make a big difference, but I'm interested in understanding the theory/best practice behind the choice in that situation.

Thanks !
TG
 
I just said that at 20mA, one port will be at around 4.5V while the other will be at around 0.5V. So the voltage available to drive the LED will be around 4.0V.

Then if the red LED is actually 2.0V and the green LED is actually 2.2V, a current limiting resistor value of 100 ohms will cause a red current of 20mA and a green current of 18mA which are nearly the same.
 
How about 2.1 volts?

Yeah, that's what I intuitively intended to do. 2.1V it will be.

What triggered my questioning is the datasheet that shows very different current for a 2.1 voltage drop. But I guess in this case, the Resistor is the biggest factor that decides the current. So in the case of red, i will be close to 20mA and close to 2.0V and for the green, close to 20mA and close to 2.2V.

I guess, then, if my driving voltage was only 2.5V, the difference in current would be greater between the two sides.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top