1
\$\begingroup\$

I have a standard 5mm RGB LED that I have connected to the digital pwm pins of my Arduino Nano and I am using a potentiometer at one of the analog inputs to change the hue of the LED. My code isn't adjusted for the LED's voltage so it uses the full range of the duty cycle. The digital pins supply 5V, so with a full duty cycle, that means at some spots on the potentiometer, I am sending a continuous 5V to some pin of the LED. However, all three channels seem to be working perfectly fine after testing it.

I previously tried sending 3.3V through all three channels of the same type of LED from the 3.3V pin without adding any resistors and blew out the red channel since it has the lowest threshold voltage (1.8) whereas the green and blue channel were okay because their threshold voltage was very close to the 3.3V. So why does my Arduino not break my LED when connected to 5V with a full duty cycle, but the 3.3V power supply breaks it?

\$\endgroup\$

3 Answers 3

14
\$\begingroup\$

Because the Arduino's pins can't supply enough current to damage it. They have too high source resistance. You can damage your Arduino by doing this.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ The output impedance of AVR chips is 25ohm. That is not very high. \$\endgroup\$ Commented May 3, 2018 at 15:28
  • 1
    \$\begingroup\$ @IgnacioVazquez-Abrams If the LED's Vf is 3V, then that would result in (5-2)/25=80mA. Probably not enough to instantly kill the LED. Also, is it really 25Ω? I recall it being a bit higher, but maybe my memory fails me. \$\endgroup\$
    – marcelm
    Commented May 3, 2018 at 16:55
  • 1
    \$\begingroup\$ @marcelm: All the V:I charts in the datasheets are 25ohm at 25degC. \$\endgroup\$ Commented May 3, 2018 at 18:46
9
\$\begingroup\$

The Arduino Nano is based on the ATmega328P. This chip can sink or source 40 mA for each GPIO pin.

Apparently your LED can withstand more than 40 mA. Two questions arise:

  1. How much current is actually flowing? (To find out this, the easiest way is to measure it.)

  2. Can the ATmega source/sink this amount of current for any length of time before the GPIO goes bad? That depends on whether the actual current per GPIO is below or above 40 mA.

\$\endgroup\$
1
  • 4
    \$\begingroup\$ I really doubt that it's actually limited to 40mA. That's just the maximum that the chip is guaranteed to handle without damage. It will happily supply more than that...and eventually stop working. \$\endgroup\$
    – AaronD
    Commented May 3, 2018 at 19:40
8
\$\begingroup\$

The output pins of the chip used in the Arduino are internally connected to MOSFETs. The MOSFET will behave like a relatively low value resistor until you overload it, at which time it will limit current- actually there is a gentle transistion (however not necessarily at a safe current for either the output or whatever random LED you are hooking up to it). Here is a characteristic curve for an output sinking current on a PIC16C54, which will have a similar shape of behavior:

enter image description here

The maximums and minimums are based on 3\$\sigma\$ deviation from the mean, and are not guaranteed. Which is why we put resistors in there, because we want circuits to behave predictably for every one that is manufactured, not to roll the dice and have some work and some burn out. The heavy currents can also cause immediate or long term damage to the MCU, due to overheating or metal migration failure modes.

Your 3.3V pin presumably is connected to a regulator with a large current capability so with a red LED, excessive current for the LED (and perhaps the regulator) will likely flow.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.