What Is the 74HC595? Wiring Diagram and Driving LEDs

Temel Elektronik Intermediate 10 min read Published:
74HC595 Nedir? Shift register ile 3 pinden 8 çıkış kapak görseli, DIP entegre çizimi ve LED dizisi

The 74HC595 is a shift register IC that distributes serial data from a microcontroller to 8 separate outputs. It works with three signals: a data bit enters on the SER pin, each rising edge on the SCK pin shifts that bit by one stage, and a rising edge on the RCK pin transfers the 8 shifted bits to the outputs. This lets you drive 8 LEDs with only 3 Arduino pins, or 16, 24 or more outputs by chaining several ICs. In this article we walk step by step through the pinout, the signal sequence, the current limit that most tutorials skip when connecting LEDs, and daisy-chaining.

The values in this article are taken from the AIP74HC595-DIP (Wuxi I-CORE) datasheet. Pin names vary from manufacturer to manufacturer. We use the names from this datasheet here; alternative names are noted where they first appear.

What Is a Shift Register?

A shift register is a digital circuit that moves bits forward one stage at a time along a chain of flip-flops with each clock pulse. The 74HC595 is a “serial-in, parallel-out” (SIPO) type: bits enter one after another on a single wire, and all eight appear at the outputs at once. There is also a “parallel-in, serial-out” (PISO) type that does the reverse; the 74HC165, used for reading buttons or switches, is an example.

Inside the 74HC595 there are two separate 8-bit blocks:

  • Shift register: On each rising edge of the SCK clock, the contents shift by one stage and the bit on the SER pin is written into the first stage.
  • Storage register: On the rising edge of the RCK clock, it copies the current contents of the shift register and passes them to the output buffers.

Thanks to this two-stage structure, the outputs stay put while data is being shifted. Once all 8 bits are in place, a single RCK pulse changes all outputs at the same time. No flicker or intermediate states are visible on the LEDs.

74HC595 Pinout

74HC595 DIP-16 pinout: 1-7 Q1-Q7, 8 GND, 9 Q7', 10 SCLR, 11 SCK, 12 RCK, 13 G, 14 SER, 15 Q0, 16 VCC
74HC595 pinout (DIP-16, top view). The first output, Q0, is on pin 15; Q1–Q7 are on pins 1–7.
Pin Name Function
15, 1–7 Q0, Q1–Q7 Three-state parallel outputs
8 GND Ground
9 Q7′ Serial output; connects to the SER input of the next IC
10 SCLR (active low) Clears the shift register
11 SCK Shift clock
12 RCK Storage (latch) clock
13 G (active low) Output enable; when high, Q0–Q7 go to high impedance
14 SER Serial data input
16 VCC Supply, 2–6 V

In the datasheet’s package drawing the outputs are labeled QA–QH, while the pin table labels them Q0–Q7; both refer to the same pins (QA = Q0, QH = Q7). Manufacturers such as TI call SCK SRCLK, RCK RCLK, SCLR SRCLR and G OE. The names DS (data), SHCP (shift clock) and STCP (latch clock), often seen in Arduino examples, also refer to the same pins.

In What Order Are the Signals Applied?

Three steps are enough to write a byte to the outputs:

  1. Put the bit to be sent on the SER pin.
  2. Apply a rising edge to SCK. The bit enters the Q0 stage and the previous bits each shift by one stage (in the words of the datasheet’s truth table, QN = QN−1, Q0 = SER).
  3. After eight bits, apply a rising edge to RCK. The 8 bits in the shift register are transferred to the outputs.
74HC595 timing diagram: SER data, 8 clock pulses on SCK, followed by an RCK pulse, with the outputs changing together on the RCK rising edge
The bits are shifted in with eight SCK pulses; the outputs change only on the rising edge of RCK, all together. The drawing is illustrative, not to scale.

The first bit sent reaches the farthest stage, Q7, after eight pulses. If you call the Arduino shiftOut() function with MSBFIRST, bit 7 of the byte goes first and lands on Q7, and bit 0 goes last and lands on Q0. In other words, the bit number in the byte matches the output number.

The datasheet states that if SCK and RCK are tied to the same clock, the shift register will always be one pulse ahead of the storage register. Combining the two to save a pin therefore makes the outputs lag by one step. Keeping them separate is the right approach.

Key Parameters

The values below are taken from the AIP74HC595 datasheet. The datasheet does not give a separate row for 5 V; most values are given for 2 V, 4.5 V and 6 V. In 5 V designs, the 4.5 V row is the safe side for output voltage, frequency and delay values. For the input threshold the situation is reversed: as the supply rises, the voltage needed for an input to be read as “1” also rises.

Parameter Value Condition
Operating supply voltage 2–6 V Recommended operating condition
Supply voltage absolute limit −0.5 … 7.0 V Limit that must not be exceeded
Current per output (absolute maximum) ±35 mA Not a design value
Supply current ICC (absolute maximum) ±70 mA Total current through the VCC pin
Output high level VOH (Q0–Q7) min. 3.7 V VCC = 4.5 V, −6 mA, −40…125 °C
Output low level VOL (Q0–Q7) max. 0.4 V VCC = 4.5 V, 6 mA, −40…125 °C
Minimum voltage at which an input reads as “1”, VIH 3.15 V VCC = 4.5 V
Clock frequency fMAX min. 30 MHz (typ. 91 MHz) VCC = 4.5 V, 25 °C
Quiescent current ICCQ max. 80 µA VCC = 6 V, −40…85 °C
Power dissipation PD (absolute maximum) 600 mW (DIP), 500 mW (SOP) —

Absolute maximum ratings are the limits the IC can withstand without damage. A design should always operate below these limits, close to the conditions in the datasheet’s characteristics tables. For the 74HC595, that condition is 6 mA per output.

Wiring Diagram for 8 LEDs with Arduino

74HC595 LED circuit with Arduino: D2 to SER, D3 to SCK, D4 to RCK; 8 LEDs to ground from outputs Q0-Q7 through 680 ohm resistors; SCLR to VCC, G to ground, 100 nF capacitor on VCC
Driving 8 LEDs through a 74HC595 with Arduino. Each LED has its own resistor; SCLR is tied to VCC and G to ground.

Connections in the diagram:

  • Arduino D2 → SER (pin 14), D3 → SCK (pin 11), D4 → RCK (pin 12).
  • SCLR (pin 10) directly to VCC. If left floating, the shift register may clear at random.
  • G (pin 13) directly to ground, so the outputs are always enabled. If you want brightness control, you can connect this pin to a PWM pin (see below).
  • From each output, a resistor and an LED to ground. Use a separate resistor for each LED; a single shared resistor makes the brightness change with the number of LEDs that are lit.
  • A 100 nF ceramic capacitor between pin 16 and pin 8, close to the IC. The datasheet does not require it, but it is good practice with any fast-switching logic IC.

A short program to try out the circuit:

const int SER_PIN = 2;  // 74HC595 pin 14
const int SCK_PIN = 3;  // 74HC595 pin 11
const int RCK_PIN = 4;  // 74HC595 pin 12

void writeByte(byte data) {
  digitalWrite(RCK_PIN, LOW);
  shiftOut(SER_PIN, SCK_PIN, MSBFIRST, data);
  digitalWrite(RCK_PIN, HIGH);   // rising edge: outputs are updated
}

void setup() {
  pinMode(SER_PIN, OUTPUT);
  pinMode(SCK_PIN, OUTPUT);
  pinMode(RCK_PIN, OUTPUT);
  digitalWrite(SCK_PIN, LOW);
}

void loop() {
  for (int i = 0; i < 8; i++) {
    writeByte(1 << i);   // Q0, Q1 ... Q7 light up in turn
    delay(200);
  }
}

The program walks a single lit LED from Q0 to Q7. If the LEDs light up in a different order than expected, the problem is usually the wiring: forgetting that Q0 is on pin 15 is the most common mistake.

How to Calculate the LED Resistor: Mind the Current Limit

Most online examples put 220 Ω on each LED and light all 8 LEDs together. At 5 V, that means roughly 10–15 mA per LED. With all eight lit, the total is 80–120 mA, which exceeds the 70 mA absolute limit. The calculation has to start from the IC’s limit.

Example calculation (VCC = 5 V, red LED):

  1. Total budget: The ICC absolute limit is 70 mA. Since all eight LEDs may be lit at the same time, that leaves at most 70 / 8 ≈ 8.75 mA per LED. That is the limit itself; you need to leave margin.
  2. Target current: The datasheet characterizes the outputs at 6 mA. Let’s target 5 mA per LED. For eight LEDs the total is 40 mA, well below the limit.
  3. LED voltage: Assume a forward voltage of about 2.0 V for a red LED. This is an assumption; use the value from your own LED’s datasheet.
  4. Resistor: R = (5 − 2.0) / 0.005 = 600 Ω. The next standard value up, 680 Ω, is chosen.
  5. Check: With 680 Ω the current is at most (5 − 2.0) / 680 ≈ 4.4 mA. Because the output voltage drops slightly under load, the actual current is even lower. For eight LEDs the total is at most about 35 mA.

Most indicator LEDs are easily visible indoors at a few mA. Where more current is needed (high-brightness LEDs, relays, buzzers, motors), feed the 74HC595 output to a transistor or to a transistor array such as the ULN2003 and drive the load with that.

If you connect the LEDs between VCC and the output instead of between the output and ground (a connection that lights when the output is “0”), the current returns through the GND pin instead. The AIP datasheet does not give a separate value for the GND pin; since the same total current will flow through this pin, base the budget on 70 mA again.

How to Daisy-Chain Multiple 74HC595s

In a cascade (daisy chain), the Q7′ output (pin 9) of the first IC connects to the SER input (pin 14) of the second IC. The SCK and RCK lines are shared by all ICs. Two ICs give 16 outputs while still using 3 pins on the Arduino side.

  • For 16 bits, 16 SCK pulses are applied, followed by a single RCK pulse that updates the outputs of both ICs together.
  • shiftOut() is called twice. The first byte sent passes through to the second IC during shifting; the second byte sent stays in the first IC.
  • Each IC should have its own 100 nF capacitor, and the LED current budget should be calculated separately for each IC.

Q7′ should not be treated as an LED output. The datasheet characterizes this output at 4 mA, and its job is to carry data to the next IC.

Brightness Control with the G Pin and Clearing with SCLR

While the G pin is high, outputs Q0–Q7 go to high impedance and the LEDs turn off (Q7′ is not affected). If you connect this pin to a PWM pin, you can adjust the brightness of all LEDs together. Because G is active low, the logic is inverted: on Arduino, analogWrite(pin, 0) means full brightness, and values approaching 255 mean dimmer.

SCLR clears only the shift register. Because the outputs are fed from the storage register, if you also want to clear the outputs after SCLR, you need to apply another RCK pulse. In most projects SCLR is tied to VCC, and clearing is done by sending a byte with all bits 0.

Common Mistakes

  • Assuming Q0 is pin 1: Q0 is on pin 15; pin 1 is Q1.
  • Leaving SCLR and G floating: Floating CMOS inputs take random levels. The outputs may turn off and on by themselves, or the data may be cleared.
  • Giving each LED 20 mA: With eight LEDs lit together that is 160 mA, more than twice the 70 mA limit.
  • Forgetting the RCK pulse: The data is shifted but never transferred to the outputs; the LEDs seem not to change at all.
  • Breadboard setups with long wires and no capacitor: Noise on the clock line can cause extra shifts, and the LEDs appear shifted by one stage.
  • Driving a relay or motor directly: This is far above the characterized value of 6 mA per output; a transistor or driver IC is needed in between.

The 74HC165 for Inputs

To read buttons or DIP switches with few pins, the 74HC165, which does the reverse of the 74HC595, is used. According to the SN74HC165PWRG4 datasheet, the parallel inputs A–H are loaded in while SH/LD (pin 1) is low. With SH/LD high and CLK INH (pin 15) low, CLK (pin 2) shifts one bit on each rising edge. If CLK INH is left floating or high, no shifting occurs, and the data is read serially from the QH output (pin 9). This IC comes in a 16-pin TSSOP (PW) package, so it is surface-mount.

Frequently Asked Questions

How many LEDs can a 74HC595 drive?

One IC has 8 outputs, so 8 LEDs can be driven directly. The real limit is current: the absolute maximum current through the VCC pin is ±70 mA. In a design where all eight LEDs light together, 4–5 mA per LED is a safe value.

Does the 74HC595 work at 3.3 V?

Yes, the supply range is 2–6 V. The point to watch is powering the IC from 5 V while driving it from a 3.3 V board (such as an ESP32). The minimum voltage required for an input to be reliably read as “1” is 3.15 V at VCC 4.5 V and 4.2 V at 6 V; at 5 V it falls between the two. A 3.3 V signal is therefore outside the guaranteed range. The most robust solution is to power the 74HC595 from 3.3 V as well. In that case the drive strength of the outputs will be lower than at 5 V. The datasheet does not give separate values for 3.3 V, so keep the LED current low.

What is the difference between the 74HC595 and the 74HC165?

The 74HC595 converts serial data into 8 parallel outputs (output expansion). The 74HC165 converts 8 parallel inputs into serial data (input expansion). Use the 74HC595 for LEDs, relay drivers or 7-segment displays, and the 74HC165 for reading buttons and switches.

How many 74HC595s can be daisy-chained?

The datasheet does not specify a limit on the number. Each additional IC requires 8 more clock pulses, which lengthens the update time. The shared SCK and RCK lines carry more load with each IC. With many ICs, keep the clock line short and put a capacitor on each IC.

Why is RCK called the latch?

Because the rising edge of RCK “latches” the current 8 bits in the shift register into the storage register. Until the next RCK edge, the outputs do not change, no matter how much shifting is done with SCK.

Conclusion

To use the 74HC595 correctly, consider the signal sequence, the connections and the current budget together. Put the bit on SER and shift it with SCK; after eight bits, transfer them to the outputs with RCK. Tie SCLR to VCC and G to ground (or to a PWM pin), and never leave any input floating. Calculate the LED resistors backward from the 70 mA total current limit; at 5 V, assuming a red LED of about 2 V, 680 Ω allows all eight LEDs to light together. For more outputs, connect the Q7′ output (pin 9) to the SER input of the next IC; SCK and RCK remain shared.

AIP74HC595-DIPWuxi I-CORE Electronics · CV2-1-12$0.260246 In StockView

You can find ICs in other packages and bit counts in the Shift Register ICs category. If you want to give an LED array an automatic rhythm with a timer, the 555 astable circuit article may help, and if you want to see the logic of series resistor calculation in another example, the Zener diode series resistor calculation article may be useful.

References

Products in this article

More from Temel Elektronik