Lab

7-segment display: pinout, how it works, live circuits

A 7-segment display is eight LEDs in one package: seven bars that draw the digits 0 to 9, and a decimal point. Switch the segments of a live 7-segment display below and see why each one needs its own resistor.

Open the lab

The two circuits on this page work without an account. On a computer or tablet the full lab is limited without an account; a free account lets you try it in full first. NGSpice charts need an account; saving needs a plan. Create a free account

What is a 7-segment display?

Each bar is an LED, called a segment, named a to g clockwise from the top bar; the decimal point is dp. All eight share one pin, the common (COM), and each has its own pin at the other end.

Try it: a common cathode 7-segment display

A 5 V battery, each segment fed from plus through its own switch and its own 220 Ω resistor, and COM back to minus through an ammeter. It opens showing 3: a, b, c, d and g are on.

Preview of 7-Segment Display, Common Cathode: Switches Light a Digit
Open in the lab Embed Run the circuit right here. To edit it in the full lab, sign in; free accounts have a time limit there.
  1. Read the ammeter on COM: it carries the total, about 77.3 mA in the lab's offline engine and 61.3 mA with NGSpice, so each lit segment adds about 15.5 mA (12.3 mA).
  2. Click the switches to draw other digits: all seven bars make 8 and the ammeter reads about 108 mA (85.6 mA); b and c alone make 1.

7-segment display pinout

A single-digit display usually has ten pins: eight for the segments and two for COM. The lab's part has both common layouts (Pins, in its inspector) and labels each pin with its segment. In both, pins 3 and 8 are COM and are joined inside, so wiring either one is enough.

7-segment display with pins on the top and bottom: g, f, COM, a, b on top; e, d, COM, c, dp below
Top and bottom (the default): pin 1 is bottom left.
Pin Segment
1 e
2 d
3 COM
4 c
5 dp
6 b
7 a
8 COM
9 f
10 g
7-segment display with pins on the left and right: g, f, COM, e, d on the left; a, b, COM, c, dp on the right
Left and right (the circuits on this page): pin 1 is top left.
Pin Segment
1 g
2 f
3 COM
4 e
5 d
6 dp
7 c
8 COM
9 b
10 a

Pin numbers differ between makers, so check your display's datasheet.

Common cathode vs common anode

To tell which you have, wire COM to minus and one segment to plus through a resistor: if it lights, it is common cathode; if it lights only the other way round, common anode.

In the lab, the display's inspector has a Type setting: common cathode (the default) or common anode. Wired for the wrong type, every segment stays dark, in both engines.

Try it: a common anode 7-segment display

COM to plus through an ammeter, and a segment lights when its switch connects it to minus through its 220 Ω resistor. It opens showing 5: a, c, d, f and g.

Preview of 7-Segment Display, Common Anode: Switches to Minus
Open in the lab Embed Run the circuit right here. To edit it in the full lab, sign in; free accounts have a time limit there.
  1. The ammeter reads about -77.3 mA offline and -61.3 mA with NGSpice: five segments of about 15.5 mA (12.3 mA). The minus sign only shows that the current runs through the meter the other way.
  2. Click the display and set its type to common cathode: the wiring is now backwards for it, and the digit goes dark.

7-segment display truth table

The segments the lab lights for each digit. On a common cathode display a lit segment's pin is high; on a common anode display it is low.

Segments lit for each digit (1 = on)
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

Some decoder and driver chips draw 6, 7 and 9 differently (6 without its top bar, 9 without its bottom bar, 7 with f); the lab draws them as listed.

Why each segment needs its own resistor

A segment is an LED: once it conducts, its voltage barely changes, so a resistor has to set the current. For a red segment, which drops about 1.8 V, on 5 V with 220 Ω: I = (V - Vf) / R = (5 V - 1.8 V) / 220 Ω, about 14.5 mA.

In the circuits here each lit segment takes about 15.5 mA offline and 12.3 mA with NGSpice, near the hand math and under the 20 mA rating: offline, the 1.8 V is the drop at 1 A; NGSpice takes it at 20 mA plus a small series resistance.

One resistor on COM instead of one per segment is a common mistake: the lit segments share its current. With 220 Ω on 5 V the ammeter stays near 16 mA whatever the digit (16.0 mA for 8, 15.7 mA for 1; 14.6 and 13.5 mA with NGSpice), so each segment of an 8 gets about 2.3 mA (2.1 mA), each segment of a 1 about 7.8 mA (6.7 mA), and the lab draws the 8 dim and the 1 brighter.

Above 20 mA for about 3 seconds a segment burns out, like the lab's LED; the others keep working and the wrench replaces the part. On 9 V, 330 Ω gives one segment about 22.4 mA offline, and it burns; NGSpice gives 19.4 mA, just under 20 mA, so it does not burn there.

7-segment decoders

A decoder chip usually drives the segments from a 4-bit binary number: a 7447 or 74LS47 drives a common anode display, a 4511 a common cathode one, still with one resistor per segment. Here, switches set the segments instead.

More 7-segment circuits

Each runs on its own page without an account.

Use it in class

Predict, switch, measure.

Common cathode: students predict each digit's segments from the truth table, switch them, then double one resistor and explain why only that segment dims.

Common anode: students switch the display's type to common cathode, see the digit go dark, and explain why with the diode's direction.

Setting up a class needs a free account; your free classroom gets a 7-day full-class trial from when the first student joins, then stays open for a smaller class.

Try it with your class

Frequently asked questions

How do I know if my display is common anode or common cathode?

Connect COM to minus and one segment to plus through a resistor. If it lights, it is common cathode; if it lights only the other way round, common anode.

Why does each segment need its own resistor?

With one shared resistor the lit segments split its current, so an 8 is dimmer than a 1: in the lab, about 2.3 mA per segment against 7.8 mA.

What resistor do I need for a 7-segment display on 5 V?

About 220 Ω per segment for a red display: (5 V - 1.8 V) / 220 Ω is about 14.5 mA, under the lab's 20 mA rating. A larger resistor gives a dimmer segment. Check your datasheet.

Can I simulate a 7-segment display free online?

Yes. The circuits on this page run free in your browser, with no account.

Does it work on a Chromebook or a phone?

Yes. DCACLab runs in the web browser, with nothing to install.

Build your own 7-segment circuit

Open the lab, take the 7-segment display from the parts panel, next to the LED, and wire it with a battery and resistors.

Open the lab