Electronic – arduino – LED burned on Arduino

arduinoled

I connected a green LED to pin 13 and digital GND on Arduino Uno R3. pinMode was set to OUTPUT and digitalwrite was set toHIGH. The LED glowed normally.

However connecting same LED to the 5V and GND burnt it out. How?

Did not pin 13 on HIGH also have voltage of +5V ?

Best Answer

The microcontroller at the heart of the Arduino can handle about 40 mA of current per pin. Connecting the LED (apparently without a current-limiting resistor) directly to 5V and ground will cause it to burn out, as it pulls more than its rated maximum current.

Pin 13 will also be 5V, but the current is being limited (not in a good way) by the microcontroller. The LED will try to pull more, but the microcontroller can't source it, so the LED doesn't burn out (as quickly). However, the microcontroller is not designed to be a current limiter, so connecting an LED directly to an output pin can cause damage over time. How much current the LED tries to pull, depends on the LED.

Most standard LEDs operate with about 20 mA, and can handle shorter durations of higher current.

You need to use a current-limiting resistor with your LED, regardless of whether you use a digital pin or connect it directly to Vcc.