Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino-Controlled Sequential LED Display with 74HC595 Shift Register

View and Edit Project In Cirkit DesignerImage of Arduino-Controlled Sequential LED Display with 74HC595 Shift Register

Circuit Documentation

Summary

This circuit is designed to control a series of 8 red LEDs using an Arduino UNO microcontroller and a 74HC595 shift register. The LEDs are arranged to light up sequentially, creating a visual effect. The Arduino UNO is programmed to send serial data to the 74HC595, which then sets the state of each LED. Each LED is connected to the shift register through a current-limiting resistor to protect the LEDs from excessive current.

Component List

Arduino UNO

74HC595 Shift Register

LED: Two Pin (red)

Resistor

Wiring Details

Arduino UNO

74HC595 Shift Register

LEDs

Resistors

Documented Code

/*
 * This Arduino sketch controls 8 red LEDs connected through a 74HC595 shift
 * register. The LEDs will turn on sequentially one by one in a loop.
 */

// Pin definitions
const int dataPin = 8;   // DS (DATA) pin of 74HC595
const int latchPin = 10; // ST_CP (RCLK) pin of 74HC595
const int clockPin = 9;  // SH_CP (SRCLK) pin of 74HC595

void setup() {
  // Set pin modes
  pinMode(dataPin, OUTPUT);
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
}

void loop() {
  for (int i = 0; i < 8; i++) {
    // Create a byte with only the i-th bit set
    byte ledState = 1 << i;
    // Update the shift register
    updateShiftRegister(ledState);
    // Wait for a while
    delay(500);
  }
}

void updateShiftRegister(byte data) {
  // Set latchPin low to start sending data
  digitalWrite(latchPin, LOW);
  // Shift out the data
  shiftOut(dataPin, clockPin, MSBFIRST, data);
  // Set latchPin high to lock the data
  digitalWrite(latchPin, HIGH);
}

This code is designed to run on the Arduino UNO microcontroller. It initializes three pins as outputs to interface with the 74HC595 shift register. In the main loop, it sequentially lights up each LED by shifting a bit through the register, pausing for half a second between each LED. The updateShiftRegister function handles the low-level details of setting the shift register's pins to update the LED states.