Raspberry Pi and 74HC595 Shift Register

Raspberry Pi I/O capabilities can be expanded by adding one or cascading a number of shift registers. In this design 74HC595 example is shown. 74HC595 is a very popular and relatively cheap IC. There are assembled modules based on this chip allowing you to control a 7-Segment display or individual LEDs. The interface to Raspberry Pi requires only 3 lines. Data input to the shift register – SDI, Data Clock – SRCLK and additional line to transfer shifted values to the output buffer – RCLK. Schematic diagram is shown in the next figure.
Raspberry Pi and 74HC595 Shift Register Schematic

As can be seen from attached Python code example a desired bit value is sent to SDI and clocked out by SRCLK. After 8 of these pulses a byte of information was sent. Now we’ll need to toggle RCLK once to lock the shifted data and we are done. In order to make it more interesting I’ve added a simple LED pattern array to create a running LED effect as shown in a short video.