In the previous post we learned how to use a 74hc595n shift register. I mentioned briefly that shift registers could be daisy chained – connected end to end – to increase the number of available connections without using extra resources on the Arduino. In this post we’ll cover why daisy chain shift registers, how to plug them together, what changes in the code, and show some examples in a video at the end.
Why daisy chain?
A normal shift register has eight output connections that you can control. Daisy chaining effectively creates a 16-output connection. You can take this further to make 24 output, 32 output, and so on. How far can you go? Let me know when you get there.
How to connect daisy chained shift registers
Let’s compare the schematic diagram for one shift register and the schematic diagram for two shift registers daisy changed. I think the side-by-side makes this pretty clear.
I’ve chosen to connect both SRCLK, both SRCLR, both RCLK, and both EO. Kicad labels the EO pin as ‘G’ 😛 This makes both chips work in lock step without using any extra pins on the Arduino. Yes, EO could be connected to the 5v line to be always on, freeing up Arduino pin 2.
I also connected the SER pin (14) of the second shift register to the QH’ pin (9) of the first. When a value is shifted in 8 places it will reach the first latch of the second shift register.
What changes in the shift register code
Two digits are all that change from the previous tutorial’s shift register arduino sketch. I’ve made a whole new github project for this daisy chain shift register project, just to be safe.
#define TOTAL_SHIFT_PINS 16 // was 8
Good thing I used TOTAL_SHIFT_PINS throughout the code instead of magic numbers.
Printed Circuit Board
Maybe all those wires are too messy for your taste. No worries! I’ve designed a PCB that should make everything a neat and tidy package. Pretty easy when I’ve already go the schematic diagram done up.
You’ll find it in the github project, or comment below and I’ll see about getting one made for you.