SN74HC595: 8-Bit Shift Register Explained

The SN74HC595 is an 8-bit serial-in, parallel-out shift register with a storage register and tri-state outputs. It is widely used for expanding the number of digital output pins on a microcontroller (e.g., Arduino, Raspberry Pi, STM32) when the available pins are limited.


πŸ”Ή 1. What is the SN74HC595?

  • It is an 8-bit shift register that takes serial data (one bit at a time) and outputs it in parallel (to 8 output pins).
  • It includes a latch function, which holds the data until it is updated.
  • The tri-state output allows multiple shift registers to be cascaded.

πŸ“Œ Why use it?

  • Expands microcontroller output pins (uses only 3 control pins to control 8 outputs).
  • Can cascade multiple SN74HC595s to control more outputs.
  • Commonly used for LED displays, 7-segment displays, and multiplexing applications.

πŸ”Ή 2. SN74HC595 Pinout & Functions

The SN74HC595 has 16 pins.

Pin No.NameFunction
1Q1Parallel Output 1
2Q2Parallel Output 2
3Q3Parallel Output 3
4Q4Parallel Output 4
5Q5Parallel Output 5
6Q6Parallel Output 6
7Q7Parallel Output 7
8GNDGround
9Q7′Serial Out (for cascading)
10MRMaster Reset (Active LOW)
11SH_CPShift Register Clock
12ST_CPStorage Register (Latch) Clock
13OEOutput Enable (Active LOW)
14DSSerial Data Input
15Q0Parallel Output 0
16VCCPower Supply (2V – 6V)

πŸ“Œ Key Control Pins:

  • SH_CP (Pin 11) β†’ Shift register clock (loads serial data bit-by-bit).
  • ST_CP (Pin 12) β†’ Latch clock (updates all 8 outputs).
  • OE (Pin 13) β†’ Output Enable (LOW to enable, HIGH to disable outputs).
  • DS (Pin 14) β†’ Serial data input (data fed into the shift register).
  • Q7′ (Pin 9) β†’ Serial out (for cascading more shift registers).

πŸ”Ή 3. How SN74HC595 Works

  1. Data is sent serially (bit by bit) into DS (Pin 14).
  2. SH_CP (Shift Clock) moves data through the shift register.
  3. ST_CP (Latch Clock) transfers the stored bits to the output pins (Q0-Q7).
  4. OE (Output Enable) controls whether the outputs are active.

πŸ“Œ Multiple SN74HC595s can be cascaded by connecting Q7' (Pin 9) of one IC to DS (Pin 14) of the next.


πŸ”Ή 4. Using SN74HC595 with Arduino

πŸ›  Required Components

  • 1x SN74HC595 Shift Register
  • 8x LEDs
  • 8x 220Ξ© Resistors
  • 1x Arduino Board
  • Jumper Wires

πŸ›  Wiring

SN74HC595 PinArduino PinFunction
VCC (16)5VPower
GND (8)GNDGround
DS (14)D2Serial Data Input
SH_CP (11)D3Shift Clock
ST_CP (12)D4Latch Clock
OE (13)GNDAlways Enabled (LOW)
MR (10)5VNo Reset (HIGH)
Q0 – Q7LEDs via 220Ξ© ResistorsParallel Outputs

πŸ”Ή 5. Arduino Code to Control LEDs

This Arduino sketch shifts binary data into SN74HC595 to control 8 LEDs.

#define DS 2     // Data pin
#define SH_CP 3  // Shift Clock pin
#define ST_CP 4  // Latch Clock pin

void setup() {
    pinMode(DS, OUTPUT);
    pinMode(SH_CP, OUTPUT);
    pinMode(ST_CP, OUTPUT);
}

void loop() {
    for (int i = 0; i < 256; i++) {
        digitalWrite(ST_CP, LOW);  // Latch disabled
        shiftOut(DS, SH_CP, MSBFIRST, i);  // Send data
        digitalWrite(ST_CP, HIGH); // Latch enabled
        delay(500);
    }
}

πŸ“Œ Explanation:

  • shiftOut() sends 8 bits of data serially to SN74HC595.
  • ST_CP (Latch Clock) updates all outputs at once.
  • The loop cycles through 256 patterns (0b00000000 to 0b11111111).

πŸ”Ή 6. Cascading Multiple SN74HC595 Shift Registers

You can connect multiple SN74HC595s together to control 16, 24, or more outputs.

πŸ›  Cascading Wiring

1st SN74HC595 Pin2nd SN74HC595 Pin
VCCVCC
GNDGND
DS (Pin 14)Arduino D2
SH_CP (Pin 11)SH_CP (Pin 11)
ST_CP (Pin 12)ST_CP (Pin 12)
Q7′ (Pin 9)DS (Pin 14)

πŸ“Œ Data shifts from the first SN74HC595 to the second one, allowing more outputs.

βœ… Arduino Code for Two SN74HC595 Shift Registers

#define DS 2  
#define SH_CP 3  
#define ST_CP 4  

void setup() {
    pinMode(DS, OUTPUT);
    pinMode(SH_CP, OUTPUT);
    pinMode(ST_CP, OUTPUT);
}

void loop() {
    digitalWrite(ST_CP, LOW);
    shiftOut(DS, SH_CP, MSBFIRST, 0b10101010); // First register
    shiftOut(DS, SH_CP, MSBFIRST, 0b11001100); // Second register
    digitalWrite(ST_CP, HIGH);
    delay(500);
}

πŸ“Œ What happens?

  • The first shift register controls the first 8 outputs.
  • The second shift register controls the next 8 outputs.

πŸ”Ή 7. Applications of SN74HC595

βœ… LED Displays – Used in multiplexed LED matrix.
βœ… 7-Segment Displays – Drives multiple digits with minimal pins.
βœ… Motor Controllers – Expands H-Bridge drivers.
βœ… Relays & Actuators – Controls high-power devices with low pin usage.
βœ… Home Automation – Expands I/O in smart control systems.


πŸ”Ή 8. SN74HC595 vs. Other Shift Registers

FeatureSN74HC59574HC164TPIC6B595
Bits888
Storage LatchYesNoYes
Tri-State OutputsYesNoYes
Max Current per Pin35mA25mA150mA
Best forLEDs, displaysBasic shiftingHigh-power loads

πŸ“Œ Verdict: SN74HC595 is best for general output expansion, but for high-current applications, use TPIC6B595.


🎯 Conclusion

  • The SN74HC595 expands digital outputs using only 3 control pins.
  • It is widely used in LED displays, multiplexing, and motor control.
  • Multiple SN74HC595s can be cascaded to control dozens of outputs.
  • Arduino + SN74HC595 = Simple and Effective I/O Expansion.
πŸ“‘Broadcast the signal β€” amplify the connection.

Leave a Reply