Skip to content

SarmaHighOnCode/robotsecurity

Repository files navigation

ESP32-CAM Security Bot with Voice Command Control

1. Project Overview

This project builds a mobile security robot powered by the ESP32-CAM module with OV3660 camera. The robot combines live video surveillance with voice command control, PIR motion detection, and a pan-tilt camera system. It patrols autonomously, detects intruders, streams live footage over WiFi, and responds to spoken commands. The entire system runs on battery power (2x 18650 Li-ion cells) and communicates via WiFi for remote monitoring through a browser-based dashboard.

1a. Key Features

  • Live MJPEG video streaming over WiFi to any browser
  • Voice command recognition via INMP441 I2S MEMS microphone (4–6 commands)
  • PIR motion detection with automatic camera capture and buzzer alert
  • Pan-tilt camera mount with 2x SG90 servos for surveillance sweep
  • Mobile robot platform with L298N + dual BO motors for patrol
  • 1.8" TFT LCD dashboard showing mode, battery, WiFi status
  • Audio output via PAM8403 amplifier + 3W speaker for voice alerts
  • Web-based remote control dashboard with live stream
  • Rotary encoder for local menu navigation on TFT display

1b. System Architecture

The ESP32-CAM serves as the central controller, handling camera capture, WiFi streaming, I2S audio input, servo control, motor drive, display rendering, and web server hosting simultaneously. The architecture is event-driven: PIR interrupts trigger the security pipeline, voice commands trigger motor actions, and the web dashboard provides remote override control.


2. Bill of Materials

Component Qty Category
ESP32-CAM WiFi/BT with OV3660 Camera (2MP) 1 CORE
CH340G USB to Serial Converter 1 CORE
4-Ch 3.3V-5V Bi-Directional Logic Level Converter 1 CORE
PCF8574 I2C GPIO Expander (8-ch) 1 CORE
HC-SR501 PIR Motion Sensor + IR Combo 1 SENSORS
INMP441 MEMS I2S Omnidirectional Microphone 1 SENSORS
KY-040 Rotary Encoder Module 1 SENSORS
1.8" ST7735 TFT LCD (128x160, SPI) 1 DISPLAY
3W 4Ω Speakers x2 + PAM8403 Amp Combo 1 AUDIO
5V Active & Passive Buzzers 3 AUDIO
TowerPro SG90 Mini Servo (180°) 2 MOTORS
SG90 Pan-Tilt Camera Mount Kit 1 MOTORS
L298N Dual Motor Driver 1 MOTORS
Dual BO Shaft DC Gear Motors + Wheels 1 MOTORS
18650 Li-Ion 2200mAh Battery (3.7V) + Holder 2 POWER
TP4056 Charge+Protection Module 2 POWER
LM2596S DC-DC Buck Converter 2 POWER
MT3608 DC-DC Boost Converter 2 POWER
Assorted passives (Caps, Resistors, Diodes, Transistors) - PASSIVE
Robot Chassis (3D Printed) 1 MECH

3. Electrical Architecture

  • Battery Pack: 2x 18650 in series -> 7.4V nominal (8.4V full, 6.4V cutoff).
  • 5V Rail: 7.4V -> LM2596S buck converter -> 5.00V. Powers ESP32-CAM VIN, SG90 servos, PAM8403 amplifier, L298N 5V logic pin.
  • Motor Drive: 7.4V directly to L298N VMS pin. Feed 5V externally from LM2596S to L298N 5V pin.
  • Audio Input (INMP441): I2S interface to ESP32-CAM.
  • Audio Output: ESP32 PWM output -> RC low-pass filter -> PAM8403 amplifier input -> 3W 4Ω speaker.
  • Display (ST7735): SPI interface. 3.3V logic compatible.
  • Servo Signals: ESP32 GPIO (3.3V) -> 4-ch logic level shifter -> 5V signal to SG90 servos.
  • PIR Sensor: HC-SR501 output is 3.3V logic. Direct connection to ESP32 GPIO.

3a. Power Flow Diagram

18650 x2 (series) -> 7.4V -> [Battery Holder Switch] -> LM2596S Buck -> 5.00V Rail Motors are powered from 7.4V directly through L298N VMS pin, not the regulated 5V rail.


4. Electrical Safety Notes

  • ⚠️ FIRE RISK (TP4056): Standard TP4056 ships with 1.2kΩ PROG resistor = 1A charge current. Safe for 2200mAh cells.
  • ⚠️ CRITICAL (Voltage Converters): MT3608 can output up to 28V. LM2596 passes near-full input voltage when untuned. MANDATORY: Tune to 5.00V with multimeter BEFORE connecting any board.
  • ⚠️ CRITICAL (Buzzer): Active buzzer draws 30–80mA at 5V. ESP32 GPIO max is 20mA at 3.3V. MUST use BC547 transistor driver with 1N4148 flyback diode.
  • ⚠️ AWARENESS (ESP32-CAM Pins): GPIO0 is flash/boot. GPIO2 and GPIO12 are strapping pins. GPIO25/26 are locked by camera VSYNC/SIOC.
  • ⚠️ AWARENESS (L298N): Remove onboard 5V jumper. Feed 5V externally from LM2596S.

5. Software Architecture

  • Camera Streaming Module: MJPEG HTTP server on port 80 at VGA resolution.
  • Voice Command Module: Reads I2S DMA buffers from INMP441. Processes audio frames for keyword spotting (patrol, stop, left, right, alert, status).
  • Security Module: PIR interrupt handler triggers security pipeline: capture frame, activate buzzer, send WiFi notification.
  • Motor Control Module: L298N direction pins controlled via PCF8574 I2C GPIO expander. ENA/ENB driven by ESP32 LEDC hardware PWM.
  • Display Module: SPI driver for ST7735 TFT. Renders dashboard.
  • Web Dashboard Module: ESPAsyncWebServer hosts HTML/JS/CSS dashboard embeddings MJPEG stream and WebSockets for control.

6. Build Roadmap

  1. Pre-build: GPIO Map, Tune Buck/Boost converters, build buzzer driver circuit.
  2. Phase 1: ESP32-CAM Basic Setup (Camera server test)
  3. Phase 2: Voice Input (INMP441 raw capture)
  4. Phase 3: Audio Output (PWM + PAM8403 + Speaker filter)
  5. Phase 4: PIR Motion Detection + Security Logic
  6. Phase 5: Pan-Tilt Camera Mount calibration
  7. Phase 6: Voice Command Recognition model training
  8. Phase 7: Mobile Robot Drive integration
  9. Phase 8: TFT Display Dashboard construction
  10. Phase 9: Web Dashboard + Live Stream integration
  11. Phase 10: Power System Integration
  12. Phase 11 & 12: Full Integration, Chassis Mount, and Documentation

7. Skills Developed

  • Embedded Systems: PWM servo control, I2S audio protocol, SPI display interface, Motor driver (H-bridge), Interrupt-driven sensors, GPIO management, Power regulation.
  • AI / Voice / Audio: Voice command recognition, TinyML / Edge Impulse, FFT audio processing, Keyword spotting, Real-time audio DSP.
  • IoT / Systems / Design: WiFi live video streaming, MJPEG HTTP server, WebSocket real-time comms, Async web dashboard, 3D CAD + printing, Full-stack IoT architecture.

About

A mobile security robot powered by ESP32-CAM featuring live video surveillance, voice command control, PIR motion detection, and a pan-tilt camera system.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages