Loading 3D model… large boards can take a moment.
A professional, budget-friendly embedded security system built around a custom PCB and the ESP32 DevKit V1. This project utilizes an optical multi-bounce laser path bounced across real glass mirrors to form a tight perimeter grid, monitored dynamically by an onboard Light Dependent Resistor (LDR).
GPIO 18 instantly clears the alarm, silences the buzzer, and re-arms the system.The system hosts a real-time responsive dashboard providing live telemetry, node statuses, and toggle configurations.
| Central Telemetry Instrumentation | Edge Sensor Matrix Nodes |
|---|---|
To guarantee fail-safe alerts and zero telemetry loss, the firmware maintains six independent network connections across local and global layers:
HTTP-Local) and direct internet access (HTTP-Router).MQTT-Local) and a remote cloud cluster (MQTT-Cloud).NTFY-Local) and a global web server (NTFY-Global).The circuit diagram maps out the ESP32 interface, sensor voltage dividers, and laser control lines for low-noise operation.
The custom board features a compact form factor, dedicated mounting holes, and clear silkscreen labeling.
| Front Layout | Back Layout |
|---|---|
To achieve complete optical isolation and filter out ambient environmental light, a custom-molded mounting shroud was engineered.
| Isometric View | Front View | Back View |
|---|---|---|
Design Specifications:
The combined views show the mechanical shroud assembly bolted directly onto the electronic control circuit board.
| Assembly Top View | Assembly Solder Side View |
|---|---|
The system uses two separate power paths to stop electrical noise from the laser from messing with the ESP32 and sensors.
Powers the main controller and sensor board.
Powers the laser module independently with zero physical connection to the main board.
esp32-laser-security/
├── src/ # 💻 Firmware Source Code (PlatformIO)
│ ├── main.cpp # └── Main security system logic
│ └── testing/ # └── Isolated hardware testing scripts
│ └── laser-connected-esp.cpp
│
├── esp32-laser-security-pcb/ # 🛠️ KiCad Hardware Design Files
│ ├── *.kicad_sch # └── Circuit schematic
│ └── *.kicad_pcb # └── PCB routing layout
│
├── production/ # 📦 Manufacturing & 3D Printing Files
│ ├── gerbers/ # └── PCB manufacturing files (Gerbers)
│ ├── 3d_printing/ # └── 3D-printable mount shroud (.STL / .3MF)
│ └── step_models/ # └── 3D CAD assembly model (.STEP)
│
├── assets/ # 🖼️ Documentation Media
│ ├── circuit_schematic.png # └── Circuit diagram for README
│ ├── pcb_raw_*.png/jpg # └── 3D images of unmounted PCB
│ ├── mount_*.jpg # └── 3D images of standalone plastic mount
│ └── pcb_assembled_*.jpg # └── Photos of the final assembly
│
├── platformio.ini # ⚙️ Project configuration & libraries
└── README.md # 📖 Main project documentation guide
| Component | Quantity | Purpose |
|---|---|---|
| ESP32-S3 DevKitC-1 N16R8 | 1 | Central processing unit & real-time monitoring engine |
| SYD1230 650nm 5mW Red Laser Module | 1 | Focusable transmitter node optimized for budget-friendly bouncing |
| Light Dependent Resistor (LDR) | 1 | High-sensitivity optical receiver |
| SFM-27 Active Piezo Buzzer (Continuous Sound) | 1 | 3–24V high-decibel audible indicator; allows the ESP32 to cleanly drive custom dual-frequency police siren sweeps without internal timing conflicts |
| First-Surface Mirrors / HDD Platters | 2–4 | Zero-ghosting high-reflectivity corner reflection nodes |
| Metal Film Resistor (10 kΩ) | 1 | Pull-down resistor for the analog voltage divider circuit |
| Metal Film Resistor (330 Ω) | 2 | Current-limiting protection resistors (e.g., for status LEDs) |
| Metal Film Resistor (220 Ω) | 2 | Current-limiting protection resistors (e.g., for buzzer power constraints) |
| 6x6x5mm Tactile Push Button Switch | 1 | PCB-mount tactile switch for instant manual system reset or calibration |
| 7×1 Pin Male Berg Header (Straight, 10mm Height, 2.54mm Pitch) | 1 | Breakout interface connector for peripheral GPIO programming/debugging pins |
| XY126V-5.0-2P Green Screw Terminal Block (5mm Pitch, Through Hole) | 1 | XINLAIYA 10A 300V power connector with wire protection for external main DC input |
| 3 Pin JST XH 2.5mm Top Entry Header (Straight Male & Female Pair) | 1 | Polarity-keyed locking connector for secure LDR receiver wire routing |
| Socket Head Cap Screw (M3x12) | 2 | High-strength mechanical fasteners for enclosure or PCB corner mounting |
| M3 Stainless Steel Hex Nut | 2 | Matching rust-resistant hexagonal nuts to secure the M3 mounting screws safely |
To achieve a clean optical baseline and prevent room lighting from flooding the sensor, the LDR must be housed inside an opaque, dark isolation tube pointed directly down the incoming laser path.
+-----------------------------------------------------------------+
| ESP32-S3 DevKitC-1 N16R8 |
+-----------------------------------------------------------------+
| GPIO 4 (ADC) | <-------> Pin 1: LDR (R1 Sensor Output Node)
| GPIO 18 | <-------- Pin 2: RST (Reset Push Button SW1)
| GPIO 5 | --------> Pin 3: BUZZ (External Buzzer J3)
| GPIO 19* | --------> Pin 4: GRN (Green LED Control Rail)
| GPIO 21* | --------> Pin 5: RED (Red LED Control Rail)
| GND | --------> Pin 6: GND (Common System Ground)
| 3V3 | --------> Pin 7: 3V3 (System Power Input)
+-----------------------------------------------------------------------------------+
| EXTERNAL COMPONENT CONNECTIONS |
+-----------------------------------------------------------------------------------+
| |
| [ PCB Header J1 ] --------------------> Connects to EXTERNAL RG LED |
| (EXT. RG LED) - Pin R: Red Indicator Anode |
| - Pin G: Green Indicator Anode |
| - Pin -: Common Ground Rail |
| |
| [ PCB Header J3 ] --------------------> Connects to EXTERNAL ACTIVE BUZZER |
| (EXT. BUZZER) - Pin +: Positive Audio Signal Input |
| - Pin -: Negative Ground Return |
| |
+-----------------------------------------------------------------------------------+
3V3 Rail -----[ LDR ]-----+-----> GPIO 34 (Analog Read Input)
|
[ 10kΩ Resistor ]
|
GND Rail
Note: Powering the LDR network from the 3V3 rail protects the ESP32's 12-bit ADC pins from 5V over-voltage degradation.
This project is built using PlatformIO IDE inside VS Code for robust environment management and smaller, compiled binary footprints.
[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
monitor_speed = 115200
# Force the compiler to disable PSRAM tracking to prevent boot panics
build_flags =
-DBOARD_HAS_PSRAM=0
-DARDUINO_USB_CDC_ON_BOOT=1
# Specify LittleFS partitioning layout
board_build.filesystem = littlefs
# Standard partition table for an 8MB Flash device (No PSRAM)
board_build.partitions = default_8MB.csv
lib_deps =
esphome/ESPAsyncWebServer-esphome @ ^3.2.2
knolleary/PubSubClient @ ^2.8
# Tell PlatformIO to compile everything in src, EXCEPT the testing folder
build_src_filter = +<*> -<testing/>
Clone this repository to your local workspace:
git clone https://github.com/JaswantBhartiya/esp32-laser-security.git
Open the project folder directly inside Visual Studio Code with the PlatformIO extension active.
Align your external laser node across your mirror grid so it hits the center of the LDR tube.
Click the PlatformIO: Upload arrow icon on the bottom status bar (or press (Ctrl + Alt + U) to compile and flash the firmware.
Open the Serial Monitor (Ctrl + Alt + M) at 115200 baud to watch the system run its initial calibration profiling.
+------------------+
| STATE_CALIBRATING| <-------- On Boot / User Reset
+------------------+
|
v (Samples light & computes threshold)
+------------------+
+--->| STATE_ARMED |
| +------------------+
| |
| v (Beam broken for >50ms)
| +------------------+
| | STATE_BREACHED |
| +------------------+
| |
+--------------+ (Reset Button Pressed)
50ms to filter out false alarms from dust or bugs.GPIO 5 using non-blocking microsecond delays.GPIO 18. Pressing the reset button instantly mutes the buzzer and recalibrates the system back to Armed mode.$$\text{Threshold} = \frac{\text{Laser Intensity} + \text{Ambient Light}}{2}$$
| Issue | Root Cause | Quick Fix |
|---|---|---|
| Instant alarm on boot | Laser missed the LDR during calibration. | Re-align the laser and press the reset button to recalibrate. |
| Beam broken, no alarm | Side-glare or ambient room light is bleeding into the sensor. | Move away from windows or use a longer 3D-printed shroud to block ambient light. |
| Siren flickers/jitters | Laser dot is slightly misaligned or vibrating on the edge of the sensor. | Tighten your laser/mirror mounts to eliminate physical jitter. |
To see the complete multi-phase development timeline—including planned v2.0 hardware protection circuits, v3.0 wireless IoT feature tracking, and long-term mechanical upgrades—view the project's growth pipeline:
This project is licensed under the MIT License - see the LICENSE file for details.
No comments yet. Be the first to ask about this board.