Voltage divider and old post.

I saw a post by nomuse back in 2007 (link) and i was just wondering if i understand it correctly.
Here is a diagram i threw together:

I'm running an diecimila with 1 led and 9V battery. Just ensuring that this sketch is correct.

Thanks in advance.

edit those two resistors are 1Mohm 1/4Watt

I would put a 220 ohm resistor in series with the LED. Connecting an LED directly to an Arduino output pin is a not a good idea as it can damage the Arduino.

Otherwise it looks OK.

--
The Ruggeduino: compatible with Arduino UNO, 24V operation, all I/O's fused and protected

Thanks for the response,

Oh okies I'm using a "Specifications:- Forward Current (If): 50mA max - Peak forward current (Ip): 1.2A- Forward Voltage (VF): 1.2V @ 20mA " IR LED.
I thought the 13th digital pin already had a resistor on it, and due to it being max 50mA that it should have been ok. Is this not the case here?

I'm happy to alter the setup.

I thought the 13th digital pin already had a resistor on it, .... Is this not the case here?

This has not been the case for several years and for several versions of the hardware.

.... and due to it being max 50mA that it should have been ok.

Where did you find this information? According to the data sheet (section 28.1) the absolute maximum DC current per I/O pin is 40 mA. It is up to the user to see to it that this current is not exceeded.

Don

eraser:
Thanks for the response,

Oh okies I'm using a "Specifications:- Forward Current (If): 50mA max - Peak forward current (Ip): 1.2A- Forward Voltage (VF): 1.2V @ 20mA " IR LED.
I thought the 13th digital pin already had a resistor on it, and due to it being max 50mA that it should have been ok. Is this not the case here?

I'm happy to alter the setup.

First the picture of the arduino board is of the much older Arduino NG board that did have a resistor wired to pin 13 on shield connector. Boards after the NG used a resistor/led on board, but the pin 13 of the chip to the pin 13 connector bypasses the the resistor/led and therefore any led used on ANY arduino output pin must have an external series current limiting resistor if using a led.

Second in the led specs you listed the 50 ma max is a specification that must be met, not a current limit that the led will automatically limit to. Apply a DC voltage greater then the 1.2vdc Vf spec and the led acts like a short circuit to the voltage source. By the way an Arduino output pin has a maximum absolute current rating (not automatically limited) of 40ma and it's up to the user to prevent drawing current at or above this amount. 20 ma is a better normal continuous current recommendation.

Lefty

Ahh i see, just looked at http://arduino.cc/en/Main/ArduinoBoardDiecimila , so they moved it onboard. And as retrolefty said if you connect to pin 13 it bypasses the resistor.

So all, thanks for that I dont want to ruin my board.

So if i put a 220ohm resistor on pin 13, the led is still fine to run using the 40ma the pin puts out isnt it? It appears to work fine at the moment. (sending Ir code).

So if i put a 220ohm resistor on pin 13, the led is still fine to run using the 40ma the pin puts out isnt it? It appears to work fine at the moment. (sending Ir code).

Yes, that works fine. But again stop thinking that an output pin 'puts out' a specific current. A pin puts out a voltage (+5vdc) when commanded HIGH. It's strickly the attached load (series resistor/led in this case) that determines how much current will be attemped to be drawn out from the pin, and if that exceeds the maximum rated value of the pin then damage will result. It's ohms law where R, resistance of the wired load, that will determine the amount of current that will flow given a specific constant voltage.

Lefty