Finding the right resistor for your circuit

If you connect a LED directly to the 5V power source of your Arduino, the LED will burn… This is very well illustrated in this simulation using EveryCircuit.

A somewhat unsuccessful circuit...
A somewhat unsuccessful circuit…

To avoid the LED from burning, we need to add a resistor. But which resistor?

The first thing we need to learn is the characteristics of the LED. A standard red LED has a voltage drop of about 2 volts and a current rating of 20 mili-amperes. Why is this important? Because of Ohm’s law!

V = RxI

Voltage (V) equals resistance (R) times current (I). So what? Well, we have a voltage of 5V (that’s the Arduino power source) and we need 2V (according to the LED specs). So we need to drop 5V-2V = 3V.

Also, because of the specs of the LED, we know we want 20mA. Following Ohm’s law, we get 3V = R x 20mA, so R = 3V / 20mA = 150Ω. If we put in that resistor, we should have a successful circuit:

A bright red light!
A bright red light!

Look at that, all the values of voltage and current are right where they should be! You can increase a bit the resistance, that’s fine. The light will get dimmer, that’s all.

If you need to get the details for your LED, check this table. For help doing the math, check this LED calculator.

LEDs in series

To have more than one LED on your circuit, you can connect them in two ways: In series or in parallel.

Components connected in series are connected along a single path, like this:

A simple series circuit
A simple series circuit

To calculate the resistor you need, just add the voltage: we need 4V (2V + 2V), and we have 5V. So we need to drop 1V.

For the current, just use the 20mA. In a series circuit, the amperage is the same for the entire circuit.

Doing the math, we get 1V / 20mA = 50Ω. Look how good the values are on the circuit!

Getting ready for Xmas!
Getting ready for Xmas!

LEDs in parallel

Another way to connect the LEDs is using parallel circuits. Something like this:

LEDs in parallel
LEDs in parallel

Here the math is a bit different. The voltage is the same for the different paths, so we’ll need to drop 3V from our 5V power source. And the current is split, so we’ll need 40mA. Again, using Ohm’s Law: R = 3V / 40mA = 75Ω.

A parallel wonder!
A parallel wonder!

Mixing it all together

Now, this is all fine if you have the same number of LEDs and therefore can use the same voltage and current on both sides… But what if you have 3 LEDs?

The way to do it is to think of each path as a separate circuit. Using the same values for the resistors we calculated before, you can build this circuit:

Not all circuits are created equal
Not all circuits are created equal

You can now have fun adding more LEDs to your circuit. Just be sure to check the specs for the LEDs and don’t go over 500mA for a single circuit — that’s as much as your Arduino can take.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.