LED and Resistors

Hello. I am considering purchasing an Arduino Duemilanove, but I have some general knowledge questions before it even gets here. To attach an LED to an I/O pin, should I use a resistor (If so, what kind?)? I know this makes me sound like a complete "noob", but I'm trying my best to learn how these things work ;). If you could answer as thoroughly as possible, (explaining the voltage output of the I/O pins, the tolerance of most LEDs, etc.) that would be great! :smiley:

yes you will need a resistor to drop voltage and more importantly restrict current

as to which one kinda depends on your LED's specs,

popping that data into a calculator (or just doing the math yourself) you can find out what you need to use

oh, output of the pins is 5v at a max 40ma and here is a decent looking link explaining led stuff

http://www.retrospieler.de/e-led-r.html

Thanks for the info! Looks like that helps quite a bit!

If you want the full low down on why to use resistors see:-
http://www.thebox.myzen.co.uk/Tutorial/LEDs.html

Here's a little secret: everyone here was a noob once upon a time. There are former noobs with good memories, and former noobs with bad memories.

Your question is a good one. It's far better than "I've never soldered two parts together before, and I want to build a self-balancing GPS-guided flying robot with image recognition using this DIP switch. I need someone to write my code for me". We mostly-noobs get a lot of benefit out of seeing the experts explain this stuff.

Quick and dirty for an indicator LED - 1k ohm. Won't damage anything and works for most LEDs on anything between 3V and 20V. If you're wanting the most light out, its a bit more complicated. V=IR or R = V/I

R is the resistor you're after.
V is the supply voltage less the forward voltage of the LED (in the spec sheet - typically between 1 and 3 volts).
I is the current you want to flow (in the spec sheet, 20mA is fairly typical, don't exceed the maximum).

Thanks everyone for the replies and

Here's a little secret: everyone here was a noob once upon a time. There are former noobs with good memories, and former noobs with bad memories.

Your question is a good one. It's far better than "I've never soldered two parts together before, and I want to build a self-balancing GPS-guided flying robot with image recognition using this DIP switch. I need someone to write my code for me". We mostly-noobs get a lot of benefit out of seeing the experts explain this stuff.

Thanks for making me feel better about my lack of knowledge :).

Another question though: How does splitting current/voltage work? I've seen tutorials showing a sensor attached to a digital input pin, and the other leg of the sensor connected to 5v, and also a resistor "pulling down" the current/voltage(?) to ground as well... How does the whole Pull-Down/pull-up thing work?

Have a look at:-

and

We were indeed all beginners once. :slight_smile:

Have a look at:-
Voltage divider - Wikipedia
and
Pull-up resistor - Wikipedia

We were indeed all beginners once. :slight_smile:

Thanks for the links. They helped a lot :).

I have an additional question to go with this. I am seeing examples using resistors that put the resistor on the anode side of the LED and I am also seeing examples that put it on the cathode side of the LED. Which is correct (or are both correct)?

I assume both are correct, and that the resistance applies to the entire circuit, so that it doesn't matter which side it's on?

Thanks

I assume both are correct, and that the resistance applies to the entire circuit, so that it doesn't matter which side it's on?

Assumtion is correct, it's a series circuit so the current is the same at any given point in the circuit, and where the current is limited by the resistor doesn't matter as long as it is indeed in the circuit.

You can even split the resistors and say it comes to 300R you can put 150R in the anode and 150R in the cathode.

But that would be silly, unless .......