I’ve been working on a digital clock project so I thought I will get 4 units of 7-segment displays and put all of them on a PCB to show the time. When I was at the electronics store, I stumbled upon this.
I bought this because it has 5 digits on a single package and it looks much neater than the individual 7 segment displays.
The reason why I wrote this post is not so much to show the display but rather to highlight a technique called multiplexing.
I will start by showing you the pins of this 5 digit display.
In a single digit 7-segment display, there are 8 connections, the 7 individual connections for the 7 LEDs and also one ground connection (for common-cathode type). But does that mean if we have 5 digits we need to use 40 pins? (5 digits x 8 connections)
From the picture above you can see that this 5 digit display only has 22 pins, and even then, not all are used for the 5 digits. Some are for the decimal points and the colon. In fact for the 5 digits, we only need 12 pins. How do we make it work?
This is a pinout diagram that I’ve drawn out myself (I can’t find any information about this particular display on the Internet).
There are only 7 pins which controls the 7 segments on ALL of the digits but at any one time these 7 pins can only control a single digit. To decide which digits to control, we use the top right-most pins, sending a low on one these pins means selecting that particular digit to be controlled. Sounds confusing?
Let me try again. In simple words, we can only change or display one digit at a time. But with the sheer speed of microcontrollers, we can display each digits one after another so quickly that the human eye can’t notice and will appear as if all digits are on at the same time. This method is called multiplexing.
I’ll probably do a video soon to explain more about multiplexing and how it works but for the meantime here’s a demonstration on making the display show all 5 digits at the same time.
It’s been a long time since I used a PIC microcontroller.
And the 5 digit 7-segment display. Only 14 connections used.
Finally, the code which made it all work.
I used 1ms of delay to display each digit and that is fast enough to fool the human’s eye. Any faster than that will cause distortion and any slower than that will cause the digits to flicker.
The whole circuit in action. The display is actually adequately bright but the camera didn’t really do it justice.
A dark shot.
Now I’m off to write an assembly code to interface with the DS1307 Real Time Clock IC. Stay tuned