In this article, we are publishing a tutorial on how to interface seven segment LED display to Arduino. Seven segment displays are used in many embedded system and industrial applications where the range of outputs to be shown is known beforehand. Basic 1 digit seven segment display can show numbers from 0-9 and a few characters. 7 segment displays are of different types; especially they differ in the number of digits/character it can display. Basically a 7 segment display is a single unit, which can display only 1 digit or 1 character. More digits are displayed by multiplexing single unit 7 segment displays together to form 2 digit display, 3 digit display or 4 digit 7 segment display. Its quiet easy to interface Arduino and 7 Segment display together! Lets begin the tutorial.
A 7 segment display has many limitations, especially in the range of characters it can display.There are displays in market which are much more advanced than seven segment displays and can display almost every character in the alphabet. For example:- a 16×2 LCD – which can display almost all ASCII characters. You might think why 7 segment display still exist in market. Well, 7 segment displays are the cheapest option when it comes to display devices available in market. A single digit/character 7 segment display unit is available at 1/10th of the cost of a 16×2 LCD module.
We begin this tutorial by interfacing a single digit (1 digit/character) 7 segment LED display to Arduino.Once we learn the single digit 7 segment display interfacing to arduino and its code/program, we move on to interface 4 digit seven segment display with arduino using shift register.
As you can see there are 10 pins in total. You may notice two pins named com, as shown in the circuit diagram all the anodes (+ pins) of the LEDs are connected to these two pins. We call these 2 pins as common anodes and such displays are called Common Anode 7 segment displays.
There are some seven segment displays which have common cathodes instead of common anodes. The only difference for common cathode displays is all the cathodes (- pins) are connected together and they are known as Common Cathode 7 segment displays. Apart from these 2 com pins, there are 8 other pins named A,B,C,D,E,F,G and DP. As you can see in the figure, these pins are cathodes (- pins) of the led segments of common anode display (in the case of common cathode display these pins will be anodes)
To turn on each segment ( LED), we have to supply appropriate voltage to it. Lets just say we want to show number “3” on the display. To display ‘3’ properly, we need to turn ON A,B,C,D & G segment LED’s (refer the figures ). since anodes are common, we supply positive voltage to common anode pins and connect GND (ground) to the segment pins we want to turn ON. If you wire like this on a breadboard. the 7 segment display will show ‘3’ on its display. But hard wiring is not practical, as we need to change the wiring all the time we want to change digit/character to be displayed. We use micro controllers like 8051 or AVR or even Arduino to solve this problem. We can manipulate the 7 segment wiring (the process of turning ON and OFF led segments) using software inside the micro controller. In our tutorial of interfacing with arduino, we achieve this by writing specific lines of arduino code to turn led segments ON and OFF
For More Details: Arduino and 7 Segment Display – Interfacing Tutorial