Sub topic 6
Which Way Round an LED Goes
Assume you know that voltage pushes current through a circuit, that resistance limits current, and that an Arduino digital pin can output HIGH or LOW. This chapter focuses on LED polarity: connecting its positive and negative sides in the correct direction.
An LED Has Polarity
An LED, or light-emitting diode, is a diode that produces light when current flows through it. A diode is an electronic component that allows current to flow mainly in one direction.
The two LED terminals have different names:
- Anode: the positive side. It connects toward the Arduino output pin or the positive supply.
- Cathode: the negative side. It connects toward GND, the circuit's reference point.
Current should flow from the anode, through the LED, and out of the cathode. If you reverse the LED, it normally stays dark. A small reverse voltage may be harmless, but too much can damage the LED.
The LED symbol shows this direction:
The arrow-like triangle is not part of the standard LED symbol. The diode symbol is a triangle-like direction marker in some simplified diagrams, while the actual diode symbol uses a triangle-free diode shape with a bar marking the cathode. In a wiring diagram, rely on the labels A and K when they are provided.
Identifying the Anode and Cathode
A typical through-hole LED gives you several physical clues:
- The longer leg is usually the anode.
- The shorter leg is usually the cathode.
- The flat edge on the plastic body usually marks the cathode.
- Inside the LED, the larger metal plate is usually connected to the cathode.
- The smaller internal plate is usually connected to the anode.
These clues are common, but do not treat them as the only source of truth. Legs may have been cut shorter, the component may have been inserted into a circuit already, or a particular package may use different markings.
| LED feature | Usual meaning |
|---|---|
| Longer leg | Anode, positive |
| Shorter leg | Cathode, negative |
| Flat edge of body | Cathode, negative |
| Larger internal metal plate | Cathode, negative |
For a surface-mount LED, the package may have a line, dot, notch, or another mark for the cathode. The exact marking depends on the package and manufacturer. Check the component's datasheet when the physical marking is unclear.
Connecting the LED to an Arduino
For an LED connected to an Arduino pin, the usual path is:
- Arduino output pin
- Current-limiting resistor
- LED anode
- LED cathode
- Arduino GND
The resistor can go on either side of the LED. A series component is in the same current path, so placing the resistor between the pin and the anode is electrically equivalent to placing it between the cathode and GND.
The polarity still matters. The resistor limits current, but it does not make a reversed LED conduct in the intended direction.
const uint8_t LED_PIN = 8;
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN, HIGH);
delay(500);
digitalWrite(LED_PIN, LOW);
delay(500);
}When the pin is HIGH, current leaves pin 8, passes through the resistor and LED, and returns through GND. When the pin is LOW, there is little voltage difference across the LED, so it turns off.
Using a Multimeter to Check Polarity
Many digital multimeters have a diode-test mode. With the circuit disconnected from power:
- Set the meter to diode mode.
- Touch the red probe to one LED leg.
- Touch the black probe to the other leg.
- If the LED glows faintly or the meter shows a forward-voltage reading, the red probe is on the anode and the black probe is on the cathode.
- If the meter shows an overload or open reading, reverse the probes.
A red LED may show a forward voltage near 1.8 to 2.2 volts. Blue, white, and green LEDs often show a higher value. The exact reading varies by LED and test current.
Common Polarity Errors
A reversed LED is one of the simplest faults to fix. If the wiring is otherwise correct, the LED usually remains dark rather than lighting weakly. Check these points:
- Confirm that the longer leg or marked positive terminal is connected toward the Arduino pin.
- Confirm that the cathode connects toward GND.
- Check that the LED legs are in separate breadboard rows.
- Check that the resistor is actually in series, not bypassed by another breadboard connection.
- Verify that the Arduino pin number in the program matches the wire.
- If the LED has been connected directly to a power source, disconnect it and add a suitable resistor before testing again.
An LED that was briefly reversed is often unharmed. An LED that received excessive forward current may be permanently damaged, even if its polarity was correct.
Exercise
An LED has a longer leg and a shorter leg. You connect the shorter leg to Arduino pin 8 through a resistor and the longer leg to GND. What should you change?
Show answer
Reverse the LED. Connect the longer leg, the anode, toward pin 8 through the resistor, and connect the shorter leg, the cathode, toward GND.