5.3 Seven-Segment Display
5.3 Seven-Segment Display
5.3.1 What is a Seven-Segment Display?
A seven-segment display is an electronic display consisting of seven individual LED segments arranged to form numbers and some letters.
The seven segments are normally named:

The segments are:
a, b, c, d, e, f, and g
By switching different segments ON and OFF, the display can produce different numbers.
5.3.2 Displaying Numbers
For example, to display 0, segments:
a, b, c, d, e, f
are ON, while g is OFF.
To display 8, all seven segments are ON.
5.3.3 Types of Seven-Segment Displays
There are two common types:
Common Cathode
All LED cathodes are connected together.
The common terminal is normally connected to GND.
A segment is illuminated by applying a HIGH signal to that segment.
Common Anode
All LED anodes are connected together.
The common terminal is normally connected to the positive supply.
A segment is illuminated by applying a LOW signal to that segment.
5.3.4 Seven-Segment Display Connection
A basic connection can contain:
Arduino → Resistors → LED segments
A resistor is normally used with each LED segment to limit current.
5.3.5 Simple Seven-Segment Example
For a common-cathode display:
int a = 2;
int b = 3;
int c = 4;
int d = 5;
int e = 6;
int f = 7;
int g = 8;
void setup() {
pinMode(a, OUTPUT);
pinMode(b, OUTPUT);
pinMode(c, OUTPUT);
pinMode(d, OUTPUT);
pinMode(e, OUTPUT);
pinMode(f, OUTPUT);
pinMode(g, OUTPUT);
}
void loop() {
// Display number 8
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
}
5.3.6 Seven-Segment Applications
Seven-segment displays are commonly used in:
- Digital clocks
- Counters
- Calculators
- Electronic meters
- Timers
- Scoreboards
- Temperature displays
- Number displays
- Industrial control equipment
Advantages
- Simple construction
- Easy to understand
- Easy to control
- Good for displaying numbers
- Relatively inexpensive
- Easy to read from a distance
Disadvantages
- Limited character representation
- Cannot easily display complex graphics
- Requires several control lines unless a driver is used
- Multiple digits require additional hardware or multiplexing


