7-Segment Displays
A 7-segment display is an electronic display made from seven individual light-emitting segments arranged to form numbers and some letters. 7-segment displays are widely used in clocks, counters, measuring instruments, calculators, audio equipment and control panels.
What Is a 7-Segment Display?
A 7-segment display contains seven independently controlled segments. Each segment is normally identified by a letter from A through G.
By switching different combinations of these segments ON and OFF, the display can represent the digits from 0 to 9 and several letters and symbols.
───── A ─────
│ │
F B
│ │
───── G ─────
│ │
E C
│ │
───── D ─────
Some displays also include a separate decimal-point LED, usually marked DP.
Segment Names
| Segment | Position |
|---|---|
| A | Top |
| B | Upper right |
| C | Lower right |
| D | Bottom |
| E | Lower left |
| F | Upper left |
| G | Middle |
| DP | Decimal point |
How a 7-Segment Display Works
Each segment is an LED or LED-based light-emitting element.
The controller or driver turns individual segments ON or OFF according to the number that needs to be displayed.
For example, the digit 8 requires all seven segments:
A B C D E F G = ON
The digit 1 normally requires only segments B and C.
Displaying Numbers
Different combinations of segments form different digits.
| Digit | Segments ON |
|---|---|
| 0 | A, B, C, D, E, F |
| 1 | B, C |
| 2 | A, B, D, E, G |
| 3 | A, B, C, D, G |
| 4 | B, C, F, G |
| 5 | A, C, D, F, G |
| 6 | A, C, D, E, F, G |
| 7 | A, B, C |
| 8 | A, B, C, D, E, F, G |
| 9 | A, B, C, D, F, G |
Common-Anode 7-Segment Display
In a common-anode display, the anodes of the individual LED segments are connected together.
VCC
│
┌──────┼──────┐
│ │ │
A B C
│ │ │
LED LED LED
│ │ │
───── Segment cathodes
The common anode is connected to the positive supply. Individual segments are normally illuminated by pulling their cathodes LOW through suitable current-limiting circuitry.
Common-Cathode 7-Segment Display
In a common-cathode display, the cathodes of the individual LED segments are connected together.
A B C
│ │ │
LED LED LED
│ │ │
└──────┼──────┘
│
GND
The common cathode is connected to ground. Individual segments are normally illuminated by applying the appropriate HIGH signal to their anodes through current-limiting circuitry.
Common-Anode vs Common-Cathode
| Feature | Common Anode | Common Cathode |
|---|---|---|
| Common connection | Positive supply | Ground |
| Segment ON | Usually LOW | Usually HIGH |
| Current path | Supply → LED → driver → ground | Supply → driver → LED → ground |
| Common application | Multiplexed displays | Multiplexed displays |
Decimal Point
Many 7-segment displays include an eighth LED for the decimal point.
It is normally identified as DP.
The decimal point is electrically separate from the seven main segments, although its common connection depends on the display type.
LED Current Limiting
Each LED segment requires current limiting.
A resistor is commonly placed in series with each segment.
VCC │ R │ LED Segment │ GND
The resistor prevents excessive LED current.
The required resistance depends on the supply voltage, LED forward voltage and desired segment current.
Calculating the Segment Resistor
A basic resistor calculation is:
R = (VCC - VF) / I
where:
- VCC is the supply voltage.
- VF is the LED forward voltage.
- I is the desired LED current.
For example, with a 5 V supply, a 2 V LED forward voltage and a desired 10 mA current:
R = (5 - 2) / 0.010 R = 300 Ω
A standard resistor value such as 330 Ω would provide a lower current and would commonly be a practical choice.
Why Each Segment Needs Current Limiting
Each segment is an individual LED.
Without suitable current limiting, excessive current can damage the LED segment or the driving circuit.
Using one resistor for an entire multi-segment display can also produce unequal brightness when several segments are illuminated simultaneously.
Driving a 7-Segment Display Directly
A microcontroller can sometimes drive a small 7-segment display directly if the required current is within the microcontroller's GPIO limits.
However, the current limits of both the individual GPIO pins and the microcontroller as a whole must be respected.
For larger displays or higher brightness, external driver circuitry is normally preferable.
Transistor Drivers
Transistors can be used to drive 7-segment displays when the required current is too high for a microcontroller GPIO.
Microcontroller
│
▼
Transistor
│
▼
7-Segment Display
The transistor allows the microcontroller to control a larger current without requiring that current to flow directly through the GPIO pin.
Multiplexing
When several digits are required, multiplexing can reduce the number of microcontroller pins needed.
The segment lines are shared between digits while the common connection for each digit is controlled separately.
Segment Bus
A B C D E F G DP
│ │ │ │ │ │ │ │
├─┼─┼─┼─┼─┼─┼─┤
│ │ │ │ │ │ │ │
Digit 1
Digit 2
Digit 3
Digit 4
The controller rapidly activates one digit at a time. If the switching is fast enough, the human eye perceives all digits as being continuously illuminated.
Multiplex Refresh
The display must be refreshed rapidly enough to avoid visible flicker.
The controller repeatedly cycles through the digits:
Digit 1 → Digit 2 → Digit 3 → Digit 4
↑ │
└───────────────────────┘
The exact refresh frequency depends on the number of digits, brightness requirements and driver design.
Multiplex Duty Cycle
When four digits are multiplexed and each digit is activated one at a time, each digit receives only part of the total display time.
For an ideal four-digit arrangement, the approximate duty cycle per digit is:
1 / 4 = 25%
Peak segment current and average current therefore need to be considered when designing the driver.
7-Segment Driver ICs
Dedicated driver ICs can simplify the design of multi-digit displays.
Depending on the device, a display driver may provide:
- Segment control
- Digit multiplexing
- Current regulation
- Brightness control
- Serial communication
Examples of display-driver families include MAX7219-type devices and other dedicated LED display controllers.
MAX7219
The MAX7219 is a well-known serially controlled display driver that can control multiple 7-segment digits.
It uses a serial interface and includes functionality for multiplexing and display control.
Compatible modules are widely used in embedded projects.
Microcontroller and 7-Segment Display
A microcontroller can generate the segment patterns directly or communicate with a dedicated display driver.
Microcontroller
│
├──────────────┐
│ │
▼ ▼
Direct GPIO Display Driver
│ │
└──────┬───────┘
▼
7-Segment Display
Segment Pattern
A program normally represents each digit using a segment pattern.
For example, a simplified representation for the digit 8 is:
A = ON B = ON C = ON D = ON E = ON F = ON G = ON
The exact binary pattern depends on the segment-bit assignment and whether the display is common-anode or common-cathode.
Displaying Letters
Although 7-segment displays are primarily intended for numeric information, some letters can be represented approximately.
Examples include:
- A
- b
- C
- d
- E
- F
- H
- L
- P
- U
The appearance of these letters depends on which segments are available.
Displaying a Minus Sign
A minus sign can be displayed using the center segment:
───── G ─────
The other segments remain OFF.
7-Segment Clock
7-segment displays are commonly used in digital clocks and timers.
A multi-digit clock may display:
12:45:30
Additional LEDs or decimal-point segments can be used to represent separators.
7-Segment Counter
A counter can be implemented using logic ICs, a microcontroller or a dedicated counter/display-driver circuit.
The counter generates a numeric value and the display circuit converts that value into the required segment pattern.
7-Segment Frequency Display
A frequency counter can measure an input signal and display the measured frequency using multiple 7-segment digits.
Input Signal
│
▼
Frequency Counter
│
▼
Display Driver
│
▼
7-Segment Display
7-Segment Voltage Display
A microcontroller can measure an analog voltage using an ADC and convert the result into digits for a 7-segment display.
Analog Voltage
│
▼
ADC
│
▼
Microcontroller
│
▼
Display Driver
│
▼
7-Segment Display
Common-Anode Wiring
For a common-anode display, the common anode is connected to the positive supply and the individual segment cathodes are controlled by the driver.
When using a microcontroller, a suitable transistor or dedicated driver may be required depending on the current and circuit configuration.
Common-Cathode Wiring
For a common-cathode display, the common cathode is connected to ground and the individual segment anodes are controlled by the driver.
The correct current-limiting resistors must be included.
7-Segment Pinout
The pinout of a 7-segment display is not universal.
Different manufacturers and package sizes can use different pin assignments.
Always obtain the exact datasheet or pinout for the display being used.
Identifying a 7-Segment Display
If the datasheet is unavailable, the display type can sometimes be identified with a multimeter's diode-test function.
Carefully test the pins while observing which segment illuminates.
The common pin can then be identified by finding the connection shared by multiple segments.
Use the lowest appropriate test current and avoid exceeding the display's electrical limits.
Testing a 7-Segment Display
A multimeter with a diode-test function can be useful for basic testing.
- Identify the possible common pin.
- Determine whether the display is common-anode or common-cathode.
- Apply the appropriate diode-test polarity.
- Test each segment individually.
- Record which pins correspond to A through G and DP.
7-Segment Display Faults
| Symptom | Possible Cause |
|---|---|
| One segment does not light | Damaged LED, open connection or driver fault |
| All segments remain OFF | Power, common connection or driver problem |
| All segments remain ON | Incorrect logic, short circuit or driver fault |
| Some digits are dim | Current, multiplex timing or driver problem |
| Display flickers | Insufficient refresh rate or unstable power |
| Wrong segments illuminate | Incorrect wiring or segment mapping |
| One complete digit is missing | Digit-enable or common connection fault |
Dim 7-Segment Display
A dim display may be caused by:
- Insufficient LED current
- Excessive series resistance
- Low supply voltage
- Multiplex duty-cycle limitations
- Driver current limitations
- Poor connections
When multiplexing, peak current and average current must both remain within the display and driver specifications.
Flickering Display
A multiplexed display can flicker if the refresh rate is too low.
Flicker can also result from:
- Incorrect timing
- Interrupt problems
- Unstable supply voltage
- Incorrect digit switching
- Electrical interference
Ghosting
Ghosting occurs when unwanted segments appear faintly illuminated during multiplexing.
Possible causes include:
- Incorrect switching sequence
- Insufficient digit blanking
- Driver timing
- Leakage currents
- Slow transistor turn-off
7-Segment Display Replacement
A replacement display should be checked carefully before installation.
- Number of digits
- Common-anode or common-cathode type
- Pinout
- Digit height
- Color
- Forward voltage
- Segment current
- Package dimensions
- Viewing angle
A display with the same physical appearance is not necessarily electrically compatible.
How to Select a 7-Segment Display
- Determine the number of digits.
- Determine the required digit size.
- Choose common-anode or common-cathode.
- Choose the required LED color.
- Check segment forward voltage.
- Check maximum segment current.
- Check the pinout.
- Check the viewing angle.
- Check physical dimensions.
- Choose a suitable driver.
7-Segment Display Applications
- Digital clocks
- Timers
- Frequency counters
- Voltmeters
- Ammeters
- Audio equipment
- Electronic scales
- Calculators
- Industrial control panels
- Power supplies
- Test equipment
- Appliances
- Automotive instruments
Advantages of 7-Segment Displays
- Simple to control
- Easy to read numeric information
- Low cost
- Available in many sizes
- Available in many colors
- Simple interface
- Suitable for counters and measurement equipment
Limitations of 7-Segment Displays
- Limited character set
- Not suitable for detailed graphics
- Multiple digits require additional driving circuitry
- Multiplexing reduces individual digit duty cycle
- LED current must be controlled
- Pinouts vary between manufacturers
Common 7-Segment Design Mistakes
- Using the wrong common-anode/common-cathode type
- Connecting LEDs without current limiting
- Exceeding GPIO current limits
- Using the wrong pinout
- Incorrect segment mapping
- Incorrect multiplex timing
- Ignoring average LED current
- Ignoring peak LED current
- Driving a large display directly from a microcontroller
- Using an incompatible replacement display
Key Points
- A 7-segment display contains seven main LED segments.
- The segments are normally identified A through G.
- An optional decimal point is usually identified as DP.
- Displays can be common-anode or common-cathode.
- Each LED segment requires appropriate current limiting.
- Multiple digits can be multiplexed.
- Multiplexing reduces the duty cycle of each digit.
- Dedicated driver ICs can simplify multi-digit display designs.
- The MAX7219 is a common serial display-driver solution.
- Display pinouts are not universal.
- Multimeters can be used for basic segment testing.
- Always check the exact display datasheet before replacement.