Skip to content

Commit 3aa4ea1

Browse files
Project/claudia.cranganu (#1383)
* Smart Security System project * Update website/versioned_docs/version-fils_en/project/2026/claudia.cranganu/index.md Co-authored-by: Omer Genan <81963672+genan2003@users.noreply.github.com> * Added schematic image * Update Smart Security System final documentation * Update * Optimize schematic SVG --------- Co-authored-by: Omer Genan <81963672+genan2003@users.noreply.github.com>
1 parent 7622fb5 commit 3aa4ea1

4 files changed

Lines changed: 76 additions & 66 deletions

File tree

79.2 KB
Loading
47.9 KB
Loading
Lines changed: 75 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Smart Security System
22

3-
A modular security system for a miniature house with multi-sensor detection, configurable alerts, and remote access.
3+
A modular smart security system for a miniature house with multi-sensor detection, a web dashboard, Wi-Fi alerts, and physical siren control.
44

55
:::info
66

@@ -11,48 +11,31 @@ A modular security system for a miniature house with multi-sensor detection, con
1111

1212
## Description
1313

14-
This project is a modular security system for a miniature house, built on an STM32 development board and controlled through a companion app for remote access. The system can detect multiple types of security events: door opening, movement near the entrance, indoor motion, water leaks, and smoke detection. For each module, the user can independently choose the type of alert: a local sound alarm, a remote notification, or both. The system can be armed or disarmed remotely, and each security module can be turned on or off individually.
14+
This project is a modular smart security system built for a miniature house. It uses an STM32 development board together with several sensors placed around the model: magnetic sensors for the front and back doors, PIR sensors for indoor motion detection, ultrasonic sensors for perimeter monitoring, water sensors for flood detection, and an MQ-2 sensor for gas/smoke detection.
15+
16+
The system is controlled through a web dashboard, where each sensor can be configured individually. The user can arm or disarm each module, choose between notification, loud alarm, or both, and mark a sensor as faulty if it does not behave correctly. Alerts from the STM32 are sent to the Node.js server through the ESP-01 Wi-Fi module. For reliable physical siren control, the server sends commands back to the STM32 through the board’s USB USER port.
1517

1618
## Motivation
1719

18-
The inspiration for this project came from my own house, which already has security systems in place for things like doors and flood detection. I wanted to recreate something similar in a miniature form, combining the sensors I find most useful in real life into one system that I could actually build and control myself. It was a good opportunity to understand how these kinds of systems work from the inside.
20+
The inspiration for this project came from my own house, which already has security systems in place for things like doors and flood detection. I wanted to recreate something similar in a miniature form, combining the sensors I find most useful in real life into one system that I could actually build and control myself. It was a good opportunity to understand how these kinds of systems work from the inside.
1921

2022
## Architecture
2123

22-
The system is organized into four main components that work together to provide detection, decision-making, alerting, and remote control.
23-
24-
- **Sensor Layer:** This layer includes all the sensors used by the system: the magnetic door sensor, PIR motion sensor, ultrasonic sensor, water sensor, and smoke sensor. Each sensor is responsible for detecting a specific type of event and sending the corresponding signal to the microcontroller.
25-
- **STM32 Controller:** The STM32 acts as the core of the system. It reads the sensor inputs, checks the current configuration of the system, and decides how to respond depending on whether the system is armed, which modules are active, and which alert type is selected.
26-
- **Communication Module:** This module provides the connection between the STM32 and the companion application. It is used to send notifications and system status information, while also receiving commands related to arming, disarming, and module configuration.
27-
- **Companion Application:** The application offers the user an interface for interacting with the system remotely. It allows arming or disarming the system, enabling or disabling individual modules, selecting the alert type for each module, and monitoring the current status of the system.
28-
29-
```text
30-
┌─────────────────────────────────────────────────────────┐
31-
│ Sensor Layer │
32-
│ [Door] [PIR] [Ultrasonic] [Water] [Smoke] │
33-
└────────────────────┬────────────────────────────────────┘
34-
│ GPIO / ADC
35-
┌────────────────────▼────────────────────────────────────┐
36-
│ STM32 Controller │
37-
│ - Armed/disarmed state │
38-
│ - Module activation logic │
39-
│ - Alert selection logic │
40-
│ - Buzzer + LED output control │
41-
└────────────────────┬────────────────────────────────────┘
42-
│ UART / SPI / I2C
43-
┌────────────────────▼────────────────────────────────────┐
44-
│ Communication Module │
45-
│ Wi-Fi data exchange │
46-
└────────────────────┬────────────────────────────────────┘
47-
│ Wireless
48-
┌────────────────────▼────────────────────────────────────┐
49-
│ Companion Application │
50-
│ - Arm / Disarm │
51-
│ - Module control │
52-
│ - Alert configuration │
53-
│ - Status monitoring │
54-
└─────────────────────────────────────────────────────────┘
55-
```
24+
The system is organized into several components that work together for detection, communication, remote configuration, and physical alert control.
25+
26+
- **Sensor Layer:** This layer includes all the sensors installed on the miniature house: magnetic sensors for the front and back doors, PIR sensors for indoor motion detection, ultrasonic sensors for perimeter monitoring, water sensors for flood detection, and the MQ-2 gas/smoke sensor. Each sensor detects a specific type of event and sends its signal to the STM32 board through GPIO or ADC pins.
27+
28+
- **STM32 Controller:** The STM32 is the embedded core of the system. It reads all sensor inputs, detects state changes, handles local sensor logic, and sends alert messages when an event occurs. It also controls the physical LEDs and the siren output, but the final decision for when the siren should sound is received from the web application through the USB USER port.
29+
30+
- **ESP-01 Wi-Fi Module:** The ESP-01 module is used for communication from the STM32 to the Node.js server. When a sensor is triggered, the STM32 sends an alert message through UART to the ESP-01, which forwards it to the server. This path is used for sensor alerts and status updates.
31+
32+
- **Node.js Server:** The Node.js server receives alerts from the STM32, stores the current system state, applies the configuration selected by the user, and updates the web dashboard. It decides whether an event should be treated as a notification, a loud alarm, or both.
33+
34+
- **USB USER Command Channel:** The board's USB USER port is used as a direct command channel from the Node.js server back to the STM32. This is used for reliable physical siren control. When the web application decides that a loud alarm is needed, the server sends `SIREN_ON` through USB. When the alarm is cleared, it sends `SIREN_OFF`.
35+
36+
- **Web Dashboard:** The web dashboard is the user interface of the system. It allows the user to arm or disarm each sensor, choose the alert mode, mark faulty sensors, view notifications, clear alarms, and monitor the current state of the miniature house.
37+
38+
![Architecture](./architecture.webp)
5639

5740
## Log
5841

@@ -70,11 +53,33 @@ I started working on the physical structure of the project by building the minia
7053

7154
![Miniature house in progress](house.webp)
7255

56+
### Week 10-11
57+
58+
I tested all sensors together with the siren and status LEDs. At this stage, the siren was triggered by any active sensor, which helped me verify the basic detection logic. I organized the wiring, updated the schematic, and started integrating everything into the miniature house.
59+
60+
I also built the doors from hard plexiglass and attached them with small hinges so the magnetic door sensors could be tested more realistically.
61+
62+
### Week 12-13
63+
64+
I started working on the Wi-Fi communication using the ESP-01 module and its adapter. I also added a capacitor for better power stability. During this stage, I tested how alerts are sent from the STM32 to the Node.js server and worked on the first version of the web dashboard.
65+
66+
The dashboard was updated to display sensor alerts, event logs, notifications, and individual sensor settings.
67+
68+
### Week 14
69+
70+
I finalized the communication and alert system. Since sending the siren decision back through the ESP-01 was not reliable, I used the board’s USB USER port as a direct command channel from the Node.js server to the STM32. This allows the dashboard to turn the physical siren on or off depending on the selected alert mode.
71+
72+
I also finished the final dashboard design, added per-sensor options such as armed/disarmed, notification/loud/both, and faulty sensor marking, then tested the full system on the miniature house.
73+
74+
![Final smart security system setup](house_sch.webp)
75+
7376
## Hardware
7477

75-
The system uses an STM32 development board as the main controller. It receives input from the sensors, processes the security logic, and controls both the local alert outputs and the wireless communication with the companion application.
78+
The system uses an STM32 development board as the main controller. It receives input from all sensors, processes the local detection logic, controls the status LEDs and the physical siren output, and communicates with the web application through the ESP-01 Wi-Fi module and the board’s USB USER port.
79+
80+
The hardware setup includes multiple sensors, each covering a different security or safety scenario. Two magnetic sensors are used for the front and back doors, three PIR sensors are used for indoor motion detection, two ultrasonic sensors are used for perimeter monitoring, three water sensors are used for flood detection, and an MQ-2 sensor is used for gas/smoke detection. The system also includes visual feedback LEDs, a physical siren for loud alarms, and an ESP-01 module with an adapter for Wi-Fi communication.
7681

77-
The hardware setup includes multiple sensors, each covering a different security scenario: a magnetic sensor for door monitoring, a PIR sensor for indoor motion detection, an ultrasonic sensor for perimeter monitoring, a water sensor for flood detection, and a gas sensor for fire-related situations. For local feedback, the system will use an acoustic alert output and visual status indicators, while remote communication is handled through a Wi-Fi module.
82+
The ESP-01 module sends alerts from the STM32 to the Node.js server, while the USB USER connection is used as a direct command channel from the server back to the STM32 for reliable siren control.
7883

7984
## Schematics
8085

@@ -87,39 +92,44 @@ The hardware setup includes multiple sensors, each covering a different security
8792
| STM32 Development Board | Main microcontroller | 120 RON |
8893
| Ultrasonic Sensor (HC-SR04P) x2 | Perimeter monitoring | 20 RON |
8994
| Water Sensor x3 | Flood detection | 5 RON |
90-
| Gas / Smoke Sensor (MQ-2) | Smoke detection | 10 RON |
91-
| Breadboard (MB102) | Circuit prototyping | 17 RON |
92-
| Piezo Buzzer | Local sound alert | 8 RON |
93-
| Magnetic Door Sensor (MC38) x2 | Door monitoring | 12 RON |
94-
| Wi-Fi Module (ESP8266 ESP-01) | Wireless communication | 21 RON |
95-
| ESP-01 Adapter Module | ESP8266 support module | 10 RON |
95+
| Gas / Smoke Sensor (MQ-2) | Gas / smoke detection | 10 RON |
96+
| Breadboard (MB102) | Circuit prototyping and connections | 17 RON |
97+
| Magnetic Door Sensor (MC38) x2 | Front and back door monitoring | 12 RON |
98+
| Wi-Fi Module (ESP8266 ESP-01) | Wireless communication with the server | 21 RON |
99+
| ESP-01 Adapter Module | 5V adapter for the ESP-01 module | 10 RON |
100+
| Electrolytic Capacitor 470uF, 25V | ESP-01 power stabilization | 0.5 RON |
96101
| LEDs + Resistors + Jumpers | Visual indicators and circuit support | 15 RON |
97-
| LED Bar Display (10-segment) | Status indication | 5 RON |
98102
| PIR Sensor (SR602) x3 | Indoor motion detection | 25 RON |
99-
| Alarm Siren | Acoustic alert output | 23 RON |
103+
| Alarm Siren | Physical loud alarm output | 23 RON |
100104

101105
## Software
102106

103-
| Library | Description | Usage |
104-
|---------|-------------|-------|
105-
| `embassy-stm32` | Embassy HAL for STM32 microcontrollers | GPIO, timers, UART, sensor integration |
106-
| `embassy-executor` | Async task executor | Running concurrent tasks for sensors and alerts |
107-
| `embassy-time` | Async timers and delays | Timing, debouncing, periodic checks |
108-
| `embassy-sync` | Synchronization primitives for Embassy | Shared state between async tasks |
109-
| `embassy-futures` | Utilities for async control flow | Task coordination and async logic |
110-
| `embedded-hal` | Hardware abstraction traits for embedded systems | Generic sensor and peripheral interfaces |
111-
| `cortex-m` | ARM Cortex-M support crate | Low-level MCU support |
107+
| Library / Tool | Description | Usage |
108+
|----------------|-------------|-------|
109+
| `embassy-stm32` | Embassy HAL for STM32 microcontrollers | GPIO, ADC, UART, USB, timers, and sensor integration |
110+
| `embassy-executor` | Async task executor | Running the main embedded application |
111+
| `embassy-time` | Async timing library | Delays, stabilization periods, debouncing, and periodic sensor checks |
112+
| `embassy-futures` | Async utilities | Running the USB control task and the sensor monitoring task in parallel |
113+
| `embassy-usb` | USB support for Embassy | USB USER communication between the Node.js server and the STM32 |
114+
| `defmt` | Embedded logging framework | Structured debug and status logs during development |
115+
| `defmt-rtt` | RTT transport for `defmt` logs | Displaying STM32 logs through the debugger |
116+
| `panic-probe` | Panic handler for embedded debugging | Printing panic information through the probe/debug interface |
117+
| `cortex-m` | ARM Cortex-M support crate | Low-level support for the STM32 microcontroller |
112118
| `cortex-m-rt` | Runtime crate for Cortex-M devices | Startup and interrupt vector support |
113-
| `panic-halt` | Minimal panic handler | Safe stop on unrecoverable errors |
114-
| `heapless` | Fixed-capacity data structures for `no_std` systems | Buffers, queues, and small data storage |
115-
| UART / Serial communication layer | Communication with the ESP8266 module | Sending commands and receiving remote control data |
116-
| Companion app framework (TBD) | Interface for remote control and notifications | User interaction and system monitoring |
119+
| ESP8266 AT commands | UART-based communication with the ESP-01 module | Connecting to Wi-Fi and sending sensor alerts to the Node.js server |
120+
| Node.js | JavaScript runtime | Running the web dashboard server and alert receiver |
121+
| Node.js `http` module | Built-in HTTP server module | Serving the dashboard and API routes |
122+
| Node.js `net` module | Built-in TCP server module | Receiving alert messages from the STM32 through the ESP-01 |
123+
| Node.js `usb` package | USB communication package | Sending `SIREN_ON` and `SIREN_OFF` commands from the server to the STM32 |
124+
| HTML / CSS / JavaScript | Frontend technologies | Web dashboard interface, sensor cards, notifications, settings, and event log |
117125

118126
## Links
119127

120128
1. [Embassy documentation](https://embassy.dev/)
121-
2. [STM32 NUCLEO-U545RE-Q product page](https://www.st.com/en/evaluation-tools/nucleo-u545re-q.html)
122-
3. [ESP8266 overview](https://www.espressif.com/en/products/socs/esp8266)
123-
4. [HC-SR04 ultrasonic sensor datasheet](https://cdn.sparkfun.com/datasheets/Sensors/Proximity/HCSR04.pdf)
124-
5. [MQ-2 gas sensor datasheet](https://www.pololu.com/file/0J309/MQ2.pdf)
125-
6. [SR602 PIR sensor page / datasheet](https://www.robotics.org.za/SR602)
129+
2. [Embassy Book](https://embassy.dev/book/)
130+
3. [STM32 NUCLEO-U545RE-Q product page](https://www.st.com/en/evaluation-tools/nucleo-u545re-q.html)
131+
4. [ESP-01 Wi-Fi Module datasheet](https://academy.cba.mit.edu/classes/networking_communications/ESP8266/esp01.pdf)
132+
5. [HC-SR04 ultrasonic sensor datasheet](https://cdn.sparkfun.com/datasheets/Sensors/Proximity/HCSR04.pdf)
133+
6. [MQ-2 gas sensor datasheet](https://www.pololu.com/file/0J309/MQ2.pdf)
134+
7. [SR602 PIR sensor datasheet](https://uelectronics.com/wp-content/uploads/2026/01/AR4812-SR602-Mini-Sensor-PIR-Datasheet.pdf)
135+
8. [Node.js USB package](https://www.npmjs.com/package/usb)

website/versioned_docs/version-fils_en/project/2026/claudia.cranganu/kicad_project.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)