Firstly we will understand what is seven segment and how it works. Then we will learn the interfacing part in more easier way.
The seven segments displays are the oldest yet one of the efficient types of display used in embedded applications. This display has nothing more than 8 LED inside it. Each of the seven LEDs is called a segment because when illuminated the segment forms part of a numerical digit (both Decimal and Hex) to be displayed and sometimes an additional 8th LED is used within the same package thus allowing the indication of a DP(decimal point) as shown in the picture.
These entire 8 segment LEDs have one end of their pins pulled out of the module and the other ends are connected together and pulled out as the Common pin. So to make an LED of a particular segment glow we just have to power common pin along with the segment pin. This way we can power more than one segment at a time to represent the numeric number 0-9 and also few Alphabets as shown on the graphic image below.
The displays common pin is generally used to identify which type of 7-segment display it is. As each LED has two connecting pins, one called the “Anode” and the other called the “Cathode”, there are therefore two types of LED 7-segment display called: Common Cathode (CC) and Common Anode (CA).These are available in common Cathode and common Anode modes. The difference between the two displays, as their name suggests, is that the common cathode has all the cathodes of the 7-segments connected directly together and the common anode has all the anodes of the 7-segments connected together.
7-Segment Display Interfacing with Arduino Uno
Components Required:
Arduino Uno with USB cable
7 segment display (Common Anode)
Jumper wires (Male to Male (12))
Breadboard
Pushbutton
1K Ohm resistor
Segment display wiring diagrams for the Arduino
Steps: -
Insert the 7 segment display into the Breadboard
Connect the –ve rail of the breadboard to the ground of the Arduino
Connect the +ve rail of the breadboard to the +5v of the Arduino
Connect the 7th pin of the display to the Digital pin 1
Connect the 6th pin of the display to the Digital pin 2
Connect the 4th pin of the display to the Digital pin 3
Connect the 2nd pin of the display to the Digital pin 4
Connect the 1st pin of the display to the Digital pin 5
Connect the 10th pin of the display to the Digital pin 6
Connect the 9th pin of the display to the Digital pin 7
Connect pin 3 and 8 of display to +ve rail of the breadboard
Coding part for the interfacing
Steps: - Open the Arduino IDE and click on File and the click on New to create a new empty file
Define the Pin Mode in the void Setup
Define the logic in the void Loop
Functions used in this example:
pinMode(Pin_Number, IN/OUT); to set the mode i.e. input or output for example pinMode(3,OUTPUT);
digitalWrite(Pin_Number,LOW/HIGH); to set the pin as High or low for example digitalWrite(3,LOW);
delay(microseconds) to put a time delay between two instructions. For example delay(1000) i.e. 1 sec delay
Comments