7 Segment Display 

 

If your Arduino application only needs to display numbers, consider using a seven-segment display. The seven-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. In a common cathode seven-segment display (the one we used in the experiments), all seven LEDs plus a dot LED have the cathodes connected to pins 3 and pin 8. To use this display, we need to connect GROUND to pin 3 and pin 8 and, and connect +5V to the other pins to make the individual segments light up. The following diagram shows the internal structure of common-cathode seven-segment display:  

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:

Digit    gfedcba

abcdefg

a

b

c

d

e

f

g

0             0×3F

0×7E

on

on

on

on

on

on

off

1             0×06

0×30

off

on

on

off

off

off

off

2             0×5B

0×6D

on

on

off

on

on

off

on

 

3             0×4F

0×79

on

on

on

on

off

off

on

4             0×66

0×33

off

on

on

off

off

on

on

5             0×6D

0×5B

on

off

on

on

off

on

on

6             0×7D

0×5F

on

off

on

on

on

on

on

7             0×07

0×70

on

on

on

off

off

off

off

8             0×7F

0×7F

on

on

on

on

on

on

on

9             0×6F

0×7B

on

on

on

on

off

on

on

A             0×77

0×77

on

on

on

off

on

on

on

B             0×7C

0×1F

off

off

on

on

on

on

on

C             0×39

0×4E

on

off

off

on

on

on

off

D             0×5E

0×3D

off

on

on

on

on

off

on

E             0×79

0×4F

on

off

off

on

on

on

on

F             0×71

0×47

on

off

off

off

on

on

on

 

Interfacing with Arduino

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    

 

Seven segment pins

Arduino pins

Wire Color

1(e)

6

orange

2(d)

5

white

3,8(COM)

GND

n/a

c

4

yellow

5(dp)

6(b)

3

red

7(a)

2

blue

9(f)

7

cyan

10(g)

8

green

Code

void setup()

{

  // define pin modes

 

 pinMode(2,OUTPUT);

 pinMode(3,OUTPUT);

 pinMode(4,OUTPUT);

 pinMode(5,OUTPUT);

 pinMode(6,OUTPUT);

 pinMode(7,OUTPUT);

 pinMode(8,OUTPUT);

 

}

 

void loop()

{

  // loop to turn leds od seven seg ON

 

  for(int i=2;i<9;i++)

  {

    digitalWrite(i,HIGH);

    delay(600);

  }

 

  // loop to turn leds od seven seg OFF

  for(int i=2;i<9;i++)

  {

    digitalWrite(i,LOW);

    delay(600);

  }

 

 

  delay(1000);

 

}

 

Applications of Seven Segment Displays

  • The applications of seven segments are mostly in digital calculators, electronic meters, digital clocks, odometers, digital clocks, clock radios, etc.
  • Today most of the 7 segment applications are using LCDs, because of low current consumption.

 

Reference:

https://www.allaboutcircuits.com/projects/interface-a-seven-segment-display-to-an-arduino/

https://circuitdigest.com/microcontroller-projects/7-segment-display-interfacing-with-arduino

https://create.arduino.cc/projecthub/SAnwandter1/programming-4-digit-7-segment-led-display-2d33f8

https://www.circuitbasics.com/arduino-7-segment-display-tutorial/