RustRescue
An autonomous firetruck robot that detects fire and puts it out.
Author: Ioniță Carmen Ana-Maria
GitHub Project Link: https://github.com/UPB-PMRust-Students/fils-project-2026-carmen020305#
Description
RustRescue is a small autonomous robot designed to detect and extinguish fires without human intervention. It is built around the STM32 NUCLEO-U545RE-Q microcontroller and programmed in Rust using the embassy-rs framework. The firetruck continuously monitors its surroundings using three flame sensors and one smoke sensor. When a flame or smoke is detected, the robot determines the direction of the threat and steers toward it while activating a siren and flashing LEDs, autonomously avoiding any obstacles in its path using an ultrasonic distance sensor. A display shows the current state of the system in real time. Once close enough to the fire, it stops and activates a small water pump to put it out. When the flame is no longer detected, the pump, siren, and LEDs turn off automatically. Then the robot will continue to look for another fire.
Motivation
The inspiration behind this project is my father, who is a firefighter. Knowing that he puts his life in danger every time he goes to work made me think about ways technology could help. While a small robot cannot replace a firefighter, it could serve as a first responder in situations involving small or early-stage fires, acting quickly before the situation escalates and reducing the need for human intervention in dangerous environments.
Architecture
The STM32 Nucleo-U545RE-Q is the central component of the system. It reads data from three flame sensors and the HC-SR04 ultrasonic sensor via GPIO, and from the MQ-2 smoke sensor via ADC. Based on this input, it controls the L298N motor driver and the water pump via GPIO, the buzzer via PWM, and the OLED display via I2C. The entire system is powered by two 18650 batteries (7.4V), with a buck converter (LM2596) stepping the voltage down to 5V for the microcontroller and sensors.
Log
Week 13 - 19 April
The STM32 NUCLEO-U545RE-Q and the first batch of components arrived. After checking what was missing, placed another order for the remaining parts.
Week 20 - 26 April
Started putting the project documentation together. Created the architecture diagram showing how all the components connect to the microcontroller. Also began working on the KiCad schematic.
Hardware
The hardware is built around the STM32 NUCLEO-U545RE-Q microcontroller, which connects to all the other components. Three IR flame sensors and an HC-SR04 ultrasonic sensor are wired via GPIO, the flame sensors to detect where the fire is coming from, and the ultrasonic sensor to avoid obstacles along the way. The MQ-2 smoke sensor connects via ADC to detect smoke in the surroundings. For movement, four BO motors are controlled through an L298N motor driver using PWM signals. A passive buzzer produces a siren sound via PWM, and two red LEDs are used as visual alerts via GPIO. The SSD1306 OLED display communicates over I2C and shows the current system state of the robot in real time. The water pump is switched on and off through a 2N2222 NPN transistor driven by a GPIO pin. The entire system is powered by two 18650 batteries in series (7.4V), brought down to 5V by an LM2596 buck converter.
Schematics
Place your KiCAD or similar schematics here in SVG format.
Bill of Materials
| Device | Usage | Price |
|---|---|---|
| STM32 Nucleo-U545RE-Q | The microcontroller | 106.59 RON |
| IR Flame Sensor (×3) | Detects fire direction (left, front, right) | 7.47 RON |
| MQ-2 Smoke Sensor | Detects smoke | 15.67 RON |
| HC-SR04 Ultrasonic Sensor | Measures distance to obstacles | 14.99 RON |
| OLED Display SSD1306 | Displays system state in real time | 13.34 RON |
| LM2596 Step Down DC-DC Power Supply Module | Converts battery voltage to 5V | 12.99 RON |
| BO Motors + Wheels (×4) | Robot locomotion | 62.56 RON |
| L298N Motor Driver | Controls the DC motors | 10.35 RON |
| 5V DC Water Pump + pipe | Extinguishes the fire | 14.83 RON |
| [Water tank / bottle] | Water reservoir for the pump | [N/A] |
| Passive Buzzer | Emits siren sound | 1.34 RON |
| Red LED (×2) | Emergency flashing lights | 0.60 RON |
| Transistor NPN 2n2222 | Switches the water pump circuit | 0.17 RON |
| 100nF Capacitor | Filters noise from the water pump | 0.24 RON |
| 1KΩ Resistor | Limits current to transistor base | 0.10 RON |
| 330Ω Resistor (×2) | Limits current to LEDs | 0.20 RON |
| Breadboard | Prototyping connections | 19.47 RON |
| Jumper wires | Electrical connections | 5.95 RON |
| 18650 Battery (×2) | Power source | 20.00 RON |
| Battery holder | Holds the 18650 batteries | 3.99 RON |
Software
| Library | Description | Usage |
|---|---|---|
| embassy-executor | Async task executor | Runs concurrent tasks on the microcontroller |
| embassy-stm32 | STM32 hardware abstraction | GPIO, PWM, ADC, I2C, timers for STM32U545 |
| embassy-time | Async time utilities | Delays and timeouts |
| embassy-sync | Synchronization primitives | Communication between tasks |
| ssd1306 | OLED display driver | Drives the SSD1306 display over I2C |
| embedded-hal | Hardware abstraction traits | Interface for peripherals |
| embedded-hal-async | Async hardware abstraction traits | Async interface for peripherals |
| defmt + defmt-rtt | Debug logging | Lightweight logging over RTT |
| panic-probe | Panic handler | Panic handler with defmt output |
| heapless | Fixed-size data structures | String formatting for OLED display |