I'm just trying out Arduino Uno for the first time with 2 blinking LEDs on a breadboard. All the tutorials on the Internet seem to use a resistor. I do know the function of resistors, but does it really matter here? These LEDs are working just fine without a resistor.

  • 10
    \$\begingroup\$ That depends if you want your LED to melt or not. If you don't mind, omit the resistor. :-) . \$\endgroup\$ – Dan Sheppard Apr 4 '15 at 15:35

Naughty! :-). If they say to use a resistor there's a good reason for that! Switch it off, NOW!

The resistor is there to limit the LED's current. If you omit it the current limiting has to come from the Arduino's output, and it will not like it. How do you find out what the resistor needs to be? You do know Ohm's Law? If you don't, write it down in big letters:

\$ V = I \cdot R \$

Voltage equals current times resistance. Or you could say

\$ R = \dfrac{V}{I} \$

It's the same thing. The voltage you know: Arduino runs at 5V. But not all that will go over the resistor. The LED also has a voltage drop, typically around 2V for a red LED. So there remains 3V for the resistor. A typical indicator LED will have a nominal current of 20mA, then

\$ R = \dfrac{5V - 2V}{20mA} = 150\Omega \$

The Arduino Uno uses the ATmega328 microcontroller. The datasheet says that the current for any I/O pin shouldn't exceed 40mA, what's commonly known as Absolute Maximum Ratings. Since you don't have anything to limit the current there's only the (low!) resistance of the output transistor. The current may so well be higher than 40mA, and your microcontroller will suffer damage.

The following graph from the ATmega's datasheet shows what will happen if you drive the LED without current limiting resistor:

enter image description here

Without load the output voltage is 5V as expected. But the higher the current drawn the lower that output voltage will be, it will drop about 100mV for every extra 4mA load. That's an internal resistance of 25\$\Omega\$. Then

\$ I = \dfrac{5V - 2V}{25\Omega} = 120mA \$

The graph doesn't go that far, the resistance will rise with temperature, but the current will remain very high. Remember that the datasheet gave 40mA as Absolute Maximum Rating. You have three times that. This will definitely damage the I/O port if you do this for a long time. And probably the LED as well. A 20mA indicator LED will often have 30mA as Absolute Maximum Rating.

  • 2
    \$\begingroup\$ Not really. 3 and you won't get any light, because 3 x 2V > 5V, and 2 you'll have the same problem, only 1V drop instead of 3V. I added to my answer to switch it off now! \$\endgroup\$ – stevenvh May 31 '12 at 13:28
  • 23
    \$\begingroup\$ I lost count on how many times I have written that calculation in answers here. I should have a script for it :-) \$\endgroup\$ – stevenvh May 31 '12 at 13:49
  • 2
    \$\begingroup\$ LEDs are designed to be operated at a certain max current. Voltage driving them means current is uncontrolled. Ports are made to provide a certain max current. Shorting them or overloading them MAY leasd to pin or whole IC destruction or just cause subtle operating problems. Or not. \$\endgroup\$ – Russell McMahon May 31 '12 at 14:23
  • 4
    \$\begingroup\$ @JohnR.Strohm I wouldn't call it an industry standard. \$\endgroup\$ – m.Alin May 31 '12 at 14:29
  • 2
    \$\begingroup\$ @JohnR.Strohm - Like m.Alin says that's not an industry standard. Digikey lists 10mA nominal LEDs ranging from 0.4mcd to 1000 mcd, and 20mA LEDs ranging from 0.1 mcd to 54000 mcd. There's no line in it, and no guarantee that your 10mA LED will be good visible. Red LED voltage typically ranges from 1.8V to 2.2V. For a red LED 1.6V is exceptionally low. \$\endgroup\$ – stevenvh May 31 '12 at 15:37


I have to say that driving an LED without a resistor is NOT RECOMMENDED unless you know what you are doing. However, if you understand how an LED behaves, you can drive it without a resistor safely. As a matter of fact, driving an LED without a current limiting resistor is often better.

Why would you drive an LED without a resistor? Simple, to make your circuit more energy efficient.

Should you drive your LED with PWM set to a constant duty cycle (i.e. 5V PWM at 34% duty cycle to achieve an average voltage of 1.7V)?

Yes and no. Using PWM can work just as well as applying a specific voltage (if you are careful), but there are better ways. Things to worry about when taking the PWM approach.

  1. The frequency of the PWM is important. When using PWM in this scenario, you are relying on the ability of your circuit's components to temporarily handle high currents. Your biggest concerns will be how the LED handles a temporary high current and how the output circuit of your chip can handle a temporarily high current. If that info is not specified in the datasheet, then the datasheet authors were lazy. BUT!!! If that information is specced on the datasheet, then you can safely take advantage of it. For example, the LED I have next to me has a max current rating of 40mA. However, it also has a "Peak Forward Current" rating of 200mA, with a note that the current cannot remain at 200mA for longer than 10us. Soooo... I can drive the LED with 1.7V (the LEDs typical forward voltage from the datasheet). With a duty cycle of 34% and a power supply of 5V (34% of 5V = 1.7V) will produce an average voltage of 1.7V, I just need to ensure my PWM on time is 10us or less. During the on-time, the current through the LED will likely rise to around 58mA (58mA = typical current draw at 1.7V of my diode divided by 34%). 58mA exceed my LEDs steady current maximum of 40mA by 18 mA. Finally... I would need a PWM frequency 33.3kHz or greater to safely drive my LED (33.3kHz = The inverse of [10us ON time divided by 34% to get the PWM period]). In REALITY, I could safely use PWM to power my LED with a slower PWM frequency. The reason is this: Datasheets usually don't specify all of the valid operating scenarios of a component. They don't spec those scenarios because the vendor doesn't want to invest time in speccing and supporting the use of their component for corner use cases. For instance, with my LED, if I can operate the LED at 40mA for ever (40mA is the steady current max rating) and I can operate the LED at 200mA for 10us. Then, I can be 99.99999% certain that I can safely operate the LED at 100mA for some period longer than 10us, probably close to 20us.

NOTE: All components can safely handle temporary current spikes above their maximum ratings as long as the duration of the current spikes are SMALL ENOUGH. Some components will be more forgiving than others, and, if you are lucky, the component's datasheet will specify how well it can handle spikes of current.

  1. The voltage of your PWM is important. I'll demonstrate my point by example instead of via explanation. If we use the LED I was referring to earlier, we know that 34% duty cycle, at 33.3kHz, at 5V is safe. However, if our voltage was 12V, we would have to rework our calculations to keep the same amount of current flowing through the LED. Our duty cycle would need to drop to 14.167% (1.7V divided by 12V) and our minimum PWM frequency would decrease to 14.285kHz (the inverse of [10us divided by 14.167%]). HOWEVER!, this is cause for concern. In the 5V scenario we are applying 5V for 10us and in the 12V scenario we are applying 12V for 10us. We more than doubled the voltage during that 10us, there has to be some consequences. And yes, there are! My LED datasheet does not give me the data necessary to know how high of a voltage I can use for 10us before I damage my LED. Surely 1000V for 10us will fry my LED. But, how do I know if 5V at 10us will fry my LED? or 12V for 10us? If there is not a spec for it then you are taking a risk. So... 5V for 10us is risky, but most likely safe.

NOTE: You can add a capacitor to the circuit to average out the PWM and make this issue go away.

  1. You need to be cognisant of the capabilities of the output pin you have connected your LED too. The most important parameter will be the maximum output current. For the Arduino Uno, I believe that is 40mA. You should choose a PWM duty cycle whose average voltage keeps the current going through the LED below 40mA. In order to know what voltages will produce that much current, you need to look at the LEDs IV curve (current vs. voltage plot). For a typical LED a voltage between 0.7V (typical minimum voltage needed to emit light from the LED) and 1.25V will almost certainly be safe. Why is 1.25V probably safe? Well, most LEDs won't exceed 40mA at 1.25V, even without a current limiting resistor. Another thing helping protect someone in the case they apply too much voltage, is that the digital output circuit of the Arduino will have its own output impedance, that output impedance will be low, but even a 20 ohm output impedance would provide a non-negligible amount of protection. The arduino uno has a digital output impedance around 250 ohms. Long story short, if you drove an LED using PWM at 1.0V at a high frequency, for a typical LED, there is zero chance you will damage your digital output on an Arduino Uno.

  2. The PWM approach drives the LED in an open loop fashion (and so does using 1.7V power supply without PWM). You are applying an average voltage to the LED that is just the right value to turn ON the LED but not high enough to damage the LED. Unfortunately, the range of voltage from ON (and bright enough to see) to damaged LED is very small (That range on my LED is about 0.7V). There are various reasons why the 1.7V you think you are applying won't always be 1.7V...

a. Changes in the ambient temp. What if you had a motor driver, voltage regulator, etc. in a closed box that also contained the LED. It wouldn't be uncommon for those other components to raise the ambient temp inside the enclosure from 25C to 50C. This rise in temperature WILL change the behavior of your LED, your voltage regulator, etc.. Your once safe 1.7V will no longer be 1.7V and your LED that used to fry at 2.5V will now fry at 2.2V.

b. Changes in your supply voltage. What if your supply was a battery. As the battery drains, the voltage drops considerably. What if you designed your circuit to work well with a slightly used 9V battery, but then you added a fresh 9V battery. Brand new 9V lead acid batteries typically have an actual voltage of 9.5V. Depending on the circuit that is providing the 5V used for the PWM, that additional 0.5V could up your 5V PWM to 5.3V. What if you were using a rechargeable battery? They have an even larger range of voltages throughout their entire discharge cycle.

c. There are other scenarios, like induced current from EMI (motors will do this).

Having a current limiting resistor saves you from many of these problems.

Using PWM to drive an LED is not a very good solution, is there a better way that doesn't require a current limiting resistor?

Yes! Do what they do in LED lightbulbs for your home. Drive the LED with a current controller. Set the current controller to drive the current your LED is rated for.

With the proper current controller, can be increased dramatically, and you can safely drive the LED without worrying about most of the issues involved with open loop driving an LED.

The downside: You need a current controller, and you have upped the complexity of the circuit by 10x. Don't be discouraged though. You can buy current controller ICs, LED driver ICs, or make your own current controlled boost converter. It isn't that hard. Take some time out of your busy schedule and learn about boost and buck converters. Learn about switching power supplies. They are what powers your computer and they are extremely energy efficient. Then, either build one from scratch, or buy an inexpensive IC to do most of the work for you.

Of course, as with all electronic designs, there are always more things you can do to make your circuit better. Check out figure 3 in the following PDF to see how complex even a household LED lightbulb can be these days...


In summary: You have to decide for yourself how much risk you are willing to take with your circuit. Using 5V PWM to drive your LED will likely work just fine (especially if you add a capacitor to smooth out the PWM square wave and max out your PWM frequency). Don't be too afraid to push your electronics outside of their usual operating conditions, just, be informed when you do it, know the risks you are taking.


FYI: I am surprised by how many people immediately jump to the answer, "YOU MUST USE A CURRENT LIMITING RESISTOR". That is well intentioned, but overly safe advice.


  • 2
    \$\begingroup\$ I'm surprised to see how many people considered this answer to be valuable design advice. Driving a LED without current limiting using PWM is just as bad for the LED as what the OP is doing, plus it will generate EMI and VCC ripple like crasy. \$\endgroup\$ – Dmitry Grigoryev Jan 19 '18 at 12:07
  • \$\begingroup\$ @DmitryGrigoryev, I realized I completely failed to address the maximum output current of the digital output. I added a new bullet to cover that. PWM DOES allow someone to safely drive an LED without a current limiting resistor. EMI and VCC ripple are created anytime you drive loads with a digital signal, but this is common (ex. H Bridge, Boost Converter, Hobby Servo Control, etc.) and is hardly a reason to avoid PWM. Reasonable solutions exist to handle EMI and VCC ripple if needed. Most people won't care about the small amounts of EMI and VCC ripple created by driving an LED with PWM. \$\endgroup\$ – ort Aug 18 '20 at 15:45

You can use the builtin pullup resistors as suggested here:

The pullup resistors provide enough current to dimly light an LED connected to a pin that has been configured as an input.

  • \$\begingroup\$ Not for LEDs, this can be used for buttons but for LEDs there is a danger of breaking the output \$\endgroup\$ – Menelaos Vergis Feb 25 '19 at 6:50
  • \$\begingroup\$ if it is not safe why the official docs say so? (I've also tried myself and it worked as described.) \$\endgroup\$ – eadmaster Mar 1 '19 at 12:12
  • \$\begingroup\$ Please read down to OUTPUT, it mentions that it needs a series resistor: "This is enough current to brightly light up an LED (don't forget the series resistor), or run many sensors, for example, but not enough current to run most relays, solenoids, or motors. " \$\endgroup\$ – Menelaos Vergis Mar 2 '19 at 17:00
  • \$\begingroup\$ @MenelaosVergis it is safe to do this when the pin in INPUT_PULLUP mode, it is not safe to do with a pin in OUTPUT mode. This is clear in the docs if you read both sections (and from the quoted excerpt in this answer). \$\endgroup\$ – Alfie Sep 15 '20 at 8:54

The short answer is, yes and no, it depends on your arduino and it depends on the color of your led. For instance, a 3.3V board does not require a resistor in series with a small green LED, because the forward voltage of the LED is pretty high, see this. The internal resistance is around 25 Ohm, take (3.3 - 3)/25 = 12mA, so this is still fine, you should not go across the maximum current per pin which is 40mA for the 328p atmel processor used on the UNO boards (unless you use a derivative of the 328p where it could be a different story). However, for an arduino running at 5V trouble will arise with an infrared LED which has a much lower forward voltage, typically 1.2V, (5-1.2)/25 = 150mA, and this is definitely too much, so use a current limiter such as a resistor to drive those type of LEDs. Pin 13 on the Arduino boards (or another pin on variants) already has a led and a resistor in series. Also, the power supply to the board has a maximum rating, typically 200mA, and you must stay under this level, and you can not draw more than a certain amount of mA per group of pins, this is explained here. If you want to drive many LEDs, then consider to use a matrix LED driver that does the multiplexing for you, see for instance my youtube area where I demonstrate the MAX7219CNG driver. But also Arduino Uno's can do the multiplexing for you, see my IR thermometer with 4 seven segment LEDs on youtube. Happy hacking.


The answer from stevenvh explains what you need to do, but you also must calculate the power dissipation across the LED so that you don't burn out the voltage drop resistor. For example, if the supply voltage is 5V and the forward voltage of the resistor is 1.0V then you'll be dropping 4V. Using a 220 ohm resistor will result in a current of (I=V/R) of 18mA and a power dissipation (P=IV) of 72mW.

0402 Imperial sized (1005 Metric) resistor are generally 1/16W, which is 62.5mW. So in this case this would not work; it would overheat the resistor and shorten its operating life. So you would need to change to an 0402 resistor with 1/10W rating, or a larger 0603 resistor.

Whenever you do calculations such as these, add them to the schematic, so that the reviewer can double-check your work easily.

Note that forward voltage (and hence, resistor value) is a function of the LED, and different colors of LEDs will have different values. Blue LEDs in particular have a high forward voltage (~3.0V typ). So if you are trying to get four different LEDs to have the same brightness then you'll need to repeat the calculations for each LED. To really do it right, look at the optical characteristics of each LED at its rated current, and adjust accordingly.


YES! It can be done.

Even though what has been said is correct.... there's another way. A more energy efficient way of driving LEDs with 5v.

This is a bit undocumented and it is unknown if the solution will wear off the LEDs, but it can be done. I'm actually doing it.

Using PWM by hardware: Here's an example:

#include <avr/io.h>
#include <util/delay.h>
void pwm_init()
    // initialize TCCR0 as per requirement, say as follows
    TCCR0 |= (1<<WGM00)|(1<<COM01)|(1<<WGM01)|(1<<CS00);

    // make sure to make OC0 pin (pin PB3 for atmega32) as output pin
    DDRB |= (1<<PB3);

void main()
    uint8_t duty;
    duty = 1;       // duty cycle = 0.39% of the time (depends on the oscillator.)

    // initialize timer in PWM mode

    // run forever
        OCR0 = duty;

PWM can also be simulated using software and the avrs timers. You can find an example inside the lufa library, called LEDNotifier.c.

My conclusion: It is possible to drive a led on 5V.

PROS: No need for a resistor. Some energy saving too (~50%)

CONS: I don't know if the component is stressed and about its lifetime reduction.

There's a guy who also did this experiment at Stanford and posted some info at his site.

  • 2
    \$\begingroup\$ This just doesn't seem like a good idea. You're probably sourcing more current from the controller than it's rated for, even if you're not doing it for very long. \$\endgroup\$ – Scott Seidman Dec 8 '14 at 15:55
  • 1
    \$\begingroup\$ As said this is undocummented. The Arduino UNO output IO can drive around 40ma-50ma. That is constant. I can for sure handle very short pulses with more current. Please have a look at wikipedia. \$\endgroup\$ – Gaspar de Elias Dec 8 '14 at 16:27
  • \$\begingroup\$ In the Arduino environment, one can get PWM more easily with analogWrite() on the corresponding pin. Still not sure that this is a good idea, but at least for IR LEDs, it's common for the data sheets to allow considerably higher peak currents for duty cycles less than 100%. \$\endgroup\$ – microtherion Dec 8 '14 at 16:33
  • \$\begingroup\$ I'm pretty sure energy savings will be negative compared to a resistor-based solution, because the LED efficiency becomes lower as the current increases. \$\endgroup\$ – Dmitry Grigoryev Jan 19 '18 at 12:13
  • \$\begingroup\$ @ScottSeidman Why isn't that a good idea? just because most people believe it is not recommended to use an LED without a resistor? this answer proved investigation, a very respectful source like Stanford University and from what I can experiment, it works. I definitely love downvoted posts because they tell those who voted down are just biased. What a paradox... \$\endgroup\$ – Ivanzinho Mar 20 '20 at 18:56

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