Daisy-chained shift register display
Build it step by step
0 of 9 donePlace the chips
Put both 74HC595 chips across the breadboard centre gap with the notch the same way.
Wire the power and fixed pins
Pin 16 to 5V, pin 8 to GND, pin 10 to 5V and pin 13 to GND on both chips.
Wire the control lines
D4 to pin 14 of the first chip, D5 to pin 12 of both and D6 to pin 11 of both.
Chain them
Pin 9 of the first chip to pin 14 of the second.
Wire the first eight LEDs
Outputs QA to QH of the first chip each through 330 ohms to a red LED and then GND.
Wire the second eight LEDs
The same for the second chip with the green LEDs.
Wire the speed knob
Outer legs to 5V and GND, middle to A0.
Upload the sketch
The monitor says 16 LED display ready and a light runs across.
Turn the knob
The patterns speed up and slow down.
How do you build a daisy-chained shift register display?
Two 74HC595 chips are chained so that three Arduino pins drive sixteen LEDs. The sketch sends sixteen bits at a time and plays chasing, bouncing and filling patterns, and a knob changes the speed. You need Arduino Uno R3, 74HC595 Shift Register × 2, LED 5 mm red × 8, LED 5 mm green × 8, Resistor 330 Ω × 16, Potentiometer 10 kΩ, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 9 steps and about 150 minutes.
- Level
- Beginner
- Time
- About 150 min
- Parts
- 8
Parts list
- Development BoardsBuyArduino Uno R3 × 1
- Integrated CircuitsBuy
- SemiconductorsBuyLED 5 mm red × 8
- SemiconductorsBuyLED 5 mm green × 8
- PassivesBuyResistor 330 Ω × 16
- PassivesBuy
- PrototypingBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Both 595 pin 16 VCC and pin 8 GND | Uno 5V and GND | Power for both chips |
| Both 595 pin 10 SRCLR | 5V | Never clear |
| Both 595 pin 13 OE | GND | Outputs always enabled |
| Uno D4 | First 595 pin 14 SER | Data in |
| Uno D5 | Both 595 pin 12 RCLK | Latch, copies the bits to the LEDs |
| Uno D6 | Both 595 pin 11 SRCLK | Clock, moves the bits along |
| First 595 pin 9 QH' | Second 595 pin 14 SER | The chain: bits overflow into the second chip |
| First 595 outputs QA to QH | Pins 15, 1, 2, 3, 4, 5, 6, 7, each to a red LED through 330 ohms to GND | LEDs 1 to 8 |
| Second 595 outputs QA to QH | Pins 15, 1, 2, 3, 4, 5, 6, 7, each to a green LED through 330 ohms to GND | LEDs 9 to 16 |
| Pot outer legs | Uno 5V and GND | Speed knob |
| Pot middle leg | Uno A0 | Chooses the speed |
Code
A 74HC595 is a shift register. It has three inputs, data, clock and latch, and eight outputs. Each time the clock goes from low to high, the bit on the data pin is pushed in and everything already inside moves one place along. After eight clocks the chip holds a whole byte, and when the latch pin goes high, those eight bits all appear on the outputs at once. That is how three Arduino pins can control eight LEDs. To get sixteen, you chain two chips: the first chip's overflow pin QH' is wired to the second chip's data input, so bits that fall off the end of the first chip flow into the second. Both chips share the same clock and latch, so the sketch sends 16 bits with two calls to shiftOut() and one latch. The first byte sent travels all the way to the far chip, which is why the high byte is sent first. The patterns are all done with a 16-bit number where each bit is one LED: 1u << i makes a number with only bit i set, so it is a single running LED, and OR-ing and AND-ing with masks fills or empties them. The 330 ohm resistor on each LED limits its current to a safe value, and 16 LEDs at 10 mA is 160 mA in all, which is more than a single chip should supply, so keep the LEDs dim by not lighting them all at full brightness for long. A pot on A0 sets how fast the patterns go. Try adding a button to change the pattern, or send sound level as a bar graph.
Runs on a virtual Arduino Uno in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
const uint8_t DATA = 4, LATCH = 5, CLOCK = 6;
const uint8_t SPEED_POT = A0;
void send16(uint16_t bits) {
digitalWrite(LATCH, LOW);
shiftOut(DATA, CLOCK, MSBFIRST, bits >> 8); // goes to the far chip
shiftOut(DATA, CLOCK, MSBFIRST, bits & 0xFF); // stays in the first chip
digitalWrite(LATCH, HIGH); // show all 16 at once
}
int pause() {
return map(analogRead(SPEED_POT), 0, 1023, 20, 300);
}
void chase() { // one lit LED running along
for (int i = 0; i < 16; i++) {
send16(1u << i);
delay(pause());
}
}
void bounce() { // there and back
for (int i = 0; i < 16; i++) { send16(1u << i); delay(pause()); }
for (int i = 14; i > 0; i--) { send16(1u << i); delay(pause()); }
}
void fillUp() { // fill from one end, then empty
uint16_t bits = 0;
for (int i = 0; i < 16; i++) { bits |= (1u << i); send16(bits); delay(pause()); }
for (int i = 0; i < 16; i++) { bits &= ~(1u << i); send16(bits); delay(pause()); }
}
void middleOut() { // from the centre to both ends
for (int i = 0; i < 8; i++) {
send16((1u << (7 - i)) | (1u << (8 + i)));
delay(pause() * 2);
}
}
void setup() {
pinMode(DATA, OUTPUT);
pinMode(LATCH, OUTPUT);
pinMode(CLOCK, OUTPUT);
Serial.begin(9600);
send16(0);
Serial.println(F("16 LED display ready"));
}
void loop() {
Serial.println(F("chase")); chase();
Serial.println(F("bounce")); bounce();
Serial.println(F("fill")); fillUp();
Serial.println(F("middle")); middleOut();
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Uno with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
16 LED display ready chase bounce fill
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Chase | One light runs red to green, from LED 1 to LED 16 |
| Bounce | The light runs there and back |
| Fill | The LEDs fill up and then switch off in order |
| Middle | Lights spread from the centre to both ends |
| Knob fully one way | Very fast, the other way slow |
| Monitor | Prints the name of each pattern as it starts |
If it does not work
Only the first eight LEDs work
Check pin 9 of the first chip goes to pin 14 of the second.
Second chip shows the wrong bits
Swap the order of the two shiftOut() lines.
Random LEDs light
Pin 10 SRCLR must be at 5V and pin 13 OE at GND on both chips.
LEDs flicker
Add a 100 nF capacitor between 5V and GND next to each chip.
Nothing lights
Check the notch direction of both chips and the LED direction.
Knob does nothing
Check the pot middle leg is at A0.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the daisy-chained shift register display?
Arduino Uno R3, 74HC595 Shift Register × 2, LED 5 mm red × 8, LED 5 mm green × 8, Resistor 330 Ω × 16, Potentiometer 10 kΩ, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).
How long does the daisy-chained shift register display take to build?
About 150 minutes for a beginner maker, in 9 steps.
How do I know the daisy-chained shift register display works?
Chase: One light runs red to green, from LED 1 to LED 16. Bounce: The light runs there and back. Fill: The LEDs fill up and then switch off in order.
Only the first eight LEDs work: what should I check?
Check pin 9 of the first chip goes to pin 14 of the second.
Second chip shows the wrong bits: what should I check?
Swap the order of the two shiftOut() lines.
Random LEDs light: what should I check?
Pin 10 SRCLR must be at 5V and pin 13 OE at GND on both chips.
LEDs flicker: what should I check?
Add a 100 nF capacitor between 5V and GND next to each chip.
