Powering Components

Hello I just got my first arduino :) And wanted to know Whats the max amount of power it can provide to connected components? and how can i connect a led to be driven by a external power source? I know the ground goes to the arduino ground but what about the positive? Where does that connect? Btw why is it always necessary to connect a resistor between led and arduino connection, is it only to drop voltage or does it also serve another purpose? Thanks

Max power to connected components via digital pin? ~10 mA You can connect an LED via a transistor easily, with an NPN, base connects to a resistor and then the digital pin on arduino, collector to GND on both arduino and external power source, Emitter to anode on LED, LED Cathode to + on external power source. Resistor on the pin that connects to the LED is to limit current not voltage to the LED, the pins are at logic level, they cant source or sink much current so to prevent burning the chip you use a resistor.

Maximum current for each I/O pin is 40mA. Probably safer not to push it to this maximum. Not sure whether the chip will be damaged or whether the output voltage will sag. You can safely drive an LED from an I/O pin using a 220 ohm resistor. I=V/R I=5/220 i~22 mA

though actual current for the LED is given by R = (VS - VL) / I where VL is the voltage drop across the LED, typically 1.7V

@fliggygeek,
Your description of the NPN transistor is reversed.
+5 to LED anode, LED cathode to current limit resistor to NPN collector, emittor to ground.

@SKY,
Here are some typical connections. Single LEDs driven direct from arduino pin with current limit resistor is okay as johhwhatsit indicates.
Chip will be DAMAGED if current is exceeded.
If you find your ATMEGA is running very hot to the touch, that usually a good indication that its got too much current going thru the output pin. Or that it has been blown already.

LED_connections.jpg

jonnywhatsit: Maximum current for each I/O pin is 40mA. Probably safer not to push it to this maximum. Not sure whether the chip will be damaged or whether the output voltage will sag.

From what I understand, exceeding the 40mA on a pin will blow that pin; general recommendation is to not go above 25-30mA on each pin (ie, ~20 percent headroom).

Also - there is a 200mA maximum rating for the ATMega - so you can source a max of only 200mA for all pins; if you were driving LEDs and they needed 40mA each, you could only drive 5 max (ie, 5 digital pins HIGH) - bring that sixth pin HIGH, and blow something. Of course, if your LEDs only require 10mA each, then you could drive 20 pins HIGH at a time...

This is why you want to limit the current used by devices connected to the Arduino, to protect it, but also to be able to drive more devices at the same time. Its also why you have to carefully read datasheets for the devices being connected to it, as well as understand the various formula (mainly Ohm's Law) to know how much current a component is going to draw.

Be aware of all that, and the limits, stay under them by 15-20 percent (or, if you have to go to the maximum level, don't linger there long!) - and you should be OK.

:)