Smart 2D LiDAR Radar & Advanced Security Hub
A comprehensive bare-metal 2D scanning system and multi-sensor security alarm built with Rust and Embassy on the STM32.
Author: DULCE Andrei-Marian
GitHub Project Link: https://github.com/UPB-PMRust-Students/fils-project-2026-andrrei509
Description
This project is an advanced, multi-layered active security and environmental monitoring hub built on the STM32. The core feature is a 2D scanning system using a VL53L0X Time-of-Flight (ToF) sensor mounted on a 28BYJ-48 stepper motor, which performs a 180° back-and-forth sweep and streams 18-byte Cartesian coordinate frames to a laptop via USB CDC ACM to render a real-time radar map in Python (pygame). Additional sensors — a Doppler radar, vibration sensor, sound sensor, photoresistor, and BMP180 barometer — provide intrusion detection and environmental telemetry. Two RGB LEDs give local visual feedback for proximity zones and security status, while a PWM-driven buzzer sounds proximity alerts.
Motivation
I chose this project because it combines precise motor control, real-time data acquisition from a vast array of sensors, and PC-device USB communication into a single robust system. It is a highly practical and technically challenging way to explore asynchronous embedded programming in Rust.
Architecture

Main software and system components:
- Scanning Module: reads distance from VL53L0X via I2C (or generates mock ghost-room data when the sensor is unavailable) and steps the motor via GPIO in a strict ping-pong sweep.
- Intrusion Detection Module: reads Doppler radar (RCWL-0516), vibration (SW-420), and sound sensors with multi-sample polling to catch short pulses.
- Environmental Module: reads BMP180 temperature/pressure (I2C) and photoresistor ambient light (ADC) for night mode detection.
- Local Feedback Module: drives two RGB LEDs (proximity zones + security status) and a PWM buzzer for proximity alarms.
- Communication Module: streams serialized 18-byte ScanPoint payloads via USB CDC ACM to the PC, and receives single-byte motor commands (Auto/Right/Left/Stop).
Log
Week 4
- Established the project idea and worked on the component list.
Week 5-6
- Ordered all hardware components (STM32, VL53L0X, stepper motor, etc.).
- Researched the Embassy framework and USB Bulk transfer implementation in Rust.
Week 7
- Components arrived, started testing and tinkering with them.
Week 8-9
- Hardware Integration. Began assembling the core scanning module by mounting the VL53L0X ToF sensor to the 28BYJ-48 stepper motor shaft.
- Circuit Prototyping. Mapped out the pin connections on the 830-point breadboard for the I2C bus (sensor), GPIO sequence (ULN2003 driver), and the security sensor array.
- Software Design. Drafted the Embassy task architecture, defining the synchronization channels between the scanning task and the USB communication task.
Hardware
The system uses an STM32 Nucleo-U545RE-Q as the central hub. It orchestrates a VL53L0X ToF sensor mounted on a 5V stepper motor for spatial scanning, alongside a suite of security sensors (Doppler radar, vibration, sound) and environmental sensors (BMP180, photoresistor). Two RGB LEDs provide local visual feedback and a PWM buzzer handles proximity alerts. Everything is wired on a universal 830-point breadboard.
Schematics

Complete system schematic for the Smart 2D LiDAR Security Hub.
Breadboard Assembly

Breadboard wiring setup - view 1.

Breadboard wiring setup - view 2.

Breadboard wiring setup - view 3.
Bill of Materials
| Device | Usage | Price |
|---|---|---|
| STM32 Nucleo-U545RE-Q | The main microcontroller | 106.59 RON |
| VL53L0X ToF Sensor | Distance measurement (I2C) | 28.00 RON |
| Universal Breadboard 830 points | Prototyping base | 15.67 RON |
| 28BYJ-48 5V Stepper Motor + ULN2003 Driver | Motor for sensor sweeping | 15.00 RON |
| RCWL-0516 Doppler Radar Sensor | Microwave motion detection | 6.20 RON |
| BMP180 Sensor Module | Temperature and pressure sensing (I2C) | 4.50 RON |
| Passive Buzzer 3.3V | Proximity audio alarm (PWM) | 3.00 RON |
| Photoresistors | Ambient light sensing (ADC) | 7.60 RON |
| Vibration / Tilt Sensor | Tamper detection | 6.00 RON |
| Microphone / Sound Sensor | Acoustic trigger | 5.00 RON |
| 2× RGB LED 5mm (Common Cathode + Common Anode) | Proximity zones and system status indicators | 5.00 RON |
| [Transistors (2N2222) & Diodes (1N4148)] | Buzzer transistor driver and flyback protection | 10.00 RON |
| [Assorted Resistors (330Ω, 1kΩ, 10kΩ)] | Current limiting (LEDs) and pull-ups/downs | 5.00 RON |
| [Capacitors (100uF, 470uF, 100nF)] | Power filtering and decoupling | 15.00 RON |
| [Dupont Wires (M-M, M-F, F-F)] | Establishing connections | 25.00 RON |
| [Switches & PCB Buttons] | Power control and inputs | 15.00 RON |
| Total | 272.56 RON |
Software
| Library | Description | Usage |
|---|---|---|
| embassy-stm32 | Async HAL for STM32 | Hardware access for I2C, GPIO, ADC, PWM, and USB |
| embassy-executor | Async task executor | Schedules 7 concurrent firmware tasks |
| embassy-time | Embedded timers | Delay management and periodic sensor polling |
| embassy-usb | USB device stack | Implementing USB CDC ACM endpoints for PC communication |
| embassy-sync | Async synchronization primitives | Channels and Signals to safely move sensor data between tasks |
| embassy-embedded-hal | Adapter for Embedded HAL | Bridging Embassy drivers with the standard Rust embedded ecosystem |
| embassy-futures | Future combinators | join3 for running USB device, TX, and RX concurrently |
| serde | Data serialization framework | Derive macros for ScanPoint and SystemStatus structs |
| cortex-m | ARM Cortex-M low-level access | Handling low-level CPU operations and critical sections |
| cortex-m-rt | Startup and runtime for ARM | Managing the reset handler and memory initialization of the STM32 |
| panic-probe | Debug panic handler | Catching code crashes and printing the stack trace over the debug probe |
| defmt | Deferred formatting | High-efficiency logging to debug sensor values in real-time |
| defmt-rtt | RTT transport for defmt | Sends defmt log frames over the debug probe's RTT channel |
| micromath | no_std math library | Computing sin/cos for polar-to-Cartesian coordinate mapping |
| vl53l0x | ToF Sensor Driver | Reading distance data from the laser sensor over I2C |
| bmp180-embedded-hal | BMP180 Sensor Driver | Reading temperature and pressure over I2C |
| static_cell | Static allocation | Safe 'static references for USB buffers, channels, and shared I2C bus |
| embedded-hal | Embedded HAL traits | Common trait interface used by sensor drivers |