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

ESP32-CAM and Arduino Nano Touch-Activated Security System with Buzzer and LED

View and Edit Project In Cirkit DesignerImage of ESP32-CAM and Arduino Nano Touch-Activated Security System with Buzzer and LED

Circuit Documentation

Summary

This circuit involves an Arduino Nano microcontroller interfacing with a touch sensor, a red LED, a buzzer, and an ESP32-CAM module. The touch sensor is used to detect user input, which then controls the LED and buzzer. The ESP32-CAM module is also integrated into the circuit for additional functionality.

Component List

  1. Touch Sensor

    • Pins: IO, VCC, GND
    • Description: A touch sensor used to detect user input.
    • Purpose in Circuit: Detects touch input to control other components.
  2. LED: Two Pin (red)

    • Pins: Cathode, Anode
    • Description: A red LED.
    • Purpose in Circuit: Provides visual feedback when the touch sensor is activated.
  3. ESP32 - CAM

    • Pins: 5V, GND, IO12, IO13, IO15, IO14, IO2, IO4, VOT, VOR, VCC, IO0, IO16, 3V3
    • Description: A camera module with Wi-Fi capabilities.
    • Purpose in Circuit: Provides additional functionality, potentially for capturing images or video.
  4. Buzzer

    • Pins: GND, IN
    • Description: A buzzer.
    • Purpose in Circuit: Provides audio feedback when the touch sensor is activated.
  5. Arduino Nano

    • Pins: D1/TX, D0/RX, RESET, GND, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11/MOSI, D12/MISO, VIN, 5V, A7, A6, A5, A4, A3, A2, A1, A0, AREF, 3V3, D13/SCK
    • Description: A small, complete, and breadboard-friendly microcontroller board.
    • Purpose in Circuit: Acts as the main controller for the circuit.

Wiring Details

Touch Sensor

LED: Two Pin (red)

ESP32 - CAM

Buzzer

Arduino Nano

Code Documentation

Arduino Nano Code

#define BUTTON_PIN 4 
#define USER_PIN 8

int isPressed = LOW, pres_state = LOW;

void setup() 
{
  pinMode(BUTTON_PIN, INPUT);
  pinMode(USER_PIN, INPUT); 

  pinMode(2, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(5, OUTPUT);
}

void loop() 
{
    if(digitalRead(USER_PIN) == HIGH && pres_state == LOW) pres_state = HIGH;
    else if(digitalRead(USER_PIN) == HIGH && pres_state == HIGH) pres_state = LOW;

    isPressed = digitalRead(BUTTON_PIN);

    if (isPressed != LOW && pres_state == HIGH)
    {
        digitalWrite(9, HIGH);
        digitalWrite(2, HIGH);
        digitalWrite(5, HIGH);
    } 
    else
    {
        digitalWrite(9, LOW);
        digitalWrite(2, LOW);
        digitalWrite(5, LOW);
    }
}

Code Explanation