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

Arduino-Controlled 8-LED Pattern Display with 74HC595 Shift Register

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

Circuit Documentation

Summary

This circuit utilizes an Arduino UNO microcontroller to control a 74HC595 shift register, which in turn drives multiple LEDs. The LEDs are arranged to display alternating patterns, with resistors in series to limit the current. The shift register expands the output capabilities of the Arduino, allowing for control of multiple LEDs with only a few pins. The circuit is designed to alternate between two LED patterns with a specified delay.

Component List

LEDs

Resistors

Microcontroller

Shift Register

Wiring Details

Arduino UNO

74HC595 Shift Register

LEDs

Resistors

Documented Code

/*
 * This Arduino sketch controls a 74HC595 shift register to drive multiple LEDs.
 * The LEDs will alternate between two patterns, with a delay between each pattern.
 * The shift register is controlled via three pins: latch, clock, and data.
 */

int latchPin = 10; // Pin connected to ST_CP of 74HC595
int clockPin = 9;  // Pin connected to SH_CP of 74HC595
int dataPin = 11;  // Pin connected to DS of 74HC595
int dt = 250;      // Delay time between LED patterns

byte LED1s = 0b10101010; // First LED pattern
byte LED2s = 0b01010101; // Second LED pattern

void setup() {
  // Initialize serial communication
  Serial.begin(9600);
  // Set the latch, clock, and data pins as outputs
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}

void loop() {
  // Send the first LED pattern to the shift register
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, LSBFIRST, LED1s);
  digitalWrite(latchPin, HIGH);
  delay(dt);
  // Send the second LED pattern to the shift register
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, LSBFIRST, LED2s);
  digitalWrite(latchPin, HIGH);
  delay(dt);
}

This code is designed to run on the Arduino UNO microcontroller. It initializes the pins connected to the 74HC595 shift register and alternates between two LED patterns with a delay specified by the dt variable. The shiftOut function is used to send the pattern to the shift register, which then updates the state of the LEDs.