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

ESP32-CAM and 74HC595 Controlled LED Array with Battery Power

View and Edit Project In Cirkit DesignerImage of ESP32-CAM and 74HC595 Controlled LED Array with Battery Power

Circuit Documentation

Summary

This circuit involves an ESP32-CAM microcontroller, a 74HC595 shift register, multiple 4066 analog switches, resistors, and LEDs. The ESP32-CAM controls the shift register, which in turn controls the analog switches. The analog switches are used to control the LEDs through resistors. The circuit is powered by a 9V battery.

Component List

  1. 74HC595 Shift Register

    • Description: 8-bit serial-in, serial or parallel-out shift register with output latches.
    • Pins: Q0-Q7, DS (DATA), OE (Enable), ST_CP (RCLK), SH_CP (SRCLK), MR (SRCLR), Q7' (QH), GND, VCC
  2. ESP32-CAM

    • Description: A low-cost microcontroller with integrated Wi-Fi and Bluetooth, featuring a camera module.
    • Pins: 5V, GND, IO0, IO2, IO4, IO12, IO13, IO14, IO15, IO16, VOT, VOR, VCC, 3V3
  3. 4066 Analog Switch

    • Description: Quad bilateral switch.
    • Pins: X1 (Input 1), Y1 (Output 1), X2 (Input 2), Y2 (Output 2), A1 (Control A), A2 (Control B), A3 (Control C), A4 (Control D), X3 (Output 3), Y3 (Input 3), X4 (Output 4), Y4 (Input 4), GND, VCC
  4. 9V Battery

    • Description: Power source for the circuit.
    • Pins: +, -
  5. Resistor

    • Description: 200 Ohms resistor.
    • Pins: pin1, pin2
  6. LED: Two Pin (red)

    • Description: Red LED.
    • Pins: cathode, anode

Wiring Details

74HC595 Shift Register

ESP32-CAM

4066 Analog Switch

9V Battery

Resistor

LED: Two Pin (red)

Code Documentation

sketch.ino

int latchPin = 13;  // ST_CP
int clockPin = 15;  // SH_CP
int dataPin = 12;   // DS

void setup() {
  pinMode(dataPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(latchPin, OUTPUT);

  Serial.begin(9600);
  Serial.print("Start...");
  setSwitch(B00000000);
}

void setSwitch(byte status) {
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST, status);
  digitalWrite(latchPin, HIGH);
}

void loop() {
  setSwitch(B01001000);
  delay(1000);
  setSwitch(B10110111);
  delay(1000);
}

This code initializes the ESP32-CAM to control the 74HC595 shift register. The setSwitch function sets the state of the shift register, which in turn controls the analog switches. The loop function alternates the state of the switches every second.