What is the resistor for in the circuit for the fisrt LED example

Hi,

I have just got myself the Arduino UNO and a ARDX starter set and trying things out. First up is the example for BLINK which is the circuit for the flashing LED (1 sec on, 1 sec off)

The circuit asks to the Pin13 to connect to LED+, the LED- to a 560 Ohm resister then to GND

Why is the resistor there? Why 560 Ohms?

Could someone explain the reasons so I will remember when doing future experiments. I don't want to take the resistor out to see what would happen as I might end up damaging something like the UNO

Thanks

The resistor is there to limit the current flow from the arduino output pin, and to keep the LED from burning up. LEDs usually have a voltage drop across them from 1.7-2.0V. So Arduino output pin High is at 5V. 5V - 1.7V = 3.3V. 3.3V across the 560 ohm resistor = ~6mA, safe current range for all parts involved.

You could measure the voltage at the resistor and adjust to bring the current up to 20mA if you'd like it brighter. Vresistor/0.02 = resistance. So if have 3.3V/0.02 = 165 ohm, use a standard value of 180.

Hi!

Why is the resistor there?

Resistor will drop the voltage for the LED, which only requires about 2V. Arduino outputs 5V, and this would damage your LED if connected directly.

Why 560 Ohms?

Actually, you can use a smaller value. You should know the voltage drop of your LED and its current consumption, from there use Ohm's Law to compute for the resistance. For example, common LEDs have 2.1 voltage drop, 22mA current consumption. Since you need 2.1V from 5V to power this LED, you need a resistor that will drop this source:

(5V-2.1V ) / 22mA = 131.82ohms. You may use a higher resistance than this, say 150ohms. (Though I think 130ohm resistor won't hurt much)

Regards,

Its a bit pointless any how since the Uno has an onboard LED for pin 13 (Marked 'L') . It will work with just the bare board.

Yes, if using the onboard LED. Once you get past that, or add a 2nd LED, or hookup a 7-segment display or something, then current limit resistors are needed.

Thanks, I think I understand it a bit better.

I do not know the tech details of the LED’s that are supplied in the ARDX kit.

So let me get this right. If the resistor is not there then there is the potential to for a large current to come through and burn the LED out.

If you're lucky, if you're unlucky the output gate on the arduino dies first.

That is correct. If you calculate that the LED has 1.5V across it and size for 20mA, you should be okay. Adjust accordingly after you get actual parts and can make some measurements.
Here are some connection examples for various things.

hookup_examples.jpg

If the LED is just an indicator, I find a 1K resister works OK and is a safe value for anything at 5v. If you have the new type 'water clear' LEDS you'll get some light out of them with a 10k resistor.

Thanks all for the advice. Much appreciate it.

Why is the resistor there?

Resistor will drop the voltage for the LED, which only requires about 2V. Arduino outputs 5V, and this would damage your LED if connected directly.

This is what it looks like, but technically it is incorrect. The LED does not require about 2V. The voltage drop across an LED is a characteristic of the device, not a rating. When you have current flowing through the LED then some voltage is dropped across it. Since an LED is not linear you cannot apply Ohm's law to it to determine it's 'resistance'. Well, actually you can, but you shouldn't since you would be wrong.

The LED has a current rating that has to be observed, not a voltage rating. The typical recommended current for a red led is 20 mA. The maximum permissible rating is higher but you don't gain significant brightness with more than 20mA. When the 20 mA is flowing through the LED there will be a voltage drop across in that is typically in the neighborhood of 1.7 volts as mentioned in a previous post. You can't apply Ohm's law to the LED but you can apply Ohm's law to the series resistor. So the trick is to apply Ohm's law to the resistor in order to get the desired current and, due to the two devices being in series, that same current will flow through the LED.

Assume that you apply 5V and you have the correct resistor in series with your red LED. There will be 20 mA flowing through each device and there will be about 1.7 V across the LED. This means that the other 3.3V is across the resistor. You can use Ohm's law to calculate the resistance, which comes out to 165 ohms. You next select the closest standard resistor value that you have on hand. If you have a 150 ohm resistor then the overall circuit current will be higher than 20 mA but still within the LED rating. If you have a 180 ohm resistor then the current will be lower than 20 mA but still quite usable. You don't have to be too precise here because (1) the LED will look the same over a wide range of currents and (2) the 1.7 V used in the calculations was an approximation in the first place.

Want to run the same LED on 12V (not from an Arduino output of course)? There will now be about 10.3 volts across the resistor and for 20 mA you will need a 515 ohm resistor. You may happen to have a 510 ohm resistor on hand but a 470 or 560 ohm device will also work.

Other colors of LEDs have different voltage drops when operated at their recommended current. Many require more than 20 mA to give sufficient brightness and most have higher voltage drops at the recommended current. So you wind up with less voltage across the series resistor and more current through it resulting in significantly lower resistance values.

In all cases don't forget to check on the required power rating for the series resistor. For the red LED example this would be less than 0.1 watt so a 1/4 w resistor would be OK but a 1/8 w resistor would be pushing things a bit.

Don

Thank you Don for that detailed explanation.

Another question if possible.

What would I need if I wanted 2 LED's in series.

I have just tried the simple blink experiment but this time put a 2nd LED between the first LED cathode and the resistor. I uploaded the blink code and both LED's flashed, however would I need to adjust the resistor value to make sure the correct voltage/current is flowing or is the original 560Ohm resisor OK?

Thanks all again

What would I need if I wanted 2 LED's in series.

I have just tried the simple blink experiment but this time put a 2nd LED between the first LED cathode and the resistor. I uploaded the blink code and both LED's flashed, however would I need to adjust the resistor value to make sure the correct voltage/current is flowing or is the original 560Ohm resisor OK?

First of all 560 ohms is pretty high to begin with. With the voltage drop for one LED considered you have about 6 mA flowing. This low current is no problem, it's even preferable, as long as the LED lights up. With two LEDs the voltage across the resistor is a lot smaller (5 -1.7 -1.7 = 1.6v) so with the 560 ohm resistor the current now would be less than 3 mA. This may light the LEDs, but if not then you need a smaller resistor.

Don

floresta: First of all 560 ohms is pretty high to begin with.

The 560ohm is what is specified in the ARDX circuit example. http://www.oomlout.com/a/products/ardx/circ-01

The 560ohm is what is specified in the ARDX circuit example. http://www.oomlout.com/a/products/ardx/circ-01

My example is for general run-of-the-mill red LEDs for which there may not be a datasheet available. Oomlout may have determined that the particular LEDs that they are supplying are sufficiently bright with a 560 ohm series resistance without doing any calculations, or they may just have gotten a good deal on 560 ohm resistors. You should generally try to choose the largest series resistance that will give a usable display since that eases the strain on your power supply and, in this application, on the output pins of the microprocessor.

Don

If you want to use 2 blue or white LEDS in series, they probably won't light at all since the forward voltage of 2 of these will typically be more than 5V. LEDS at the red end of the spectrum usually have much lower forward voltages than the blue end of the spectrum.

560 is minimal. One may use 1K resistor for example.

560 is minimal. One may use 1K resistor for example.

Are you saying that my reasoning in reply #10 is wrong?

Don

floresta: Are you saying that my reasoning in reply #10 is wrong?

http://en.wikipedia.org/wiki/Diode_modelling

The number 560 does not appear anywhere on that link nor is there any information about the calculation of such a series resistor. The information in that link is intended for those who want to use a mathematical model to describe the operation of a real diode. It has nothing to do with the knowledge needed to keep that real diode from being destroyed by too much current.

I am still interested in why you consider 560 ohms to be the minimum series resistance for the circuit in question.

Don