56
On this article, you’ll be taught 7 Section Show interfacing with Arduino Uno.
A 7-segment show has the bottom worth amongst all forms of shows. It’s broadly utilized in units that reveals numerical data.
You might have seen the 7-segment show in counter machines, fancy store banners, and so on.
To show alphabets and symbols, opting-in for LCD can be the only option.
However the truth is LCDs are costlier than LED shows. And, attributable to this purpose most individuals choose to opt-in for LED shows for primary necessities like displaying numbers.
What’s a 7-Section Show?
A 7-segment show is nothing however a pack of seven LEDs linked collectively the place every LED is named a section. All of them could be managed individually.
You is likely to be questioning how these seven LED’s are linked collectively to work as a show.
Let me clarify,
There are two 7-segment LED show configurations,
- Widespread Cathode
- Widespread Anode
(We are going to focus on these configurations later on this article.)
7-Section shows can be found in varied colours (Crimson, Blue, and Inexperienced) and sizes (0.56 to six.5 inches). Typically two to 4 7-segment shows are packed collectively to kind an enormous show (confer with following picture).
Few of the 7-segment shows has 8 LEDs. It’s within the type of a further round LED on board, as proven in following picture. The round LED signifies decimal level in numeral.

7-Section Show Varieties
Relying upon the LED anode and cathode connections 7-segment shows are divided into two varieties.
We are going to focus on these two varieties and their configurations briefly,
1. Widespread Cathode (CC)

Because the identify itself speaks lots, all cathode terminals are linked collectively, and anode terminals are left open.
To make use of this kind of 7-segment show it’s worthwhile to join cathode to GND terminal and anode to 5V provide.
2. Widespread Anode (CA)

On this configuration, all anode terminals are linked, and cathode terminals are stored open.
To activate the LED show, join anode to 5V provide and cathode to GND.
Interfacing 7-segment Show with Arduino

Every LED in 7-segment show is linked individually to GPIO pins on Arduino board.
For interfacing objective let we take into account a standard anode (CA) 7-segment show.
Because the anode is the frequent terminal right here so allow us to join it to the 5V provide on Arduino. The remaining pins can be linked to the GPIO pins on Arduino.
We can be utilizing separate wiring (confer with the connection diagram) for every LED section and activate the show in an ornate vogue.
Fact Desk for 7-Section Show
Seek advice from following Fact Desk to grasp the code logic.

Code for turning ON all of the LEDs one after the other
void setup()
{
// outline pins as an output pins
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 activate the led
for(int i=2;i<9;i++)
{
digitalWrite(i,HIGH);
delay(1000);
}
// loop to activate the led
for(int i=2;i<9;i++)
{
digitalWrite(i,LOW);
delay(1000);
}
delay(1000);
}
There are two “for” loops in above code for switching every LED section ON and OFF.
Initially, the entire pins are excessive (all LEDs will glow). After an interval, the primary “for” loop will come into motion, and every LED will begin glowing one after the other.
As soon as the cycle completes, the second “for” loop will come into motion and switch OF all of the LED segments.
You may add extra delay to see outcomes on show extra clearly.
Code for displaying digits/numbers
If you’re conversant in the arrays in C++, you’ll rapidly perceive the next code. However no worries in case you don’t.
Copy-paste the code beneath with none modification.
// make an array to save lots of Sev Seg pin configuration of numbers
int num_array[10][7] = { { 1,1,1,1,1,1,0 }, // 0
{ 0,1,1,0,0,0,0 }, // 1
{ 1,1,0,1,1,0,1 }, // 2
{ 1,1,1,1,0,0,1 }, // 3
{ 0,1,1,0,0,1,1 }, // 4
{ 1,0,1,1,0,1,1 }, // 5
{ 1,0,1,1,1,1,1 }, // 6
{ 1,1,1,0,0,0,0 }, // 7
{ 1,1,1,1,1,1,1 }, // 8
{ 1,1,1,0,0,1,1 }}; // 9
//perform header
void Num_Write(int);
void setup()
{
// set 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()
{
//counter loop
for (int counter = 10; counter > 0; --counter)
{
delay(1000);
Num_Write(counter-1);
}
delay(3000);
}
// this capabilities writes values to the sev seg pins
void Num_Write(int quantity)
{
int pin= 2;
for (int j=0; j < 7; j++) {
digitalWrite(pin, num_array[number][j]);
pin++;
}
}
Conclusion
So that’s it. If you’re doing this mission then don’t overlook to return again and share your 7-segment LED mission with us.
It is a superb Arduino based mostly mission for newbies. One may use the 7-segment show in tasks that have to show numbers.
Thanks for studying until the top. If in case you have any doubts, then ask me. I can be glad that will help you out.