LED Series Resistor

coolmandan1

New Member
Hi,

I wanted to connect an LED to the output of a PICAXE 28X-1 chip and worked out the series resistor value to be about 80 ohms. But when i looked in the manuals it suggested that i should a 330 ohm resistor. I am not sure which one i should use??

Thanks,
Daniel
 

premelec

Senior Member
It depends on how bright you want the LED - I'd start with 220 ohms and see if that is plenty bright - remember that different color LEDs have different operating voltages so the series resistor which generates the same current in the LED at 5 volts will be different...
 

hippy

Ex-Staff (retired)
As Dippy asks, how did you work it out ?

It all comes from V=IR, Ohms Law. What current (Iled) the LED needs to glow at the desired brightness and what voltage (Vled ) it drops, and the voltage (Vpsu) the PICAXE delivers when lighting the LED.

Vpsu-Vled = Iled x R

R = ( Vpsu - Vled ) / Iled

Alternatively you can make Iled the maximum the PICAXE can deliver (20mA-25mA) and determine what the minimum R could be. Note you cannot have Iled greater than what the PICAXE can deliver when driving a LED directly, which could be why your R value comes out lower than what is shown in the manual.

For the LED's I use, 2.5mA gives enough brighness for me and Vled is 1.5, so ...

R = ( Vpsu - Vled ) / Iled

R = ( 5 - 1.5 ) / 0.0025 = 3.5 / 0.0025 = 1400R, ~= 1K8

The minimum R, with Iled=25mA ...

R = ( 5 - 1.5 ) / 0.025 = 3.5 / 0.025 = 120R

The R will need to be higher if Vled is lower.

The 330R value often given is based on Vpsu=5V, Vled=1.5V, Iled = 10mA, or something close to that ...

R = ( 5 - 1.5 ) / 0.01 = 3.5 / 0.01 = 350, ~= 330R
 
Last edited:

Dippy

Moderator
Aw.. I was hoping to see the student's workings...

... and if the LEDs are just simple indicators then use High Brighness types and then you can vastly increase R values and get circuit power consumption down. But, stand by for a shock, it may cost a few extra pennies, sorry.
 

inglewoodpete

Senior Member
My experience using standard LEDs is that there is very little difference in brightness with currents between 5 and 25 mA. Unless you are looking at the LED at an obscure angle, 5mA (~560ohms @ 5v) is ample, and saves your batteries too.

However, if you need to use superbright LEDs....
 

moxhamj

New Member
Agree with inglewoodpete - a few ma will do the trick. I use 1k resistors for all my leds. 330R would be the lowest I would go, but that is mainly because I run things on batteries or flea power solar.
 

Mycroft2152

Senior Member
I picked up a couple of sets of christmas tree LEDs last season. The blue LEDs were visible with a 50K to 100 K resistor at 5 volts.
 

westaust55

Moderator
Keep in mind that the maximum current that can be drawn from a PICAXE output is 25mA.

Most standard LEDs (as opposed to the super bright types) are also limited to 20mA.

I would recommend that you limit the current to a lower figure and as others have suggested, 10 to 15 mA is generally sufficient. For this current level, a 330 Ohm resistor will llimit the current to around 12 mA for a normal Red LED. Other colours have a higher forward voltdrop and a 270 Ohm or similar resistor would result in a similar current flow.

Even though the PICAXE outputs can handle 25mA, the total current draw from a PICAXE is around 90mA so allowing for other devices I would recommend a transistor as a buffer. That way, the PICAXE need only supply around 1mA into the transistor and the transistor switches the higher (10 to 25mA) current required by the LED.

Attached is a typical schematic I prepared for an earlier thread on almost the same topic.
 

Attachments

Last edited:

Dippy

Moderator
I tend to use the cheap bright ones by Kingbright, under 15p in one-offs and use 4K7 res for reds and 2K2 for greens. Bright enough for pcb indicators indoors and keeps the power down.
For the money they are 'king bright. I'm sure that's the reason for the manufacturer's name :)
 

hippy

Ex-Staff (retired)
Apart from for lighting I find most LED's are run far too brightly for my liking; most of my purchased equipment has had the case removed and a few layers of masking tape placed over them to reduce brightness and diffuse their output.

I agree with Inglewoodepete; there's often little difference in brightness between 'reasonable' current and very high. I presume a lot of people assume that because a LED states it is "20mA", that's what they will put through it without realising they can use a lower current. I have to admit that I never realised that when I started electronics and it's not often explained explicitly.

The big advantage in using a bigger R and lower current is that battery powered equipment can last much longer. LED's are often the main drain on the battery. A 20mA drain on a PP3 9V battery may give 10 hours life, a 2mA drain can give 100 hours.
 

westaust55

Moderator
Hippy,

A 20mA drain on a PP3 9V battery may give 10 hours life, a 2mA drain can give 100 hours.
Curious why you are referring to / using a 9V battery. Is it to achieve a very compact overall package?

A 9V battery required a regulator and few extra components and some added power loss/wastage (albeit 0.1W at 20mA draw).
Comparing a typical 9V battery versus 3 x 1.5V AA cells
- at 20mA draw = 9V gives ~10 hours whereas 3 x AA cells give ~125hrs
- 9V battery costs 41.7 times 3 x AA cells on a $/hour basis
- 9V battery does only occupy about the space of 1 AA cell but when regulator, etc added likely about half the space of 3 x AA cells.
 

inglewoodpete

Senior Member
For anyone interested, I used a red led with 330ohms on 5v (~9mA) in the IR receiver for my Home Theatre Controller.

To get the most information out of the led, I have used PWM to further control it's brightness. 5% PWM is adequate to indicate 'Standby' in ambient indoor lighting (5% equiv. ~ 450uA): 3% (~270uA) was not bright enough. A succsessfully decoded IR signal causes a 30%-bright flash (equiv ~ 2.7mA) while an error is indicated as a 100% flash (=9mA).
 

Dippy

Moderator
Ah, the old PP3 vs 3AA debate.

I won't disagree that 3xAA will give a lot longer operational life in a given application, but sometimes a PP3 plus regulator has great advantages.
1. Size, yes, they'll fit in smaller enclosures. Sometimes the enclosure is the limiting factor.
2. I really don't think an LM2936/2950 plus minicaps takes that much space. You must have very big regulators.
3. Makes ADCing a lot easier.
4. Regulated supply obv gives more stable performance.
5. Where applicable, good coding and good external electronics can give a good lifetime. Certainly a 'permanently on' LED is silly.
6. I've just bought Energizer PP3s for 21p each. Cheapest I've seen AA (Duracell/Procell) is 20p. You can probably get some 'unknowns' cheaper, but I only use proper makes. Ebay - no-way.
7. Battery clips are smaller/cheaper than battery holders.

You could make a list as to the benefits of 3AAs, so, it's horses for courses. You can't generalise, it just depends on the application.
Some time ago I had to design a people-counter with LCD display. I didn't think that 9 months between PP3 battery change was bad, but I was limited by enclosure size.
My 18X controlled data-downloader with LCD and (2) transistor power/on/off switch used a PP3. Battery lasted over a year. So for some apps PP3s are fine. Sometimes you have no choice.
But for simple code bench testing, education I wouldn't use PP3s for just the reasons you stated.
 

BeanieBots

Moderator
Apart from for lighting I find most LED's are run far too brightly for my liking; most of my purchased equipment has had the case removed and a few layers of masking tape placed over them to reduce brightness and diffuse their output.
.
Agreed. I recently bought a portable telly which has a blue "Power On" LED.
It's so bright that it swamps the light level of the picture!

Out of interest, in 1987, the PI9000 ion beam implanter reduced its total power consumption by nearly 1/2kW just by reducing its indicator LED currents from 25mA to 3mA each. The large saving was largely because the initial power supply voltage supplying the current was 24v.
It was part of an excersise to reduce heat, probably not the most obvious source in a 1/4MW machine but it all adds up.
 

Dippy

Moderator
Ah, the rise of the Blue LED.
If it ain't got a blue LED on it then it ain't proper techno.
Having said that I like the colour, but, as you say, usually set far too bright. Perhaps 150R resistors are 0.0001p cheaper than 1k0 in Beijing?
 

hippy

Ex-Staff (retired)
Curious why you are referring to / using a 9V battery. Is it to achieve a very compact overall package?
Primarily, but that's not the only reason.

Maplin in the UK sell a very nice plastic hand-held case (HH1?) around the same size as a packet of cigarettes which I find nice to work with and has a PP3 compartment. I haven't found anything which is similar for AA or AAA's.

As I want to run from 'random wall-warts' to save batteries I need a regulator anyway. It also means I can take power from DTR/CTS on a serial line as needed.

I also believe illustrating battery life with 220mAh PP3's is more readily understood than for higher capacity batteries; one PP3 lasts 10 hours at 20mA, that's "less than a day", not a lot.

Saying 1400mAh lasts 70 hours and people immediately start trying to imagine how long that really is given, "but it won't always be on; 20 days life maybe ?", think, "that's okay isn't it?", and "I can use higher capacity batteries", so they miss the underlying message.
 

gengis

New Member
Agree with inglewoodpete - a few ma will do the trick. I use 1k resistors for all my leds. 330R would be the lowest I would go, but that is mainly because I run things on batteries or flea power solar.
Second that, 1K with reasonably efficient leds is all you need. Keeps the power dissipation to a minimum and the batteries happy. -and you can hang a led on all the outputs to watch the functioning without exceeding the package dissipation and still have enough output to drive the external circuits.

Buy high brightness leds. They often don't cost any more than ordinary types. Beam angle and mcd output at some current are the things you should be looking at spec wise.

http://www.ledshoppe.com/led5mm.htm I've been happy with these folks - $5/100 leds, 8,000mcd, 10 degree beam angle, free shipping. They have other colors and sizes with good prices. Only caveat - use a web based email address, I get spam for a few weeks after ordering and it seems to come from their credit card clearing house here in the US. DealExtreme, and BestHongKong are two other cheap sources (but for high power LEDs and mains powered LED assemblies)
 

Rickharris

Senior Member
Duracell and other Alkaline pp3 style 9 volt batteries can be broken down and contain 6 slightly under AAA sized single cells - easy to make into 4.5 volt Power pack at minimal size.

The standard energiser PP3 has 6 flat style cells but they can still be broken apart to produce 2 x 4.5 cells.
 
Top