Light-Emitting Diode (LED)

Light-emitting diodes, or generally referred to as LEDs, are small energy efficient light sources that can produce many different colors of lights.

LEDs come in different shapes, sizes and colors. The 7-segment LED display contains seven LEDs inside the display. LED      LED 7-segment LED display      7-segment LED display
1 To turn on a LED you need to connect it to a power source.

The Arduino has a built-in 5V power supply. The pin labeled 5V is the positive power supply, and the pins labeled GND are the negative power supply.
Power supply
2 LEDs are polarity sensitive, meaning that the positive and negative ends of the LED must be connected correctly to the power source, otherwise the LED will not turn on.

The longer leg is the positive (or anode), and the shorter leg is the negative (or cathode).
led positive
This is the symbol for a LED used in a schematic circuit diagram. Note the positive and negative ends in the symbol. led symbol
3 So to turn on a LED you connect the positive (long) leg of the LED to +5V, and the negative (short) leg of the LED to GND.

schematic led
STOP DON'T DO IT! If you do this, you'll see the LED flash once and the LED will be blown right away.

The reason is that too much power (or current) is going through the LED.
4 To reduce the power (or current) going through the LED, you'll need to use a resistor. Resistors have different resistance values measured in ohms Ω. The color bars on the resistor are used to identify its value.

For the brown background color resistor, the first three color bars are used, e.g. brown-green-brown. For the blue background color resistor, the first four color bars are used, e.g. brown-green-black-black. Use the resistor color chart to identify the color values.
150 ohm resistor 150 ohm resistor resistor symbol
5 Connect a 150 Ω (brown-green-brown) or (brown-green-black-black) resistor in between the LED and the power source.

           schematic led with resistor

Make sure you have the LED polarity connected correctly. The long leg is +.
  • If your LED did not light up then you probably reversed the two legs of the LED.
  • Reversing the LED legs will not destroy the LED. It just won't light up.
  • If your LED lights up, reverse the legs to see that it won't light up.
  • Try it and see.
led connection with resistor
6 Replace the 150 Ω (brown-greem-brown) resistor with another color resistor. What happens to the LED?
Resistor values are color coded. Try different resistor values and notice the intensity of the LED.

How (not) to blow up a LED

Remember to always use at least a 150 Ω resistor, otherwise your LED will be destroyed!