Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.

74HC595 shift register with Arduino Uno — 8 LEDs from 3 pins

Wire a 74HC595 to an Arduino Uno R3 (DS D11, latch D8, clock D12), drive 8 LEDs with shiftOut(), and stay inside the chip’s 70 mA total limit.

Arduino C++Verified — core avr 1.8.8, 3 Nov 2026Compile-only

Community draft — report a mistake

The 74HC595 turns three Uno pins into eight outputs. The Uno has only about 18 usable I/O pins, so this chip is how LED bar graphs, 7-segment displays and large relay banks fit on one board. Several chips can be chained on the same three wires.

The Uno shifts a byte in one bit at a time on DS (D11) with clock pulses on SH_CP (D12). A pulse on the latch, ST_CP (D8), then copies all eight bits to the outputs at once. Two control pins need fixed levels: OE to GND keeps the outputs on, and MR to 5V keeps the register out of reset.

The sketch runs a light back and forth across the eight LEDs. It then counts in binary, printing each pattern so you can check it against the LEDs.

Wiring

Arduino Uno R3Only the pins used are shown · 5 V logic74HC595 8-bit shift register (DIP-16)5VGNDD8D11D12VCCGNDDSSH_CPST_CPOEMRQ0 → LED 1 via 470 Ω to GNDQ1 → LED 2 via 470 ΩQ2 → LED 3 via 470 ΩQ3 → LED 4 via 470 ΩQ4 → LED 5 via 470 ΩQ5 → LED 6 via 470 ΩQ6 → LED 7 via 470 ΩQ7 → LED 8 via 470 ΩQ7S (not connected)
Also needed: 8 LEDs and 8× 470 Ω resistors, 100 nF ceramic capacitor.
Every connection
Arduino Uno R374HC595 8-bit shift register (DIP-16)WireNotes
—Q0—To LED 1 via 470 Ω to GND (not drawn)
—Q1—To LED 2 via 470 Ω (not drawn)
—Q2—To LED 3 via 470 Ω (not drawn)
—Q3—To LED 4 via 470 Ω (not drawn)
—Q4—To LED 5 via 470 Ω (not drawn)
—Q5—To LED 6 via 470 Ω (not drawn)
—Q6—To LED 7 via 470 Ω (not drawn)
—Q7—To LED 8 via 470 Ω (not drawn)
5VVCCredPin 16. Put a 100 nF capacitor from VCC to GND right at the chip.
GNDGNDblackPin 8.
D11DSgreenSerial data in (pin 14).
D12SH_CPblueShift clock (pin 11).
D8ST_CPyellowLatch / storage clock (pin 12).
GNDOEblackPin 13, active-LOW output enable. Wire it to a PWM pin instead to dim all 8 LEDs at once.
5VMRredPin 10, active-LOW reset — keep HIGH.

2–6 V part, 5 V board. Power it from the same voltage as your board: 3.3 V on ESP32 and Pico, 5 V on Uno. At 5 V the 74HC595 needs about 3.15 V for a HIGH, so a 3.3 V board driving a 5 V-powered chip is marginal — use a 74HCT595 at 5 V for that.

Board quirks

  • The chip is rated 70 mA total through VCC/GND. With 470 Ω resistors each LED takes about 6 mA, so all 8 on is about 50 mA. Smaller resistors look brighter but overheat the chip when every output is on.
  • shiftOut() works on any pins. The data and clock here are D11 and D12; D13 is left alone because the on-board LED flickers with the clock. For speed you can use hardware SPI (D11 + D13) instead.
  • Chain more chips by wiring Q7S (pin 9) of the first to DS of the next, sharing clock and latch. Then send one byte per chip, last chip first.
  • Pin names vary by maker: NXP prints DS/SH_CP/ST_CP/Q7S, TI prints SER/SRCLK/RCLK/QH′. They are the same pins.

Code

74hc595-uno.inoArduino C++Open in PlaygroundOpen in PlaygroundFlash
// 74HC595 shift register on an Arduino Uno R3: 8 LEDs from 3 pins.
// DS → D11, ST_CP (latch) → D8, SH_CP (clock) → D12. OE → GND, MR → 5V, VCC → 5V, GND → GND.
// Q0–Q7 → LED + 470 Ω resistor each → GND.
const uint8_t DATA_PIN = 11, LATCH_PIN = 8, CLOCK_PIN = 12;

void writeByte(uint8_t value) {
  digitalWrite(LATCH_PIN, LOW);
  shiftOut(DATA_PIN, CLOCK_PIN, MSBFIRST, value);  // Q7 gets the first bit sent
  digitalWrite(LATCH_PIN, HIGH);                   // outputs change together on this edge
}

void setup() {
  pinMode(DATA_PIN, OUTPUT);
  pinMode(LATCH_PIN, OUTPUT);
  pinMode(CLOCK_PIN, OUTPUT);
  writeByte(0);
  Serial.begin(9600);
  Serial.println(F("74HC595: running light, then a binary counter"));
}

void loop() {
  for (uint8_t i = 0; i < 8; i++) {  // Q0 → Q7
    writeByte(1 << i);
    delay(80);
  }
  for (int8_t i = 6; i > 0; i--) {   // and back
    writeByte(1 << i);
    delay(80);
  }
  for (uint16_t n = 0; n < 256; n += 17) {
    writeByte(n);
    Serial.print(F("Binary "));
    for (int8_t b = 7; b >= 0; b--) Serial.print((n >> b) & 1);
    Serial.print(F(" = "));
    Serial.println(n);
    delay(300);
  }
}

Expected serial output

Serial Monitor · 9600Output
74HC595: running light, then a binary counter
Binary 00000000 = 0
Binary 00010001 = 17
Binary 00100010 = 34

Common errors

LEDs light in a random pattern and stay that way

The latch (ST_CP) isn’t toggling — check it is on D8. Without the latch edge the outputs never update.

Nothing lights at all

OE is floating or HIGH (outputs off), or MR is LOW (register held in reset). Tie OE to GND and MR to 5V.

LEDs flicker or show ghost patterns

Missing the 100 nF decoupling capacitor, or long loose jumpers on the clock line.

↑↓ to move · Enter to open