Seven Segment Display

Seven Segment display is a digital display built with LEDs that can display a digit or a character using its seven-segment led divisions. Seven segment display is useful in different applications such as making counters, timers, watches, washing machines, etc.

Add image here..

A seven-segment led display is useful because, because of its simplicity and low power consumption and is very easy to use. It can draw its power from the circuit board into which it is connected, and so a different LED driver may not be required in small applications.

Types of Seven-Segment-Display

There are two different types of Seven Segment Displays :

  • Common Anode : In the common Anode display, the anodes of all the LEDs in the display, are connected through a single wire, which is common. And the cathodes are individual pins into which the positive terminal of the power source can be connected to make a particular LED on(active).
  • Common Cathode : In the common Cathode display, all the cathodes of the LEDs in the display, are connected through a single wire which is common. And the anodes are individual pins into which the positive terminal of the power source can be connected to make a particular LED on(active).

arduino-seven-segment-display-demo-numbers

Application of Seven Segment Displays

There is an infinite number of applications of seven-segment displays. They are:

  • Counters : This kind of display can be used as a counter, as they can display numbers from 1 to 9.
  • Lifts : This can also be used in lifts when the floor numbers can be displayed which are usually in a single digit.
  • Washing Machines : In washing machines, there are counters which are used to display either the state or the time elapsed. Not only in washing machines, but in several different machines, these kinds of displays are used.
  • Automated Machines : There are several industrial machines where there are certain tasks that are automated and should be initiated after few seconds elapsed.

Seven Segment Display with Arduino

A seven-segment display can be used without an Arduino also. There can be different circuits that can be made to work with the seven-segment display.

We shall see how to connect a seven-segment display with Arduino and display digits from 0 to 9. After that, you can apply the seven-segment display in different small and high-level projects.

Component Required :
  • Arduino UNO.
  • Seven Segment Display
  • Jumper Wires.
Connecting the seven-segment display into the Arduino

arduino-seven-segment-display-interfacing

Now edit the following code into the Arduino Editor :

int a=7; //definition digital 7  pins as pin to control 'a' section(segment)
int b=6; //definition digital 6  pins as pin to control 'b' section(segment)
int c=4; //definition digital 4  pins as pin to control 'c' section(segment)
int d=11;//definition digital 11 pins as pin to control 'd' section(segment)
int e=10;//definition digital 10 pins as pin to control 'e' section(segment)
int f=8; //definition digital 8  pins as pin to control 'f' section(segment)
int g=9; //definition digital 9  pins as pin to control 'g' section(segment)
int dp=5; //definition digital 5  pins as pin to control 'dp' section(segment)
void digital_0(void) //Segment display digital 0
{
  digitalWrite(a,HIGH);
  digitalWrite(b,HIGH);
  digitalWrite(c,HIGH);
  digitalWrite(d,HIGH);
  digitalWrite(e,HIGH);
  digitalWrite(f,HIGH);
  digitalWrite(g, LOW);
  digitalWrite(dp,LOW);
}
void digital_1(void) //Segment display digital 1
{
  digitalWrite(a,LOW);
  digitalWrite(b,HIGH);
  digitalWrite(c,HIGH);
  digitalWrite(d,LOW);
  digitalWrite(e,LOW);
  digitalWrite(f,LOW);
  digitalWrite(g,LOW);
  digitalWrite(dp,LOW);
}
void digital_2(void) //Segment display digital 2
{
  digitalWrite(a,HIGH);
  digitalWrite(b,HIGH);
  digitalWrite(c,LOW);
  digitalWrite(d,HIGH);
  digitalWrite(e,HIGH);
  digitalWrite(f,LOW);
  digitalWrite(g,HIGH);
  digitalWrite(dp,LOW);
}
void digital_3(void) //Segment display digital 3
{
  digitalWrite(a,HIGH);
  digitalWrite(b,HIGH);
  digitalWrite(c,HIGH);
  digitalWrite(d,HIGH);
  digitalWrite(e,LOW);
  digitalWrite(f,LOW);
  digitalWrite(g,HIGH);
  digitalWrite(dp,LOW);
}
void digital_4(void) //Segment display digital 4
{
  digitalWrite(a,LOW);
  digitalWrite(b,HIGH);
  digitalWrite(c,HIGH);
  digitalWrite(d,LOW);
  digitalWrite(e,LOW);
  digitalWrite(f,HIGH);
  digitalWrite(g,HIGH);
  digitalWrite(dp,LOW);
}
void digital_5(void) //Segment display digital 5
{
  digitalWrite(a,HIGH);
  digitalWrite(b,LOW);
  digitalWrite(c,HIGH);
  digitalWrite(d,HIGH);
  digitalWrite(e,LOW);
  digitalWrite(f,HIGH);
  digitalWrite(g,HIGH);
  digitalWrite(dp,LOW);
}
void digital_6(void) //Segment display digital 6
{
  digitalWrite(a,HIGH);
  digitalWrite(b,LOW);  
  digitalWrite(c,HIGH);
  digitalWrite(d,HIGH);
  digitalWrite(e,HIGH);
  digitalWrite(f,HIGH);
  digitalWrite(g,HIGH);
  digitalWrite(dp,LOW);
}
void digital_7(void) //Segment display digital 7
{
  digitalWrite(a,HIGH);
  digitalWrite(b,HIGH);  
  digitalWrite(c,HIGH);  
  digitalWrite(d,LOW); 
  digitalWrite(e,LOW);
  digitalWrite(f,LOW);
  digitalWrite(g,LOW);
  digitalWrite(dp,LOW);
}
void digital_8(void) //Segment display digital 8
{
  digitalWrite(a,HIGH);
  digitalWrite(b,HIGH);
  digitalWrite(c,HIGH);
  digitalWrite(d,HIGH);
  digitalWrite(e,HIGH);
  digitalWrite(f,HIGH);
  digitalWrite(g,HIGH);
  digitalWrite(dp,LOW);
}
void digital_9(void) //Segment display digital 9
{
  digitalWrite(a,HIGH);
  digitalWrite(b,HIGH);
  digitalWrite(c,HIGH);
  digitalWrite(d,HIGH);
  digitalWrite(e,LOW);
  digitalWrite(f,HIGH);
  digitalWrite(g,HIGH);
  digitalWrite(dp,LOW);
}
void setup()
{
  int i;             //Define variables
  for(i=4;i<=11;i++)
  pinMode(i,OUTPUT); //Set up 4 ~ 11 pins to output mode
}
void loop()
{
  digital_0(); //Segment display digital 0
  delay(1000); //Delay 1s
  digital_1(); //Segment display digital 1
  delay(1000); //Delay 1s
  digital_2(); //Segment display digital 2
  delay(1000); //Delay 1s
  digital_3(); //Segment display digital 3
  delay(1000); //Delay 1s
  digital_4(); //Segment display digital 4
  delay(1000); //Delay 1s
  digital_5(); //Segment display digital 5
  delay(1000); //Delay 1s
  digital_6(); //Segment display digital 6
  delay(1000); //