A dual-board burglar alarm and surveillance system using STM32 for motion detection and ESP32 for full sensor integration, camera capture, buzzer alerts, OLED display, and web interface.
The STM32 handles PIR motion detection and sends a digital pulse to the ESP32, which then confirms intrusion with the AMG8833 thermal camera, monitors tampering via VL53L1X, and logs / alerts via web interface.
To clone this project:
git clone https://github.com/yourusername/Burglar-Alarm-System.git
cd Burglar-Alarm-System
cd Final_System_Prototype
cd RTOS_Buglar_Alarm_System
open RTOS_Buglar_Alarm_System.ino file in arduino ide - compile
cd ../
open coummnication directory as project in stm32cubeide - compile
paste the .bin file to stm32 board and run the code to test the functionality```To clone this project:git clone https://github.com/yourusername/Burglar-Alarm-System.gitcd Burglar-Alarm-Systemcd Final_System_Prototypecd RTOS_Buglar_Alarm_Systemopen RTOS_Buglar_Alarm_System.ino file in arduino ide - compilecd../open coummnication directory as project in stm32cubeide - compilepaste the.bin file to stm32 board and run the code to test the functionality```Features
- STM32 PIR Motion Detection: Sends a HIGH pulse on motion detection (PB4 → ESP32 GPIO).
- ESP32 Intrusion Confirmation: AMG8833 thermal camera checks for intrusions.
- Distance Monitoring: Detects tampering with VL53L1X ToF sensor.
- Camera Capture: Stores snapshots to SPIFFS on intrusion/tampering events.
- Buzzer Alerts: Patterns for confirmed intrusion and tampering.
- OLED Display: Shows
ARMED/DISARMEDsystem status. - Web Interface: Arm/disarm system, view alerts, last captured photo, alarm log.
- FreeRTOS Multitasking: Handles STM32 input, sensors, camera, buzzer, and display efficiently.
- STM32F4 Board (PIR input PA8, PB4 output for GPIO signal)
- ESP32 Development Board (GPIO input for STM32 PB4)
- AMG8833 Thermal Camera
- VL53L1X ToF Sensor
- OV3660 / ESP32-CAM
- SSD1306 OLED Display
- Buzzer
- Jumper wires, breadboard, power supply
Board
Component
Pin
STM32
PIR Input
PA8
STM32
Motion Signal Output
PB4 → ESP32 GPIO 13
ESP32
PIR Input from STM32
13
ESP32
Buzzer
12
ESP32
AMG8833 SDA/SCL
14 / 15
ESP32
VL53L1X SDA/SCL
Shared I2C
ESP32
Camera
OV3660 mapping (see code)
ESP32
OLED
Shared I2C
Setup Instructions- STM32: Upload the FreeRTOS-based PIR task code. PB4 will output a 200ms pulse on motion detection.
- ESP32: Upload ESP32 code. Connect PB4 from STM32 to ESP32 GPIO (13).
- Power both boards and connect sensors as described.
- Open Serial Monitor on ESP32 to see debug logs.
- Access Web Interface at ESP32 IP for live alerts, photos, and system status.
- PIR sensor on STM32 detects motion → PB4 HIGH pulse.
- ESP32 reads PB4 input → triggers AMG8833 thermal confirmation.
- Confirmed intrusion → buzzer, camera capture, and web log update.
- VL53L1X detects alarm tampering → triggers secondary alert and camera capture.
- OLED continuously shows system status (
ARMED/DISARMED). - Web interface updates alarms, intrusion status, last photo, and logs in real-time.
Task_PIR_AMG: Reads STM32 PIR GPIO → confirms intrusion via AMG8833.Task_TOF: Monitors distance sensor for tampering.Task_Camera: Captures and saves snapshots.Task_Buzzer: Controls buzzer patterns.Task_OLED: Updates OLED display.
- Ensure STM32 PB4 → ESP32 GPIO connection is direct and logic level compatible (3.3V).
- ESP32 polls PB4 every 100ms for motion detection.
- Time synchronized via NTP for accurate event logging.














Comments