Skip to main content
Version: FILS English

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.

info

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 streams Cartesian coordinate data to a laptop via USB Bulk transfers to render a real-time radar map. Additional sensors provide intrusion detection and environmental telemetry.

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

System Architecture Diagram

Main software and system components:

  • Scanning Module: reads distance from VL53L0X via I2C and steps motor via GPIO.
  • Intrusion Detection Module: reads Doppler radar, vibration, and sound sensors.
  • Access Control Module: handles the 4x4 matrix keypad and IR receiver.
  • Environmental Module: reads BMP180 (I2C) and photoresistors (ADC).
  • Local Feedback Module: controls the 4-digit display, buzzer (PWM), and LEDs.
  • Communication Module: sends serialized coordinate payloads via USB Bulk to the PC.

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, keypad) and environmental sensors (BMP180, photoresistors). Everything is wired on a universal 830-point breadboard.

Schematics

To be added.

Bill of Materials

DeviceUsagePrice
STM32 Nucleo-U545RE-QThe main microcontroller106.59 RON
VL53L0X ToF SensorDistance measurement (I2C)28.00 RON
Universal Breadboard 830 pointsPrototyping base15.67 RON
28BYJ-48 5V Stepper Motor + ULN2003 DriverMotor for sensor sweeping15.00 RON
RCWL-0516 Doppler Radar SensorMicrowave motion detection6.20 RON
BMP180 Sensor ModuleTemperature and pressure sensing (I2C)4.50 RON
4x4 Matrix KeypadPIN code input for security4.00 RON
0.56" 4-Digit 7-Segment DisplayLocal numerical data display10.00 RON
Passive Buzzer 3.3VProximity audio alarm (PWM)3.00 RON
PhotoresistorsAmbient light sensing (ADC)7.60 RON
Vibration / Tilt SensorTamper detection6.00 RON
Microphone / Sound SensorAcoustic trigger5.00 RON
10x LED 5mm (Mixed colors)Directional and status visual indicators5.00 RON
[Transistors (2N2222, BC547) & Diodes (1N4148)]Signal switching and protection10.00 RON
[Assorted Resistors (220Ω, 330Ω, 1kΩ, 4.7kΩ, 10kΩ)]Current limiting and pull-ups/downs5.00 RON
[Capacitors (100uF, 470uF, 100nF)]Power filtering and decoupling15.00 RON
[Dupont Wires (M-M, M-F, F-F)]Establishing connections25.00 RON
[Switches & PCB Buttons]Power control and inputs15.00 RON
Total286.56 RON

Software

LibraryDescriptionUsage
embassy-stm32Async HAL for STM32Hardware access for I2C, GPIO, ADC, and PWM
embassy-executorAsync task executorSchedules concurrent firmware tasks
embassy-timeEmbedded timersDelay management and periodic sensor polling
embassy-usbUSB device stackImplementing USB Bulk endpoints for PC communication
embassy-syncAsync synchronization primitivesProviding Channels and Signals to safely move sensor data between tasks.
embassy-embedded-halAdapter for Embedded HALBridging Embassy drivers with the standard Rust embedded ecosystem.
keypad-rsMatrix keypad driverScanning and debouncing the 4x4 input matrix
postcardCompact binary serializationSerializing coordinate and security data into tiny packets for USB transmission.
serdeData serialization frameworkCore framework used by Postcard to define the structure of analytics sent to the PC.
cortex-mARM Cortex-M low-level accessHandling low-level CPU operations and critical sections.
cortex-m-rtStartup and runtime for ARMManaging the reset handler and memory initialization of the STM32.
panic-probeDebug panic handlerCatching code crashes and printing the stack trace over the debug probe.
defmtDeferred formattingProviding high-efficiency logging to debug sensor values in real-time.
micromathno_std math libraryComputing trigonometric functions for coordinate mapping
vl53l0xToF Sensor DriverReading distance data from your laser sensor over I2C.
ht16k33Segment Display DriverControls the 7-segment display.
  1. Embassy Framework Documentation
  2. STM32U545RE Reference Manual
  3. Rust Embedded Book
  4. VL53L0X API and Documentation