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.

Resistor value? led circuit

Status
Not open for further replies.

Thorpydo

New Member
I was wondering the optimum value for a resistor in series with an LED, with a GPIO on one side and ground on the other.

In nigels tutorials, he uses a 1k resistor, but I've seen people mention 330 before as well.
Thanks
 
Thorpydo said:
I was wondering the optimum value for a resistor in series with an LED, with a GPIO on one side and ground on the other.

In nigels tutorials, he uses a 1k resistor, but I've seen people mention 330 before as well.

There's no 'optimum' value, it's just a question of how bright you want the LED. The minimum value of the resistor is given by the maximum current it can withstand, and (in this case) the maximum current a PIC pin can provide - which is about 25mA. The maximum value of the resistor is that which provides just enough current to make the LED visible.

So your resistor value needs to be somewhere within that (very wide) range, my choice of 1K gives about 3.5mA per LED, using a 330 ohm will give about 10mA.

Probably the best thing is to try two LED's side by side, with different value resistors, and see which you prefer - bearing in mind that for a battery powered project with 330 ohm resistors the battery will only last 1/3 as long.
 
use a pot!

try to use a potentiometer. it's a variable resistor that will adjust the led brightness according to your needs!
 
yes but a potentiometer is not a good idea for normal projects... for one thing, they take up a lot more board space, and with 3 terminals they get to be a pain to use on a breadboard, plus if you accidentally turn them all the way down, you are basically operating the LED with no resistor. That can potentially damage the PIC, the LED, or both... and it makes your circuit consume a heck of a lot more power.

stick with resistors. personally I use 1k where I actually care about battery life, and either 330 or 1k (whichever I grab first, honestly) where power consumption doesn't matter.
 
evandude said:
(whichever I grab first, honestly)

A lot of my design choices use that technique :lol:

It's true, many component values are extremely uncritical (like the LED series resistors) - you simply need to select values within a huge range.
 
Nigel Goodwin said:
evandude said:
(whichever I grab first, honestly)

A lot of my design choices use that technique :lol:

I use a engineering technique I call "A lot or a little." Although I do have many resistor values, I keep drawers of 1 ohm, 10 ohm, 100 ohm, 1kohm, 10kohm and 100kohm. When I need a resistor, I think to myself, "Do I need a lot or a little?"

This also works for capacitors :p

j.

Just for LEDs I keep a bunch of 470 ohmers around, but when I don't want to hunt for one I grab a 1k.
 
Just have a couple (40 - 50?) old (and some newer) defective televisions on the atic. great source for all kinds of parts :lol: especially glass :roll:
 
It is quite easy to calculate the resistor value. The formula is quite simple and you can easily work it out the optimal value for any LED you may find in your junk box.

The formula is :

R = ( Vs - Vled ) / Iled

where

R = Value of current Limiting Resistor to use
Vs = Supply Voltage
Vled = Voltage Drop across the LED
Iled = Current desired

Some notes:

Vs ...

You should know Vs or be able to measure it easily. This is the voltage which is powering the circuit.

Vled ...

You can find the voltage drop across the LED from the datasheet if you have one. In **broken link removed** datasheet for a typical Red LED, the forward voltage is typically 2v

If you don't have a datasheet or have just found the LED in your junkbox you can still find the Forward Voltage of the LED if you have a digital multi-meter with a Diode Test function. Simply select the Diode Test and connect the multi-meter across the LED. The number shown in the display is usually the voltage drop across the LED or silicon junction.

If you don't have a digital multi-meter, you can use the following rules of thumb as a guide

Red = 1.8v
Orange = 2.0v
Yellow = 2.1v
Green = 2.2v

Iled ...

Once again, the dathesheet will tell you the maximum current. In the datasheet above this is 15ma. As a rule of thumb, you can allow up to 20ma of current to flow through most LEDs and in abscence of data telling you otherwise, this is the value I would choose.

While the current flowing through the LED is one thing to consider here, you also need to consider other parts of the circuit, in particular your current source and sink. In other words, where is the current coming from and where is it going to. If you are driving the LED from a micro, many can sink more current than they can source. You will need to check this by refering to the datasheet for the micro.

R ...

Once you have calculated the optimal value for the resistor, you would then select the next closest value available, chosing a resistor which was a little higher than that calculated. For example, using the LED above, we would calculate..

R = 5v - 2v / 0.015a
R = 200

While 200 ohms is a prefered value within the 1% metal film range, we would probably use a 220 ohm resistor which is the closest prefered value in a standard 10% carbon series.

I am certain that if you Google around for a while, you will find many web sites which will explain this to you with pretty pictures and everything.
 
BartSimpson said:
It is quite easy to calculate the resistor value. The formula is quite simple and you can easily work it out the optimal value for any LED you may find in your junk box.

I think we all knew that all ready, including the author of the thread 8)

The relevent word though is 'optimal', do you perhaps have an 'optimal' current (or brightness) in mind, and how did you arrive at it?.
 
Hi Nigel,

I don't doubt that you and most others here did know it already, however it wasn't clear that the author did. As such, I thought his question wasn't really answered. I'll just crawl back into my hole then :) Bye.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top