Skip to content

LED Seven-Segment Display

Updated: 6/28/2025 Words: 0 words Reading time: 0 minutes

In the previous section, we learned how to control LED strips to produce different colors and effects. In this section, we will learn how to use LED seven-segment displays to form different numbers.

Preparation

Hardware

HardwareDescriptionImage
Creative Box PlatformMy Image
Seven-Segment Display ModuleCreative Box Official ModuleMy Image

Software

SoftwareLinkDescription
Score Board SystemLinkOfficial frontend application, can be directly loaded and used through the console.

Video Tutorial

Seven-Segment Display

Connection

My Image
Connection
Connect the first seven-segment display module to any pin header on the platform, here using platform pins 16-19
Connect the second seven-segment display module to any pin header on the platform, here using platform pins 8-11

Usage

Open the Creative Box console and load the scoreboard application from the lighting category. Enter the application, select the connection pin numbers for the home team and away team seven-segment displays with the Creative Box. Click the corresponding scoring options. You can see the seven-segment displays showing the scores of the home team and away team.

Creative Box ConsoleLoad ApplicationSelect Pin Numbers and Control

Principle

Datasheet DownloadLink
Seven-Segment DisplayLink
Shift RegisterLink

Seven-Segment Display

A seven-segment display is a commonly used digital display device consisting of seven LEDs arranged in the shape of the number "8". Each LED represents a segment in the digit, and by turning these LEDs on or off, numbers from 0 to 9 can be displayed. Additionally, there is a dot-shaped LED in the bottom right corner of the seven-segment display. When two or more displays are connected together, this dot can represent a decimal point (DP).

My Image

Each LED has its own separate pin. Simply applying power to the corresponding pin will light up the respective LED segment. Different combinations of LED segments form different numbers.

My Image

Like RGB LEDs, seven-segment displays are divided into common anode and common cathode types. In common anode displays, all LED anodes are connected together, while cathodes are connected to individual digit segments. In common cathode displays, all LED cathodes are connected together, while anodes are connected to individual digit segments. The diagram below shows the circuit diagram of a common anode seven-segment display:

My Image

By controlling the lighting and extinguishing of each segment, we can flexibly display various numbers, letters, and symbols. Seven-segment displays can be seen in many electronic devices, such as clocks, counters, thermometers, etc. They provide a simple and intuitive way to display digital information.

Shift Register

A seven-segment display has eight LEDs, and we can assign one GPIO to each LED to control any LED. However, if we want to control multiple displays, this method would make the circuit very cumbersome. In this case, we need to use shift registers.

A shift register is a digital circuit component used to "move" data from input to output under the control of clock pulses. Shift registers have wide applications in digital systems, such as data storage, data transmission, display control, sequence generation, etc.

My Image

A shift register consists of several single-bit "D-type data latches", where each data bit can be logic "0" or "1", connected in series so that the output of one data latch becomes the input of the next latch, and so on. The number of data latches in a single shift register is usually determined by the number of bits to be stored, with the most common being 8-bit (one byte) wide, consisting of eight individual data latches.

My Image

Shift registers have four different operating modes, where the basic movement of data in the shift register includes:

  1. Serial Input Parallel Output (SIPO) - The shift register loads data serially bit by bit and outputs the stored data in parallel form.
  2. Serial Input Serial Output (SISO) - Data is serially "input" and "output" bit by bit in the shift register, shifting left or right one bit at a time under clock control.
  3. Parallel Input Serial Output (PISO) - Parallel data is loaded into the shift register simultaneously and output serially bit by bit under clock control.
  4. Parallel Input Parallel Output (PIPO) - Parallel data is loaded into the shift register simultaneously and transmitted to their respective outputs together under the same clock pulse.

Serial Input Parallel Output Shift Register

To control multiple LEDs with fewer GPIOs, we need to select a serial input parallel output shift register. Serial input means only one GPIO input signal is needed; parallel output means multiple LEDs can be lit simultaneously.

Taking the 4-bit serial input parallel output shift register in the diagram below as an example:

My Image

If logic high "1" is connected to the DATA input pin of FFA, then at the first clock pulse, the output of FFA and therefore the output of QA will be set to logic high "1", while all other outputs remain at logic low "0". Now assume the DATA input pin of FFA returns to logic low "0" again, giving us a data pulse or 0-1-0.

My Image

As clock pulses continue to be generated, the signal "1" continuously passes through the latches. When the fourth clock pulse arrives, the complete data value 0-0-0-1 is stored in the register. At this time, data can be read synchronously from the outputs QA to QD.

The table below shows the values of each latch at different clock pulses. At the fifth clock pulse, all outputs are at logic low "0" because the input remains at logic low "0".

Clock PulseQAQBQCQD
00000
11000
20100
30010
40001
50000

74HC595 Shift Register

To control 8 LEDs simultaneously, we need an 8-bit serial input parallel output shift register. The schematic diagram shown below is the 74HC595 shift register we are using:

My Image

The function of each pin of the 74HC595:

  • OE: Output enable pin, allows signal output when pulled low.
  • RCLK: Signal output control pin, outputs parallel signal when pulled high.
  • SRCLR: Register clear.
  • SRCLK: Clock pulse signal.
  • SER: Serial input signal.

Although the 74HC595 still requires 5 pins to control one seven-segment display, which seems not much different from traditional methods. However, if we have multiple displays, different registers can share the other four GPIOs except SER. For example, controlling three displays traditionally requires 24 GPIOs, while using shift registers only requires 7 GPIOs, greatly simplifying the circuit.

Next, we just need to understand which LEDs to light for different numbers, then transmit this 8-bit signal in parallel to the display to show specific numbers.

Truth Table

For seven-segment displays, we can create a truth table listing the various segments that need to be lit to produce decimal numbers from 0 to 9, as shown below:

My Image
Numberabcdefg
01111110
10110000
21101101
31111001
40110011
51011011
61011111
71110000
81111111
91111011