The aim of this project is to create a functional prototype of a security system for monitoring a newly built property. The system uses an ESP32 microcontroller, two HLK-LD2410S mmWave motion sensors, LED indicators, an audible alarm, UPS power monitoring, and a Bluetooth mobile application for system control and status display.
The system is designed to detect movement in a room and inform the user about the status of the security system, sensors, and power supply.
1.2 Project Objectives- To create a 3D model of an enclosure that can hold the ESP32, sensors, LED elements, buzzers, and other required components.
- To design an electrical circuit that connects two HLK-LD2410S sensors, the ESP32, an addressable LED strip, audible alarm devices, a UPS power supply system, and a power status detection circuit.
- To develop ESP32 software that reads sensor data, controls the alarm operation, LED indication, buzzers, UPS status, and Bluetooth data exchange with the mobile application.
- To create a mobile application that allows the user to arm and disarm the security system, as well as display the status of the sensors, alarm, and UPS.
The HLK-LD2410S is an mmWave radar sensor that uses high-frequency electromagnetic waves to detect the presence and movement of objects in a room. The sensor emits radio waves and receives their reflection from a person or another object. Based on changes in the reflected signal, the sensor determines whether there is a moving or stationary object in the area.
Movement is detected using the Doppler effect. When a person moves, the frequency of the reflected signal changes slightly. The sensor can also detect a personβs presence even when they are almost motionless, because it can detect very small movements, such as breathing or body micro-movements.
The sensor processes the received signals and determines the approximate distance of the object from the sensor. This information is sent to the ESP32 microcontroller, where the program checks the sensor status. If the security system is armed and one of the sensors detects movement, the ESP32 activates the alarm, LED indication, and sends the status to the mobile application.
These sensors can detect movement within a range of approximately 8 meters and a 60-degree angle. To cover the required newly built property, three such prototypes need to be used.
Also, before using the sensors, they need to be calibrated. That happens using a UART USB interface and connecting it to the official app. Then you can generate the thresholds, set the parameters, and adjust them.
For this project, I created a custom 3D model β an enclosure for the device that holds all the required components. The model was specifically designed so that:
- LED strips could be attached at the top and bottom of the enclosure.
- There would be space to mount the ESP32 controller, UPS module, and step-down converter.
- A hole would be placed at the bottom for installing the DC jack.
- The enclosure would be divided into two parts, allowing one side to be unscrewed. I also planned the screw holes and precise locations for inserting metal threaded inserts for the screws.
In the end, I divided the enclosure into three parts to make it easier to 3D print and later assemble all the components inside. The enclosure was designed using Autodesk Fusion. After that, I printed it with a Bambu Lab X2D 3D printer using white PLA plastic filament.
The device is powered through a 12 V DC jack. From there, the voltage is supplied to a step-down converter, which reduces the voltage from 12 V to 5 V. These 5 V are then supplied to a UPS module, which has two 18650 Li-ion batteries connected to it. The UPS provides a stable 5 V power supply for the system even if the external power source is lost.
A switch is placed between the UPS output and the rest of the circuit. This switch makes it possible to disconnect the UPS power from the ESP32. This is necessary so that, when the ESP32 is connected to a computer via USB, there is no conflict between the USB power supply and the UPS power supply.
The main control element of the system is the ESP32 microcontroller. Two HLK-LD2410S mmWave sensors are connected to it. These sensors send data about movement and object distance using serial communication. Both sensors are powered by 3.3 V, and their signals are connected to separate RX/TX lines on the ESP32.
Two addressable LED strips are also connected to the ESP32. Both LED strips share the same data wire from one ESP32 pin, so both strips display the same lighting effect. The LED strips are used to indicate the system status and alarm state.
Two 5 V buzzers are used for the audible alarm. Since the ESP32 pins cannot safely drive a larger load directly, each buzzer is controlled through a 2N2222 NPN transistor. The ESP32 sends a control signal to the transistor, which switches it on and allows the buzzer to receive power from the 5 V supply.
The circuit also includes UPS input voltage monitoring. This is implemented using a 2N2222 transistor, whose base is connected to the 12 V input through a resistor. The ESP32 input pin is connected to 3.3 V through a pull-up resistor. When the 12 V power supply is connected, the transistor switches on and pulls the ESP32 input LOW. When the 12 V supply is lost, the transistor switches off and the input remains HIGH.
In this way, the ESP32 can detect whether the UPS is being charged from an external power source or whether the system is running on batteries.
At the start, Bluetooth is started with the name SS-01, and both HLK-LD2410S sensors, the LED strip, buzzers, and UPS check pin are initialized.
In the main loop, the ESP32 constantly updates the sensor data, checks Bluetooth commands, detects motion, checks the UPS status, and sends data to the mobile application.
If the command ARM is received from the application, the system is armed. If the command DISARM is received, the alarm is stopped, the LED strip is turned off, and the buzzers are disabled.
Motion is monitored using both sensors. If the system is armed and one of the sensors detects motion for the first time, the alarm is triggered. During the alarm, an LED wave/strobe effect is activated, and both buzzers are turned on alternately. The alarm runs for up to 5 minutes or until the user disarms the system.
UPS monitoring is done using a separate ESP32 input pin. If the external power supply is lost, the ESP32 detects it and periodically flashes the LED strip in yellow to show that the system is running on battery power.
Android appThe Android application was created in the MIT App Inventor environment. At the start, the application displays the available Bluetooth devices. The user selects the ESP32 device, and the application attempts to establish a Bluetooth connection.
If the connection is successful, the application shows that the device is connected. The application has two main buttons: Arm and Disarm. When the Arm button is pressed, the command ARM is sent to the ESP32. When the Disarm button is pressed, the command DISARM is sent.
Using a timer, the application checks every 5 seconds whether new data has been received from the ESP32. The received text line is split using semicolons. Each part is then placed into its own field: alarm status, UPS status, first sensor status and distance, and second sensor status and distance.
Depending on the received data, the application also changes the colors of the status fields. If no connection is established, the last received data remains displayed.
For demo purpuses the sensitivity of the sensors have been set to be very low. Also, there is no audio.

















Comments