In previous tutorials I showed how to use seven segment displays, how to use shift registers and how to daisy chain shift registers, and talked a bit about persistence of vision. In this tutorial we’re going to combine shift registers and seven segment displays to make an Arduino control two four-character seven-segment displays, a task that (at first glance) might not seem possible.
Why use shift registers?
In the seven segment display tutorial I showed that one display uses 12 pins, almost all the available pins on an Arduino UNO. To connect more devices isn’t going to happen unless we find a way to add more pins. That’s where shift registers come into play.
Here’s a seven segment display with one shift register.
As you can see nearly all the digital pins on one side of the Arduino UNO are used up talking to the seven segment display.
Two seven segment displays with Arduino
Now here are two seven segment displays connected through two daisy-chained shift registers.
As a matter of personal taste I put all the anodes on the first shift register (U1) and all the cathodes on the second shift register (U2). Really, they could have been any pattern you prefer, then unscrambled in the arduino code.
Speaking of which, here’s the four character seven segment display source code for both examples. Compare and contrast.