Resistor size @ 3v

oracacle

Senior Member
I have a little project to do, a set of toy traffic lights. Nothing complex 3 LEDs and an on/off switch and some batteries. The final circuit isn't going to have a download circuit so the serial in will be ties low with a 10k. However a standard LED with a Fv of 2.5 and VI of 30mA would only need a 17 ohm resistor to operate. I was thinking of using a 100 to help protect the 08m2 I plan on using.

The 08m2 will be programmed on a standard 5v board before being transferred to the final project. And if I'm completely honest not using resistors would be beneficial for the final product as it will reduce the size (cold alos look at using SMD resistor as well I suppose)
 

lbenson

Senior Member
With modern high-brightness LEDs, small 1/6-watt 680 ohm resistors would probably work (maybe even 1K), even at 3V (they certainly do at 5V, with good brightness). If vertically mounted, they take up very little space.

17 ohm at 3 volts would be 176 milliamps--not good for any picaxe pin and a half a watt of heat to dissipate.
 
Last edited:

neiltechspec

Senior Member
100 ohm would give a max current of approx 5mA (FV 2.5v off a 3v supply is just 0.5v across the resistor),
as long as you don't have the leds connected when on 5v, you could come down to 47 ohm to give 10mA.

680 ohm as suggested above is pointless if you want to be able to see the leds in daylight.

Neil.

edit: have the leds lit with the pic pin low (LED anode to Vcc) as the pic can sink more current than source (20mA max)
 

hippy

Technical Support
Staff member
For lowest cost, minimal circuitry, I would suggest just the PICAXE. Download Serial In straight to 0V the three LED anodes direct to PICAXE output pins, the common cathodes to a PWM output pin, no resistors. Adjust the PWM to give desired brightness, keep the average current down.

There's an increased risk of adverse failure but it's probably an acceptable risk. For catastrophic failure a LED would have to be kept permanently on, output pin high, the 'initially input on reset' PWM pin low. The chances of a PICAXE jamming up in that state seem fairly low.

It would however be recommended to have a resistor on the Serial In and for each LED or one in the common path, plus a decoupling capacitor.

I have always found that choosing resistors for LED's isn't so much a matter of calculating what that should be - though it gives a ballpark - it's more about what provides the brightness one would like, and that can only be determined by experimenting.
 
the three LED anodes direct to PICAXE output pins, the common cathodes to a PWM output pin, no resistors. Adjust the PWM to give desired brightness, keep the average current down.
What an elegant and minimal solution. :) I've used PWM quite a lot to adjust LED brightness. but using one PWM o/p for three LEDs is really neat. I suspect it might be subtly different when red and amber are on together, rather than red or amber on their own, but probably not enough to notice.
 

oracacle

Senior Member
I did think about using a single resistor but both the red and amber LEDs would be on at the same time. Those who drive in the UK should know that.

The circuit is currently in the design stage so nothing has been set in stone. Starting think that I may have to set up a breadboard to run on 3 volts for a bit of testing.
 

lbenson

Senior Member
680 ohm as suggested above is pointless if you want to be able to see the leds in daylight.
Don't see that OP specified daylight, but by experiment, red LED+680 ohm resistor powered by 3.3V (didn't have 3V ready to hand) can certainly be distinguished on/off in sunlight at arms length. That might or might not be pointless depending on OP's needs.

Glad to see that hippy's PWM suggestion appeals.
 
Last edited:

hippy

Technical Support
Staff member
I'm betting that 70uA comes from 0.5/680 and Windows calculator showing 7.35e-4. Then writing it down as .7 with some leading zeroes, before moving the decimal point leftwards while trying to figure out what 'e-4' means 'as a proper value'. Not that I'd ever make that mistake :)

I calculated an R for 0.5V drop at 25mA to be 20R but I'm not convinced the LED Fv would be 2.5V, though it does vary.

There are also voltage drops on the PICAXE I/O pins as current increases which adds to the complexity of determining an actual value.

I tested with a 20M2 at 3V3 and "PWMOUT pin, 255, 100" and lit my red LED between two PICAXE pins with no R satisfactorily though not bright. It lit dimly even down below 10 so probably the best way to test ( which is what I was doing ) would be to use w0 as the duty,start from zero and increment that once a second, SERTXD out the value, turn it off as soon as it's bright enough and note the last number.

Take care to get the LED the right way round or it will get a 99.9% hit rather than an intended 0.1% when turned on. Probably best to start with an R and check it does get brighter when testing first.
 

StefanST

New Member
... a set of toy traffic lights. Nothing complex 3 LEDs and an on/off switch and some batteries. ... the 08m2 ...
Do you take into account the voltage drop during battery usage?
What is the nominal and the minimum voltage when should the circuit still work?
 

neiltechspec

Senior Member
Ok,

0.00102941176470588235294117647059 Amps

Whos really cares anyway, just stick a small value resistor in, 47R plenty for 3v supply.
 

Circuit

Senior Member
As one who certainly has "questionable knowledge", how exactly does one determine the resistance required to light, for instance, this 3mm red led spec-ed as 2V (Vf), with a current of 10mA from the picaxe pin and a supply of 3 volts?

https://www.digikey.com/product-detail/en/kingbright/WP710A10ID/754-1606-ND/2769809
The formula that I use is: R=(Vs -Vf)/If
Where R is the value of the series resistor; Vs is the supply voltage (3 volts in the example quoted); Vf is the Forward LED voltage; If is the LED specified current.

In this case R = (3-2)/.010
Therefore R = 100 ohms
 

rq3

Senior Member
100 ohm would give a max current of approx 5mA (FV 2.5v off a 3v supply is just 0.5v across the resistor),
as long as you don't have the leds connected when on 5v, you could come down to 47 ohm to give 10mA.

680 ohm as suggested above is pointless if you want to be able to see the leds in daylight.

Neil.

edit: have the leds lit with the pic pin low (LED anode to Vcc) as the pic can sink more current than source (20mA max)
Very true, as had been mentioned in many threads prior. For a 20M2 Picaxe at 5 volts, a pin sourcing current already includes about 90 ohms of resistance. The same pin sinking current already includes about 30 ohms of resistance. These resistances are device and voltage dependant.

At a supply voltage of 3.0, one would likely need some small additional series resistance if sinking current through a red LED. Conversely, a blue LED driven by the same pin sourcing current may not light at all.

The devil is in the worst case numbers, and how safe you want to be. In Hippy's example, the LED's are between pins sourcing current through a (probably) 90 ohm resistor, and then sinking the current through a 30 ohm PWM resistor. There is already about 120 ohms resistance in series with the LED, and then PWM on top of that. LED's of all types can withstand, repetitively, very large currents of very short duration. That is how the LED flash on your smart phone works. One amp for a microsecond is one microamp average, but it will be VERY bright for that microsecond. As long as you don't exceed the AVERAGE current limits, you can even do it over and over again.

You really need to run the worst case numbers for the specific condition. Highest possible supply voltage, lowest possible LED forward voltage, lowest possible intrinsic pin impedance, probability of device survival as currents approach, or exceed, maximum permissable levels. Then make an informed decision based on what you know. If the LED is going to have to flash only once, ever, then you can use the most efficient red LED you can find (lowest possible forward voltage with the greatest light output), connect it between the 3 volt supply and a low pickaxe pin, and expect it to reliably flash very brightly. Exactly once. It (or the Picaxe) may actually survive several, or even millions, of such abusive cycles, but by analysis you know that they are not obliged to do so. But you CAN expect it work once.

Or you can take what you know, and add resistors to the point that the probability of failure approaches that of the unstressed lifetime of the most failure prone device (probably the picaxe, since it is the most complex). In that case, the circuit will be switching current as required, and as programmed, but the LED will be so dim as to be pointless.

Somewhere in between those two extremes is reality. Such is engineering.
 

neiltechspec

Senior Member
Pulled some LEDs out of the junk box & hung them on my proto board.
No idea of the spec, but they are 5mm types.
Off 3v with already existing 330R's:
Red - very good
Amber - pathetic
Green - poor

So theorise all you like, you need to try it for real.

edit: What I'm trying to say is - experimentation will be required to get similar brightness with the 3 colours.
680R might be alright for Red, but it probably wont be for Amber & Green.
 
Last edited:

rq3

Senior Member
Pulled some LEDs out of the junk box & hung them on my proto board.
No idea of the spec, but they are 5mm types.
Off 3v with already existing 330R's:
Red - very good
Amber - pathetic
Green - poor

So theorise all you like, you need to try it for real.

edit: What I'm trying to say is - experimentation will be required to get similar brightness with the 3 colours.
680R might be alright for Red, but it probably wont be for Amber & Green.
That's exactly right. Shorter wavelengths of light (toward the violet end of the spectrum) have more energetic photons than wavelengths toward the red end of the spectrum. An LED's forward voltage drop is directly related to its color, with red being the lowest at roughly 1.8 volts, then going up through the rainbow (orange, yellow, green, blue, violet) to about 3.5 volts or so.

Then, just to complicate the issue, the human eye is most sensitive to green light, so a dimmer green LED may appear to be just as bright as a pretty bright red LED (both LED's putting out the same number of photons per unit of time).

And even within the same lot of LED's of the same color, there is a variation in efficiency (perceived brightness at the same drive current).

You are right. For the best looking display using different LEDs and colors, you will have to cherry pick the resistor for each and every LED.
 

hippy

Technical Support
Staff member
You are right. For the best looking display using different LEDs and colors, you will have to cherry pick the resistor for each and every LED.
And when not using resistors, using PWM to set brightness, one would likely have to set different PWM duty rates to have equal brightnesses.

And that's where the problem comes in trying to set red, amber and red plus amber, as noted previously because there won't be a single PWM duty best suited for all those.

That's a limitation of the single PWM no resistor solution. It can be avoided by PWMing the red and amber separately or using resistors. It's a matter of deciding what's most important; better brightness control or minimum or cheapest solution.
 

lbenson

Senior Member
The formula that I use is: R=(Vs -Vf)/If
Where R is the value of the series resistor; Vs is the supply voltage (3 volts in the example quoted); Vf is the Forward LED voltage; If is the LED specified current.

In this case R = (3-2)/.010
Therefore R = 100 ohms
So if you just have the 100R between the picaxe pin and 0V, you would have 3V/100 or 30mA current (excessive) (excluding internal resistance in the picaxe), but adding the LED (does it matter whether the LED is before or after the resistor?) causes the current supplied by the picaxe pin to drop to 10mA?

What about the LED causes this to happen?

I guess this is a variation of the question, "What exactly is 'Voltage forward'?". How does it differ from "effective" internal resistance in the LED?
 

hippy

Technical Support
Staff member
This is the model Circuit describes ...

Code:
   |    ___     |\ |
3V |---|___|----| >|----.
   |            |/ |   _|_ 0V

   |<-- 1V ->|<-- 2V -->|
In that configuration, 2V is Vforward of the LED, so the resistor has to drop 1V at whatever Iforward current we want to put through the LED.

So R = ( Vsupply - Vforward ) / Iforward

So that's the (3V-2V) / 0.010A

It would also be the same if the R and LED were swapped round -

Code:
   |   |\ |     ___
3V |---| >|----|___|----.
   |   |/ |            _|_ 0V

   |<-- 2V ->|<-- 1V -->|
As to the difference between the forward voltage and an effective resistance of the LED; I would say they are just two alternatives for the same thing. If a LED has 2V across it and 10mA through it then its effective resistance is 200R -

Vforward = Reffective * I

Reffective = Vforward / I

It may help to think of a LED as a diode which normally drops about 0.6V. The LED drops a bit more and glows brighter.
 

lbenson

Senior Member
Thank you, hippy--ever helpful.

So if human perception of brightness varies for different colors of LED for a given current, for real LED stoplights is there the equivalent of a wine taster or perfume sniffer who determines when the balance of red, amber, and green brightness is optimal?
 

hippy

Technical Support
Staff member
I would guess what colours and brightness should be are laid out in some UK or EU regulations somewhere but not certain where. It might be BS EN 50556:2011 for traffic lights.

I'm not sure how standard it is though because I've seen greens in the UK which tend more towards blue. But like the blue-black / white-gold dress some people won't see what others do.
 

AllyCat

Senior Member
Hi,

With a 3v supply rail, the PICaxe xxM2s probably won't source 20mA, even into a short circuit, and only sink 20mA with a volt or more drop. See the graphs in the relevant PIC data sheet, section 31, -43 and -44. Also note how much lower are the currents at 1.8 volts. :(

To drive green LEDs (in particular) you're going to need a moderately "stabilised" 3 volt battery, either Lithium-based and/or rechargeable; possibilities being 2 x NiZn or 1 x LiFePO4, which each give around 3.2 volts, but are not easy to obtain. A pair of Alkalines will be down to 2.5 volts (hardly illuminating a green LED at all) before they're even half way to their rated end-of-life.

Cheers, Alan.
 

oracacle

Senior Member
Batteries will be 2xAAA aww they are crap and way to last ones haha on.
Looks aww though hippys some solution isn't going to work for this application. Also like in going ti be doing some experimenting after this soft rotation next week.

What thought was going to be a simple question...
 

techElder

Well-known member
Ever since the resistor size debate began, I've been thinking that if one really wants an LED with stable output per color, then Hippy's suggestion of PWM is a really good way to do that.

However, my thoughts ran toward having a "standard" or "stable" module where a representative red, green and amber LED (or whatever color is pertinent) is mechanically coupled to its own LDR in a light-shielded environment.

Then the LDR is read with ADC at some time(s) in the program to determine the appropriate duty cycle for PWM for that color of external LED (the toy traffic light.) Experimentation would be in order for initial settings.

Perhaps my thoughts ran away with me? :D
 

lbenson

Senior Member
Perhaps my thoughts ran away with me? :D
I had a similar thought wondering if actual traffic lights used a single LDR to adjust brightness for daytime/nighttime/overcast.

[OFF TOPIC], but perhaps weirdly related to this thread: a few posts ago I made an offhand mention of perfume, and just now I got an ad for perfume (looking up asciitable.com). I hope the intertubes don't somehow know how to associate my IP address with my PICAXE forum name, or have some other arcane way of making a link. IF ANYBODY'S CHECKING, I DON'T INTEND TO PURCHASE PERFUME. BUT IF YOU HAVE WINE, I MIGHT BE INTERESTED.[/OFF TOPIC]

(Please pardon my paranoia.)
 
Last edited:

techElder

Well-known member
if actual traffic lights used a single LDR to adjust brightness for daytime/nighttime/overcast.
Specifically, I'm thinking to adjust brightness to a standard per color.
 

lbenson

Senior Member
Specifically, I'm thinking to adjust brightness to a standard per color.
I see--you were talking about reading each LED, not the ambient light. One more LDR allows you to also programmatically adjust the brightness of each to the external condition. (Is this design by committee?)
 

premelec

Senior Member
I'd go by committee... ;-0 On a more practical note some traffic LED lights and walk signals DO have intensity control varying with ambient light conditions... keeps WALK signal from blinding pedestrians at night while still bright in daytime.
 
Top