24. Shift Registers and 7-Segment Display
The 74HC595 is an 8-bit serial-in, parallel-out shift register. This means it can take in a serial data input (one bit at a time) and then output the data in parallel (all 8 bits at once). This functionality is particularly useful for expanding the number of output pins available on a microcontroller. A 7-segment display is a simple electronic display device that can display digits from 0 to 9. It consists of seven LEDs (segments) arranged in a pattern that can form each digit. Each segment is labeled with a letter from 'a' to 'g'.
Materials
Component | Image |
---|---|
Breadboard | ![]() |
Jumper wires | ![]() |
Arduino Uno R4 Minima | ![]() |
Resistors (220 ohms for the LED, optional if using internal pull-up resistors for buttons) | ![]() |
7 Segment Display | ![]() |
74HC595 Shift Register | ![]() |
Instructions
- Make the following connections using the breadboard and jumper wires.
74HC595 Shift Register Connections
- DS (Data Pin) to Arduino pin 2
- SH_CP (Clock Pin) to Arduino pin 4
- ST_CP (Latch Pin) to Arduino pin 3
- VCC to 5V on Arduino
- GND to GND on Arduino
7 Segment Display to Shift Register
- Q0 (Pin 15 on 74HC595): Connect to Segment A (Pin 10 on 7-segment display)
- Q1 (Pin 1 on 74HC595): Connect to Segment B (Pin 7 on 7-segment display)
- Q2 (Pin 2 on 74HC595): Connect to Segment C (Pin 4 on 7-segment display)
- Q3 (Pin 3 on 74HC595): Connect to Segment D (Pin 2 on 7-segment display)
- Q4 (Pin 4 on 74HC595): Connect to Segment E (Pin 1 on 7-segment display)
- Q5 (Pin 5 on 74HC595): Connect to Segment F (Pin 9 on 7-segment display)
- Q6 (Pin 6 on 74HC595): Connect to Segment G (Pin 5 on 7-segment display)
- Q7 (Pin 7 on 74HC595): Connect to Decimal Point (Pin 6 on 7-segment display)(optional)

- Paste the following code into your main Arduino sketch: