Arduino/C2/Seven-Segment-Display/English
Title of script: Seven Segment Display
Author: Nirmala Venkat
Keywords: Arduino UNO board, Arduino IDE, Compile and upload, Seven Segment Display, Video tutorials
Visual Cue | Narration |
Slide 1:
|
Welcome to the Spoken Tutorial on Seven Segment Display. |
Slide 2:
Learning objectives |
In this tutorial, we will learn to:
|
Slide 3:
Pre-requisites |
To follow this tutorial, you should have basic knowledge of:
|
Slide 4:
System Requirement |
To record this tutorial, I am using:
|
Slide 5:
External Devices |
We will also require some external devices such as:
|
Show the image:
Seven-segment display |
[[Image:]] |
Slide:6
Seven Segment Display |
The seven-segment display has seven LEDs arranged in the shape of the digit eight.
|
Point to the diagram | In the common cathode seven-segment display, pins a, b, c, d, e, f, g and dot must be connected to +5V.
The two COM pins must be connected to ground (GND).
|
Point to the diagram | The common anode seven-segment display is the exact opposite.
Here pins a, b, c, d, e, f, g and dot must be connected to GND and the two COM pins must be connected to +5V. |
Now let us see the connection circuit details. | |
Show the image:
|
In this experiment, we will be using the common cathode seven-segment display. |
Point to the image according to narration. | Pins a, b, c, d, e, f and g of the seven-segment display are connected to pins 2, 3, 4, 5, 6, 8 and 9 of Arduino,respectively.
Note that we didn't connect to pin 7. The two common (COM) pins are connected to the ground through the resistors. This is shown here in the black color wire. The resistor value should be greater than 220 ohms. Dot is left unconnected because it is not used in this experiment. |
Show the real connection | This is the live setup of the connection, as shown in the circuit diagram. |
Switch to Arduino IDE | Now we will write a program in the Arduino IDE.
So let’s switch to the Arduino IDE. |
First we will write a program to blink the LEDs in the seven segment display. | |
// To blink the LEDs on SSD
#define b 3// connecting segment b to PIN3 #define c 4// connecting segment c to PIN4 #define d 5// connecting segment d to PIN5 #define e 6// connecting segment e to PIN6 #define f 8// connecting segment f to PIN8 #define g 9// connecting segment g to PIN9
|
Type the code shown here.
This code is available in the code file link of this tutorial for your convenience. You can download and use it. |
void setup()
{ pinMode(a, OUTPUT); pinMode(b, OUTPUT); pinMode(c, OUTPUT); pinMode(d, OUTPUT); pinMode(e, OUTPUT); pinMode(f, OUTPUT); pinMode(g, OUTPUT); } |
In the void setup function, we will use the function pinMode to configure the pin to output mode. |
void loop()
{ digitalWrite(a,HIGH); digitalWrite(b,HIGH); digitalWrite(c,HIGH); digitalWrite(d,HIGH); digitalWrite(e,HIGH); digitalWrite(f,HIGH); digitalWrite(g,HIGH); delay(1000); digitalWrite(a,LOW); digitalWrite(b,LOW); digitalWrite(c,LOW); digitalWrite(d,LOW); digitalWrite(e,LOW); digitalWrite(f,LOW); digitalWrite(g,LOW); delay(1000); }
|
Now we will write the code for void loop.
|
Click on compile and upload button on the toolbar | We will now compile and upload the program. |
Point to the output in the video
|
Now we can see that all the LEDs in the seven segment are glowing. |
Next, we will modify the program to display some digits. | |
Show the slide:
[[Image:]] |
Say, we want to display the digit zero.
The LEDs of segment 'g' should be low and all other LED segments should be high.
|
Switch back to Arduino IDE. | Let us switch back to the Arduino IDE. |
Copy and paste the code to display 0 to 4
void loop() { //ZERO digitalWrite(a,HIGH); digitalWrite(b,HIGH); digitalWrite(c,HIGH); digitalWrite(d,HIGH); digitalWrite(e,HIGH); digitalWrite(f,HIGH); digitalWrite(g,LOW); delay(1000); //ONE digitalWrite(a,LOW); digitalWrite(b,HIGH); digitalWrite(c,HIGH); digitalWrite(d,LOW); digitalWrite(e,LOW); digitalWrite(f,LOW); digitalWrite(g,LOW); delay(1000); |
Change the code in the void loop function, as shown here.
|
Click on compile and upload button on the tool bar | Let us now compile and upload the program. |
Show the output in the video | You can see that the digits 0 to 4 are displayed, with a delay of 1 second between them. |
This brings us to the end of this tutorial. Let us summarize. | |
Slide 11:
Summary |
In this tutorial, we learnt to
|
Slide 12:
Assignment |
Try doing the following assignment.
|
Slide 13:
About Spoken Tutorial project
|
The video at the following link summarizes the Spoken Tutorial project.
Please download and watch it. |
Slide 14:
Spoken Tutorial workshops |
The Spoken Tutorial Project Team:
For more details, please write to us. |
Slide 15:
Forum for specific questions |
Please post your timed queries in this forum. |
Slide 16:
Acknowledgement
|
Spoken Tutorial project is funded by NMEICT, MHRD, Government of India.
More information on this mission is available at this link. |
This tutorial has been contributed by Spoken Tutorial Project, IIT Bombay.
Thanks for watching. |