Interface A Seven Segment Display To An Arduino
Interface A Seven Segment Display To An Arduino
Display to an Arduino
For many applications, there's no need to use a more
expensive liquid crystal display to display data. A simple
seven-segment display is sufficient.
If your Arduino application only needs to display numbers, consider using a seven-
segment display. The severn-segment display has seven LEDs arranged in the shape
of number eight. They are easy to use and cost effective. The picture below shows a
typical seven-segment display.
Seven segment displays are of two types: common anode and common cathode.
The Internal structure of both types is nearly the same. The difference is the polarity
of the LEDs and common terminal.
The common anode display is the exact opposite. In a common-anode display, the
positive terminal of all the eight LEDs are connected together and then connected to
pin 3 and pin 8. To turn on an individual segment, you ground one of the pins. The
following diagram shows the internal structure of the common-anode seven-segment
display.
The seven segment are labelled a-g, with the dot being "dp," as shown in the figure
below:
To display a particular number, you turn on the individual segments as shown in the
table below:
Experiment 1
In this experiment, we will simply turn on and turn off the LEDs to get familiar with
how a seven-segment display works.
Hardware Required
1 x seven segment display (common cathode)
1 x Arduino UNO
1 x breadboard
jumper wires
Wiring Diagram
In this circuit, the pins of seven-segment display are connected to Arduino pins 2-9,
as shown in the table below. Common pins (pin 3 and pin 8) are connected to GND
and dp is left unconnected, because it is not used in this experiment
1(e) 6 orange
2(d) 5 white
c 4 yellow
5(dp) -
6(b) 3 red
7(a) 2 blue
9(f) 7 cyan
10(g) 8 green
Circuit:
Code:
Experiment 2
Description
In this tutorial, we will be interfacing a seven segment display with Arduino mega and
learn to display a count down from nine with a delay of a second, on seven segment
display.