Light an LED the right way: polarity and resistors

Learn which way round an LED goes, why it always needs a resistor, and how to work out the right resistor value with one line of maths.
  • Level:Beginner
  • Duration: 30 min
  • Ages 8+
  • Platform: Arduino
Light an LED the right way: polarity and resistors – EEMENTOR STEM™ lesson

LEDs are in almost every project, from the power light on your TV to traffic lights. They are easy to use once you know two things: they only work one way round, and they always need a resistor. In this lesson you put one LED in the right way and one the wrong way, and you calculate the resistor for any LED.

What you'll learn

  • What an LED is and why it only lets current through one way
  • How to tell the + leg from the − leg
  • Why an LED burns out without a resistor
  • How to calculate the right resistor for an LED

What you need

  • UNO R3 board and USB cable (UNO R3 Starter Kit)
  • 2 red LEDs
  • 2 resistors, 220 Ω
  • Breadboard and jumper wires (UNO R3 Starter Kit)

What is an LED?

LED stands for light-emitting diode. A diode is a part that lets current through in one direction only, like a one-way valve in a water pipe. An LED is a diode that gives off light when current flows through it.

An LED only works one way round. The long leg is + (anode) and the short leg is − (cathode). If the legs have been cut, look at the rim of the LED: the side with a small flat edge is −.

Parts of an LED: dome, flat edge, long leg (+) and short leg (−), and the LED symbol

Why a resistor?

An LED is not like a light bulb. Once the voltage across it reaches about 2 V (for a red LED), it lets through almost any current. Connected straight to 5 V, it takes far more current than the 20 mA it can handle, and it burns out in a moment. The resistor sets the current to a safe value.

Resistor = (supply voltage − LED voltage) ÷ current. For a red LED on 5 V with 15 mA: (5 − 2) ÷ 0.015 = 200 Ω. The nearest value in your kit is 220 Ω, which gives about 13.6 mA. Bigger is always safe; the LED is just a little dimmer.

How to calculate the resistor for an LED on 5 V
LED colour Voltage it takes Resistor on 5 V
Red about 2.0 V 220 Ω
Yellow about 2.1 V 220 Ω
Green about 2.2–3.0 V 220 Ω
Blue and white about 3.0–3.2 V 220 Ω (a little dimmer)
An LED the right way round lights; backwards it stays dark

Wiring

LED 1 is the right way round. LED 2 is deliberately the wrong way round: its long leg goes to the − side.

Breadboard wiring diagram: Light an LED the right way: polarity and resistors
Breadboard view. Check each connection against the wiring table below.
From To
UNO 5V Bottom + rail (red wire)
UNO GND Bottom − rail (black wire)
+ rail Columns 20 and 34, row j
Resistor 220 Ω Column 20 (row h) to column 24 (row h)
LED 1 long leg (+) Column 24, row f
LED 1 short leg (−) Column 25, row f
Resistor 220 Ω Column 34 (row h) to column 38 (row h)
LED 2 short leg (−) Column 38, row f (backwards on purpose)
LED 2 long leg (+) Column 39, row f
Columns 25 and 39, row j − rail

Try it

  1. Plug in the USB cable. LED 1 lights. LED 2 stays dark: it is backwards, so it blocks the current.
  2. Unplug, turn LED 2 round (long leg in 38f, short leg in 39f) and plug in again. Now both light. A backwards LED doesn't get damaged at these voltages; it just doesn't work.
  3. Look closely at the LED with a torch: inside you can see two small metal parts. The bigger one, shaped like a cup, is usually the − side.

Don't try an LED without a resistor. It might survive a second, but it gets weaker every time, and it can crack.

Try this next

  • Replace LED 2 with a blue LED. It lights, but it's dimmer than you might expect, because it takes about 3 V for itself.
  • Work out the resistor you would need for a red LED on a 9 V battery at 15 mA: (9 − 2) ÷ 0.015 = 467 Ω, so the kit's 560 Ω would be a good choice.
  • Put the RGB LED from the kit on the board and find out which legs are red, green and blue. The longest leg is the common −.

Troubleshooting

  • Nothing lights up: check that the USB cable is plugged in (the UNO's ON LED is lit), that the long leg of the LED goes to the + side, and that every wire sits in the column the table says. Wiggle each wire gently; a wire that isn't pushed all the way in is the most common fault.
  • Neither LED lights: check that the resistors go from the + rail to the column where the LED's leg is, and that each LED's other leg reaches the − rail.
  • An LED is very dim and turning it round doesn't help: it may have been damaged earlier without a resistor. Try a new one.

Build it yourself

Everything used in this lesson comes in one kit, with parts tested by our engineers.

UNO R3 Starter Kit | Arduino IDE Compatible | Free Tutorials $56.00

Shop the kit