Introduction: Arduino + Serial 7 Segments Display
Although 7 segments displays may look like outdated, there still are several applications in which the best option for showing information is using them, since they can be seen from considerable distances and are really bright, considering situations with lack of ilumination.
For this reason in this instructable I wanna share a simple circuit I have designed in order to allow a microcontroller to communicate with my 7 - segments display array in a serial way, in which only two pins are enough to estabilish the commmunication, the CLOCK one and the DATA one, plus the pins to enable each display of the array, since it is an array the displays must be multiplexed in a short period of time (less than half a second) because then our brain can't realize that all the displays aren't lighted on at different periods of time.
So I used some flip - flops of the D type in a way that they work as serial to parallel converter. I also created a library for the ARDUINO in order to to turn its use easier.
Step 1: What Is a Serial to Parallel Converter?
A serial to parallel converter is a circuit which design is based on the funcionalities of the D type flip - flop which is the following:
D IN OUT
The information above means that when the D type flip - flop has a low logical level ('0' or 0V) in his input, when it receives a clock pulse, his output is going to be reset, which means that it will be a low logical level, and the same idea for a high logical level ('1' or 5V), so it kinda work as a memory and since there is a power suplly and it wasn't reseted, the information will keep on there.
As the project is based on 7 segments display I was supposed to use 8 D type flip - flops, since there seven segments plus the dot to set or reset. And the circuit can be seen in the picture above. In this circuit the CLOCK of all the flip - flops are connected together and receive the clock from the pin of the microcontroller, and the OUTPUT of each flip - flop is connected to the INPUT of the previous flip - flop (excluding the last one) so when the clock pulses, the information of the first flip -flop will be sent to the second flip - flop, as the information of the second flip -flop will be sent to third flip - flop in the array and it happens like this until the last one, and now the information is available in the eight outputs of the eight flip - flops in a parallel way.
So its just necessary to connect the eight pins of the four 7 segments displays to the eight outputs of the eight flip - flops and enable them when necessaryt by using a transistor in the ground connection of the each display, so since you send the right information, the desired character will be displayed.
Step 2: The Full Circuit - PROS and CONS
The complete circuit can be seen above, and it just consist in the union of the serial to parallel converter with the 7 segments displays array plus the transistors, that are responsible for multiplexing the displays and the connector for the microcontroller.
After doing this circuit I could realize some PROS, that are the followings:
- you can save several I/O's of your microcontroller, since instead of using 8 eight I/O's for sending the information to the display, only two are necessary
- the circuit only requires cheap components
- the circuit storage the information, so since it didn't change, it's not necessary to send it again
As well as some cons:
- A lot of memory is necessary to storage all the possible characters
- A lot of more processing is required from the microcontroler since, each bit is sent a clock is necessary
- depending on the apllication it doesn't work well
Although it runs nice in several situations, i've experienced some situations in which it doesn't fit well, for example with IR receivers, because there is a delay in between the multiplexing and then it's just impossible to read the IR commands, but for simpler situations it fits pretty well.
OBS: I'm not gonna share my PCB design now because it's too messy and confusing, so when I remodel it I will share it.
Step 3: The Library : SEG7
In order to turn the manipulation of the display into easier I created a library that includes all the possible characters of the 7 segments display and a function that allows you to write a character in one of the display, the fuction is the following:
Considering that the 'character' corresponds to the character that will be shown, respecting the limit of the 7 segments display and the 'display' refers to the position of the display in the array, so if you put '1' it's going to display the information in the first one.There is an example below:
And another important fuction is the one that is used to set the arduino pins for the serial communication, that is described bellow:
SEG7(display1PIN, display2PIN, display3PIN, display4PIN, clockPIN, dataPIN, DELAY);
In this function it's possible to set the pins of Arduino and the delay of the multiplexation, which makes the library fit more applications.
The library can be downloaded here, and it includes an example, it's easy to use and can simplify many applications the handling of the 7 segments display. So that's it, thank you for your attention.
We have a be nice policy.
Please be positive and constructive.