Controlling a 7-Segment LED Display

In this project, you'll learn how to connect and control a 7-segment LED display to show the numbers from 0 to 9.

Parts needed:
  • Arduino
  • 7-Segment LED Display
  • A 150 Ω resistor (brown-green-brown)
  • Wires
  • Breadboard
Arduino      7-Segment LED display      7-Segment LED display      Breadboard      150 ohm resistor
A 7-segment LED display is a display with seven individual LEDs built inside one package. The seven LEDs form a figure 8 and are given the alphabetical names from a to g. There is an eighth LED for the decimal point. With this configuration, decimal digits can be formed by turning on the individual LEDs.

               7-segment display segments
7-segment display digits
Since each LED requires a positive and a negative connection, a total of 16 connections for the eight LEDs (seven forming the figure 8 plus the decimal point) would be required.

In order to reduce the number of connections needed, either the positive or the negative ends for all of the LEDs are connected in common.

If all the negative ends are connected together, it is referred to as common cathode, and if all the positive ends are connected together, it is referred to as common anode.

Using a common cathode or common anode, only 9 connections are needed instead of the original 16 to control the 7-segment display.
               Common Cathode

7-segment display common cathode

                  Common Anode
7-segment display common anode
1 Making the connections

Different 7-segment displays have different pin connections. Choose the one that matches your 7-segment display.

Common Cathode with pins on the sides

7-Segment LED display    7-segment display common cathode pins

Make the following 9 connections:
Arduino pins 7-segment pins Description
1 1 g
2 2 f
GND 3 to 150 Ω GND
4 4 e
5 5 d
6 6 DP
7 7 c
8
9 9 b
10 10 a
common cathode connections
2 Create a new Bare Minimum program by selecting File from the menu
  • then select Examples
  • then select Basics
  • then select BareMinimum
Type in this program to turn on segments b and c.  























For a Common Cathode display, a HIGH signal turns on the LED, and a LOW signal turns off the LED.
7-segment program
3 Upload and run the program. You should see the digit 1.