7 Segment Display: Pin Diagram, Truth Table & Decoder IC

Share:
Digital Electronics
7 Segment Display: Pin Diagram, Common Anode vs Common Cathode, Truth Table and BCD Decoder

Every digital meter, lift indicator and counter panel still relies on a few simple LED bars arranged in the shape of the number eight. Learn how they are wired, how to light any digit and how to drive them safely from a decoder or Arduino.

Pin Diagram Common Anode Common Cathode Truth Table CD4511 Decoder Multiplexing

A 7 segment display shows the digits 0 to 9 by switching seven LED bars on and off. This guide covers its pin diagram, both common types, the hex code truth table, decoder ICs, resistor sizing and multiplexing.

Hello everyone, today we are going to learn how a 7 segment display works, how to identify its pins and type, and how to drive it with a BCD decoder or a microcontroller.
7 segment display

What Is a 7 Segment Display?

A 7 segment display is a numeric indicator made of seven LED bars, named a to g, arranged so that lighting different combinations forms the digits 0 to 9. An eighth LED, the decimal point, is usually added, and all segments share one common pin that is either the anode or the cathode of the LEDs.

Quick Answer
  • Seven LED segments a to g plus a decimal point, in a 10 pin package.
  • Pins 3 and 8 are usually the common pin.
  • Common cathode: common to ground, segment driven high to glow.
  • Common anode: common to plus 5 V, segment pulled low to glow.
  • Each segment needs its own current limiting resistor, typically 220 Ω at 5 V.

Segment a is the top bar, the letters run clockwise through b to f, and g is the middle bar. Lighting all seven gives the digit 8.

Labelled pin diagram of common anode and common cathode 7 segment display showing segments a to g, DP and COM pins
Image credit: Last Minute Engineers. Diagram courtesy of Last Minute Engineers, shown here for educational reference.
Advertisement

7 Segment Display Pin Diagram

Last Minute Engineers notes that a single digit has 10 pins: eight segment pins for a to g plus DP, and two common pins, usually pins 3 and 8.

PinFunctionPinFunction
1Segment e6Segment b
2Segment d7Segment a
3Common8Common
4Segment c9Segment f
5Decimal point10Segment g

This pinout is the one used by the very common 0.56 inch single digit parts such as the 5161AS common cathode and 5161BS common anode modules. Always confirm the pinout in the datasheet of your exact part.

10Pins on a single digit
2Common pins, 3 and 8
about 2 VRed segment voltage drop
about 15 mATypical segment current
Quick Tip

To find the type, set a multimeter to diode test and put the red probe on pin 3 and the black probe on pin 7. If segment a glows faintly, it is common anode; if not, reverse the probes, and a glow then means common cathode.

Common Anode vs Common Cathode

Common Cathode

All LED cathodes are joined to the common pin, which goes to ground. A segment lights when its pin is driven high through a resistor.

Best for: CD4511 decoders and direct microcontroller drive
CC
Common Anode

All LED anodes are joined to the common pin, which goes to plus 5 V. A segment lights when its pin is pulled low through a resistor.

Best for: 74LS47 decoders and open collector drivers
CA

Last Minute Engineers points out that both types look almost identical from outside and describes common anode as the more popular type. Choose the one that suits your driver, since swapping types later means inverting every code or changing the decoder, as in any decoder based design.

Do You Know?

A 7 segment display can also show letters such as A, b, C, d, E and F, which is how hexadecimal values are displayed. Letters like K, M, W and X cannot be formed clearly with seven bars, so alphanumeric displays use 14 or 16 segments instead.

7 Segment Display Truth Table With Hex Codes

The truth table below lists which segments light for each digit. The hex code assumes bit 0 is segment a and bit 6 is segment g, with the decimal point off, which is the usual order in microcontroller code.

DigitSegments ONg f e d c b aCC HexCA Hex
0a b c d e f0 1 1 1 1 1 10x3F0xC0
1b c0 0 0 0 1 1 00x060xF9
2a b d e g1 0 1 1 0 1 10x5B0xA4
3a b c d g1 0 0 1 1 1 10x4F0xB0
4b c f g1 1 0 0 1 1 00x660x99
5a c d f g1 1 0 1 1 0 10x6D0x92
6a c d e f g1 1 1 1 1 0 10x7D0x82
7a b c0 0 0 0 1 1 10x070xF8
8a b c d e f g1 1 1 1 1 1 10x7F0x80
9a b c d f g1 1 0 1 1 1 10x6F0x90

For common anode, every bit is inverted and the decimal point bit 7 is set to 1 to keep it off, giving 0xC0 for zero. The inputs are usually BCD numbers from 0000 to 1001, and each segment output can be simplified with a Karnaugh map if you build the decoder from gates.

BCD to 7 Segment Decoder ICs

A decoder IC converts a 4 bit BCD input into the seven segment outputs, so a counter or controller needs only four lines per digit. Texas Instruments describes the CD4511B as a CMOS BCD to 7 segment latch decoder driver whose bipolar outputs can source up to 25 mA, enough to drive common cathode LEDs directly through resistors.

TI lists three useful control inputs on the CD4511B: Lamp Test to light every segment, Blanking to switch the digit off or modulate brightness, and Latch Enable to store the BCD code. It also blanks the outputs for BCD inputs above 1001, so invalid codes show nothing.

FeatureCD451174LS47
Logic familyCMOS 4000 seriesTTL, low power Schottky
Display typeCommon cathodeCommon anode
Output stageSources current, active highOpen collector, active low
SupplyRated at 5, 10 and 15 V5 V
Extra inputsLamp test, blanking, latchLamp test, ripple blanking

The 74LS47 belongs to the TTL family and pulls its outputs low to light a common anode digit. Its ripple blanking inputs and outputs let you suppress leading zeros, so a four digit counter shows 25 instead of 0025.

Advertisement

Current Limiting Resistor Calculation

Each segment is an LED, so it needs a series resistor just like a single indicator LED. Last Minute Engineers uses about 2 V drop and 15 mA for a typical red segment, which gives 200 Ω at 5 V, rounded up to the standard 220 Ω value from the E12 resistor series.

R = (Vs minus Vf) ÷ If

Vs = 5 V, Vf = 2 V, If = 15 mA
R = (5 minus 2) ÷ 0.015 = 200 Ω
Next E12 value = 220 Ω
Actual If = 3 ÷ 220 = 13.6 mA
P = If² × R = 40.9 mW, so a 0.25 W part is fine
Digit 8: 7 × 13.6 = 95.5 mA on the common pin
7 Segment Resistor and Current Calculator
Result
R = 200 Ω, use 220 Ω, segment current 13.6 mA, 40.9 mW per resistor, common pin 95.5 mA

Multiplexing a 4 Digit 7 Segment Display

A four digit module shares the eight segment lines across all digits and gives each digit its own common pin. The controller lights one digit at a time and moves to the next quickly, so persistence of vision makes all four appear steady, a form of multiplexing.

1
Blank All Digits
Switch every common pin off to avoid ghosting.
2
Load Segments
Output the segment pattern for digit 1.
3
Enable Digit 1
Switch its common pin through a transistor.
4
Hold Briefly
Keep it on for a few milliseconds.
5
Move to Next Digit
Repeat for digits 2, 3 and 4.
6
Repeat Continuously
Refresh the whole display fast enough to avoid flicker.

Because each digit is on for only a quarter of the time, it looks dimmer, so designers raise the peak segment current within the LED pulse rating. The common pin can then carry close to 100 mA, so drive it through a transistor rather than straight from a microcontroller pin.

Do You Know?

The ATmega328P on an Arduino Uno has an absolute maximum of 40 mA per I/O pin. A common pin carrying 95 mA for the digit 8 would exceed it, which is why multiplexed displays always use transistor drivers.

To save pins further, the segment data can be shifted out serially with a 74HC595 shift register.

Arduino 7 Segment Display Example

For a common cathode digit, store the codes in an array such as byte d[10] = {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F}; and write each bit to the pin that drives segments a to g. For common anode, either use the inverted codes or invert each bit before writing it.

Last Minute Engineers wires segments a to g to Arduino pins 3, 2, 8, 7, 6, 4 and 5, with DP on pin 9, and uses the SevSeg library by Dean Reading. The library handles the refresh loop through setNumber() and refreshDisplay().

Quick Tip

If your 7 segment display shows strange shapes instead of digits, check the pin mapping first. A single swapped wire between segments b and f is the most common cause on breadboards.

Troubleshooting a 7 Segment Display

SymptomLikely CauseFix
Nothing lightsWrong display type or common pin openCheck CA or CC and the common wiring
All segments always onCodes inverted for the typeUse the inverted hex table
One segment deadOpen segment or wiring faultTest that LED in diode mode
Ghost digits when multiplexingNo blanking between digitsTurn all commons off before loading new data
FlickerRefresh too slowIncrease the scan rate
Dim displayResistor too large or low duty cycleRecalculate the resistor and peak current

Myths About Seven Segment Displays

Myth: Common anode and common cathode parts are interchangeable.
Fact: They need opposite logic and different decoders, so swapping one for the other without changes leaves the digit dark.
Myth: One resistor in the common line is enough.
Fact: A shared resistor makes brightness depend on how many segments are lit.
Myth: A microcontroller pin can drive a whole multiplexed digit.
Fact: The common pin current is far above a single pin rating, so use a transistor.
Advertisement

Where Seven Segment Displays Are Used

Digital Panel Meters
Voltage, current and process value indicators in control panels.
Counters and Timers
Batch counters, stopwatches and production counters.
Lift and Queue Indicators
Floor numbers and token displays in Indian offices and hospitals.
Instruments
Temperature controllers and process indicators.

In industry, the 7 segment display is common on loop powered indicators, temperature controllers and digital counters. Its high brightness and wide viewing angle still beat many small LCDs in a dusty plant.

Advantages
  • Bright and readable from a distance.
  • Simple to drive with a decoder or a few pins.
  • Low cost and widely available.
  • Works over a wide temperature range.
Limitations
  • Shows digits and only a few letters.
  • Draws more current than an LCD.
  • Needs many pins without multiplexing.
  • Multiplexing adds firmware and flicker risks.

CD4511B Decoder Datasheet PDF

PDF
CD4511B CMOS BCD to 7 Segment Latch Decoder Driver Datasheet
Texas Instruments datasheet with pinout, truth table and electrical ratings

Video on Seven Segment Display Hex Codes

7 Segment Display FAQ

How does a 7 segment display work?

It contains seven LED bars arranged in a figure eight, plus a decimal point. Lighting a chosen group of bars forms each digit from 0 to 9.

All LEDs share one common pin, which is either the anode or the cathode. A decoder IC or microcontroller switches the individual segment pins to show the required number.

What is the difference between common anode and common cathode?

In a common anode part, all LED anodes join at the common pin, which goes to the positive supply. Segments light when their pins are pulled low.

In a common cathode part, all cathodes join at the common pin, which goes to ground. Segments light when their pins are driven high, so the codes are inverted.

How do you identify common anode or common cathode?

Set the multimeter to diode test and touch the red probe to a common pin and the black probe to a segment pin. If the segment glows, the part is common anode.

If nothing lights, swap the probes and try again. A glow with the black probe on the common pin means it is common cathode.

How many pins does a 7 segment display have?

A single digit 7 segment display usually has 10 pins. Eight of them drive segments a to g and the decimal point, and two are common pins.

The two common pins, normally pins 3 and 8, are joined inside the package. Four digit modules usually have 12 pins because the segment lines are shared between digits.

Which decoder is used for a seven segment display?

The CD4511 is the usual choice for common cathode digits, and the 74LS47 suits common anode digits. Both convert a 4 bit BCD input into seven segment outputs.

The CD4511 adds a latch and blanks invalid codes above 1001. Many microcontroller projects skip the decoder completely and use a simple lookup table of hex codes in firmware instead.

What resistor should I use for a seven segment display?

Calculate it from the supply voltage minus the segment forward voltage, divided by the desired current. At 5 V with about 2 V drop and 15 mA, the result is 200 ohms.

Round up to the next standard value, which is 220 ohms. Use one resistor for every segment so that each digit shows even brightness whatever number is lit.

Why does my multiplexed display flicker?

Flicker appears when the refresh loop is too slow or is interrupted by other code such as delays. Each digit must be refreshed often enough that the eye cannot see it switching.

Avoid long delay calls in the main loop, or use a timer interrupt for the refresh. Blank all digits before loading new segment data to stop ghosting.

Advertisement

Related Articles

External References

What We Learn Today

  • A 7 segment display has seven LED bars a to g plus a decimal point, usually in a 10 pin package with two common pins.
  • Common cathode digits need high segment signals and suit the CD4511, while common anode digits need low signals and suit the 74LS47.
  • Use one resistor per segment, about 220 Ω at 5 V, and drive multiplexed common pins through transistors, never straight from a microcontroller pin.
I hope you like above blog. There is no cost associated in sharing the article in your social media. Thanks for reading!! Happy Learning!!
Sunayana Gadepatil, author at Instrumentation Blog
Author · instrumentationblog.in
Ms. Sunayana Gadepatil is an instrumentation professional, technical writer, and the author behind Instrumentation Blog. With a strong interest in industrial instrumentation, process measurement, and automation, she specializes in simplifying complex technical concepts into clear, practical, and easy to understand insights. Through her articles, Ms. Sunayana shares valuable knowledge on flow, pressure, level, temperature, control systems, and industrial automation for engineers, students, technicians, and industry professionals.
Technically reviewed on

Leave a Reply

Your email address will not be published. Required fields are marked *