This tutorial will guide you all about seven segment display, how it works, and how to interface with any microcontroller and make some cool projects.
If you are a beginner in electronics, I will suggest you read working principle of seven segment display first, before jumping into code and example directly.
Seven Segment display comes in different form factor.
- Single Digit Seven Segment Display
- Multi Digit Seven Segment Display
It purely depends upon your requirement, how many digits you want to display in your project or product using seven segment displays.
Few think Seven Segment display are obsolete now days, No you heard it wrong, Seven Segment Display have more benefits over LCD or LED display.
Here are few points, why seven segment still a good choice:
- Seven Segment Looks are big and eye catching
- They Draw Less power
- Seven Segment are cheap
- Bright in color so can be noticed from distance.
- Longevity of seven segment display are more than LCD and Needs less maintenance.
How Seven Segment Display Works?
If you will look at below figure, you can see there are seven( A, B, C, D, E, F, G ) bar excluding DP. Each Bar is called one segment, and combining all seven bar , we call it seven segment display.
Behind Each bar, there is one LED(Light Emitting diode), As you can see in below Figure, Anode of All LED are connected to a common terminal and Cathode of all led are named as A, B, C and So on.
So When you Connect voltage source to Anode and Give Ground to B and C, then LED B and C will light up, which will Look like Decimal “1” in the display, Like shown in below figure.
Similarly, If If you will ground A, B, C , D and Give Voltage at common anode terminal then it will become 3. This is how Voltage Divider works.
Interfacing with Microcontroller / Arduino :
There are many ways you can interface seven segment Display with a microcontroller.
- Single digit
- Using BCD to Seven Segment Decoder
- Using Multiplexing Method
Interfacing single digit seven segment displays with microcontroller is fairly very simple. You just have to interface.
You just have to connect common point to voltage source (If it is common anode seven segment display) or to GND (If it is common cathode Seven segment Display). Then you have to connect all other points to GPIO of microcontroller or Arduino and Write Simple Code. To turn on LED of seven segment.
That is simple right? I assume, You can write simple code to turn on seven segment display and display characters. (Do let me know in comment section below, If you still have doubt.)
Using BCD to Seven Segment Decoder:
When you have less GPIO in a microcontroller, and you still have to use seven segment display, then you have to use BCD to Seven Segment Decoder IC. What this IC will do is, it will take 4 digital input and convert it into 7 digital output. Like you can see in below image.
There are many companies who make this BCD to seven segments Decoder IC.
- SN5446A From Texas Instrument Datasheet
Using Multiplexing Method:
Sometimes you have connect lot of seven segment display in some big project and you always of less GPIO left in a microcontroller, in that case you have to use only 8 pins to connect all seven segment display, which can be possible using multiplexing.
How multiplexing, Works?
In case of multiplexing you have to connect all seven segments parallelly. Like shown in below image. As you can see all seven segment data pins that is a, v, c, d, e, f, g are connected to same GPIO pins.
(The above image is copied from a this link >> http://hackyourmind.org/articles/2013/06/07/raspberry-pi-with-7-segment-display.html)
Then when you have to turn on any particular seven segment, then you have to turn it on using transistor and GPIO 22 or GPIO 21 or so on.
This switching of transistor works so fast that, it looks like all number are being displayed at same time.
Hope you like this tutorials, I will suggest you to now just start implementing your first seven segment using any microcontroller, if you have any doubt regarding coding or any other thing , do let me ask in the comment section below.
I will upload one tutorial soon with code on our youtube channel, don’t forget to subscribe and stay tune via our Facebook channel. Happy Learning. 🙂