Electronics Basics · 14 November 2026

How a 7-Segment Display Works: Eight LEDs, One Shared Pin

A 7-segment display is eight LEDs sharing one pin. Common anode vs common cathode, which segments make each digit, resistor values, and Arduino code.

The 60-second version · open on YouTube ↗

Every microwave, alarm clock and petrol pump counts with the same part: seven bars and a dot. Open it up and there’s nothing clever inside. It’s eight LEDs that happen to share one leg.

What is a 7-segment display made of?

Eight light-emitting diodes arranged in a figure-8: segments a to g around the outside and through the middle, plus dp, the decimal point. Each LED has its own pin on one side. On the other side, all eight are tied together to a single common pin. That sharing is the whole trick: it turns 16 wires into 9, and it’s why the part comes in two flavours.

Common anode vs common cathode: what’s the difference?

Common cathode (CC) Common anode (CA)
Shared pin connects to Ground +V (e.g. 5 V)
To light a segment, drive its pin HIGH LOW
Arduino digitalWrite to turn on HIGH LOW
Easy to tell apart? Only by the part number, or by testing —

Electrically they’re identical; only the direction is flipped. Mix them up and every segment appears inverted: you’ll get a “0” when you asked for an “8”. If you don’t know which you have, put a 1 kΩ resistor in series with a 5 V supply, touch the common pin to one rail and a segment pin to the other, then swap. Whichever way lights it tells you.

Which segments make which digit?

With segments ordered a b c d e f g:

Digit a b c d e f g
0 1 1 1 1 1 1 0
1 0 1 1 0 0 0 0
2 1 1 0 1 1 0 1
3 1 1 1 1 0 0 1
4 0 1 1 0 0 1 1
5 1 0 1 1 0 1 1
6 1 0 1 1 1 1 1
7 1 1 1 0 0 0 0
8 1 1 1 1 1 1 1
9 1 1 1 1 0 1 1

“8” uses all seven; “1” uses two. That table is literally what a BCD-to-7-segment decoder chip like the 7447 (for CA) or 4511 (for CC) has burned into it: four input bits in, seven segment lines out. If you watched the decoders Short, this is the same idea.

Do I need a resistor for each segment?

Yes, one per segment, not one on the common pin. A single resistor on the common leg is shared by however many segments are on, so “1” (two segments) is bright and “8” (seven segments) is dim, because the same current is being split seven ways.

Typical values: for a red display at 5 V with a ~2 V forward drop and 10 mA per segment, R = (5 − 2) / 0.010 = 300 Ω, so 330 Ω is the usual pick. Blue and white displays drop about 3 V, so 220 Ω.

Driving it from an Arduino

Wire a–g to pins 2–8 through 330 Ω each, common to GND (for CC). Then:

const byte SEG[7] = {2,3,4,5,6,7,8};        // a..g
const byte DIGIT[10] = {                     // bit 0 = a ... bit 6 = g
  0b0111111, 0b0000110, 0b1011011, 0b1001111, 0b1100110,
  0b1101101, 0b1111101, 0b0000111, 0b1111111, 0b1101111 };

void show(int n) {
  for (int s = 0; s < 7; s++)
    digitalWrite(SEG[s], bitRead(DIGIT[n], s));   // invert for common anode
}

For a common-anode part write !bitRead(...) instead.

How do multi-digit displays work with so few pins?

A 4-digit clock display doesn’t have 32 segment pins; it has 8 segment pins and 4 common pins. The microcontroller lights digit 1’s segments, turns on only digit 1’s common, waits a millisecond, then does digit 2, and so on, cycling faster than your eye can follow. That’s multiplexing, and the 1 ms flicker is why phone cameras sometimes catch clocks with missing digits.

Try it Count 0–9 with a one-second delay. Then remove the resistor from segment a and watch it burn brighter than the rest: that's the current-sharing problem in one LED.

Was this useful? The video version is on YouTube — a like or a comment there helps more people find it. New guides every week: subscribe to DigiCirq.

Topics: 7 segment display · seven segment display · common anode · common cathode · 7 segment arduino · 7 segment truth table

Keep going