How to interface Arduino with Seven Segment Display

In this arduino interfacing project, you will be learning how to use a seven segment display using Arduino UNO. The main aim is to design a 0 to 9 counter with a 7 segment, Arduino UNO and 74595 shift register.

arduino with seven segment display

Components Required

  • Arduino.UNO
  • Connecting wires: 8 No.
  • 7 segment display (common cathode).
  • 100 ohm resistor-7no.
  • 74595 shift register.
  • USB Cable.

Component Description

Seven segment displays consists of seven LEDs arranged in rectangular fashion. Each LED is known as segment. It displays numeric digits which can be HEX or decimal. The LEDs are labelled from a to g. Other LEDs are connected and wired together to form a common pin. Proper forward biasing of the LEDs, will allow some LEDs to light and others in dark displaying the desired character pattern of the number to be generated on the display.

Pinout of 7 segment display

pinout of seven segment

There are two types of seven segment displays - Common cathode and Common Anode.  The difference in the displays are that in common cathode displays all the cathodes of the seven segments are connected directly together and all the anodes of the seven segments are connected in the common anodes.

Common Cathode (CC) – In the common cathode display, all the cathode connections of the LED segments are joined together to logic “0” or ground. The individual segments are illuminated by application of a “HIGH”, or logic “1” signal via a current limiting resistor to forward bias the individual Anode terminals (a-g).

                                   COMMON CATHODE

Common Anode (CA) – In the common anode display, all the anode connections of the LED segments are joined together to logic “1”. The individual segments are illuminated by applying a ground, logic “0” or “LOW” signal via a suitable current limiting resistor to the Cathode of the particular segment (a-g).

                                   COMMON ANODE

Depending upon the decimal digit to be displayed, the particular set of LEDs is forward biased. To display digit 0, light up six of the LED segments corresponding to a, b, c, d, e and f. The various digits from 0 through 9 can be displayed using a 7-segment display as shown below.

                DISPLAY

  • 74HC595N Shift register

Shift register IC, 74HC595N converts serial data to parallel data. The IC is used here to minimize the use of digital pins of arduino for controlling the seven segment display.

Pinout and functions

74hc595

Connection

  • Connect Shift Register and Arduino

SHIFT REGISTER

ARDUINO

SER

D2

SCK

D3

SCL

VCC

RCK

D4

GROUND

GROUND

  • Connecting Shift Register and seven segment display

SHIFT REGISTER

SEVEN SEGMENT DISPLAY

QA

7-A

QB

6-B

QC

4-C

QD

2-D

QE

1-E

QF

9-F

QG

10-G

QH

5-DP

Program

Inorder to display 0 to 9 using a 7 segment common cathode display, LED segments which have to be illuminated must be made HIGH while others are kept at LOW.  For example, inorder to display ‘0’; abcdef must be made high and g is kept at low. Now, the hex value of ‘0’ will be 3F. As shown in the truth table below, each of the hex value must be loaded to the shift register to display digits from 0 to 9.

dp

g

f

e

d

c

b

a

Hex value

0

0

1

1

1

1

1

1

0x3F

0

0

0

0

0

1

1

0

0X06

0

1

0

1

1

0

1

1

0x5B

0

1

0

0

1

1

1

1

0x4F

0

1

1

0

0

1

1

0

0x66

0

1

1

0

1

1

0

1

0x6D

0

1

1

1

1

1

0

1

0x7D

0

0

0

0

0

1

1

1

0x07

0

1

1

1

1

1

1

1

0x7F

0

1

1

0

1

1

1

1

0x6

 

Program file is attached as PDF below....................

Related Items