Mini air defense system
A robotic pan-tilt turret capable of detecting targets and launching projectiles using a flywheel mechanism.
Author: Condrea Vlad-Stefan
GitHub Project Link: https://github.com/UPB-PMRust-Students/acs-project-2026-Ionidis
Description
A smart robotic turret made using a STM32 NUCLEO board that acts as the main controller. The system uses a pan-tilt mechanical bracket driven by two MG996R servo motors to aim. An HC-SR04 ultrasonic sensor is mounted on the moving arm to detect the distance to a target. Once the target is within range, the Nucleo board triggers the flywheel launcher, which consists of two high-speed DC motors with rubber wheels that shoot the projectile. The entire system is powered by a LiPo battery, using an LM2596 step-down module to safely provide 5V to the servos and sensor.
Motivation
I believe that it would be a fun and challenging experience. I find robotics fascinating, and this project perfectly combines mechanical assembly, sensor data acquisition, and motor control using Rust. It acts as a great introduction to tracking systems and automated defense mechanisms.
Architecture
The system starts with the HC-SR04 ultrasonic sensor, which constantly sends distance data to the STM32 Nucleo controller.
The Nucleo board processes the sensor data to determine if a target is present. Based on the logic, it generates PWM signals sent directly to the two MG996R servo motors to adjust the Pan (horizontal) and Tilt (vertical) angles. When the target is locked, the Nucleo sends digital signals to a motor driver, which spins up the two DC motors of the flywheel launcher.
Power management is critical: a 7.4V LiPo battery supplies raw power to the motor driver for the DC motors. In parallel, the battery connects to an LM2596 Step-Down converter, which drops the voltage to a stable 5V to safely power the STM32 board, the HC-SR04 sensor, and the servo motors without frying them.
Schematics
Log
Week 20 - 26 April
Got approval and researched the components. Ordered all the components.
Week 5 - 11 May
Assembled the mechanical pan-tilt bracket. Fixed alignment issues with the tilt servo and bearing. Attached the HC-SR04 sensor.
Week 12 - 18 May
Managed to power up all components by soldering all the wires needed to the step down module and the DC motors. The hardware is ready and can fully function.
Week 19 - 25 May
Hardware
The project uses the Nucleo board as the brain. It receives echo pulses from the HC-SR04 sensor. After processing the distance, it sends PWM signals to the Pan and Tilt MG996R servos. It also controls a motor driver (L298N/L293D) to activate the dual DC motors for the launcher. The LM2596 acts as a power regulator.
Schematics
Bill of Materials
| Device | Usage | Price |
|---|---|---|
| STM32 Nucleo-U545RE-Q | Main Controller | Lab Provided |
| Metal Pan-Tilt Bracket | Mechanical structure for the arm | 20 RON |
| 2 x MG996R Servo Motor | Aiming (Pan and Tilt axis) | 60 RON |
| 2 x DC Motor | Flywheel projectile launcher | 8 RON |
| HC-SR04 Ultrasonic Sensor | Target detection and distance measuring | 14.5 RON |
| LM2596 Step-Down Module | Voltage regulator (Drops LiPo 7.4V to 5V) | 7 RON |
| L298N Motor Driver Module | Controls the DC motors for the launcher | 20 RON |
| Baterie Gens Ace G-Tech | Main power supply | 60 RON |
| Rotite cauciuc | Rotite care sa propulseze proiectilul din burete | 10 RON |
| Fire dupont | Fire pentru conecta componentele | 15 RON |
| Tester acumulator | Un buzzer care ma avertizeaza cand bateria este aproape sa se descarce | 10 RON |
| Incarcator | Pentru reincarcarea bateriei | 75 RON |
Software
| Library | Description | Usage |
|---|---|---|
| embassy-stm32 | Hardware Abstraction Layer | Handling GPIOs, EXTI (for sensor echo), and PWM peripherals (for servos) |
| embassy-executor | Async task executor | Managing concurrent tasks (sensor reading, aiming, shooting) |
| embedded-hal | Hardware abstraction traits | Standard interface for interacting with peripherals |
| defmt | Logging framework | Used for debugging distance readings and states |