Skip to main content
Version: FILS English

Smart Fire Detection and Suppression System

An embedded smart fire safety system built with STM32 and Rust using Embassy async framework.

info

Description

This project is a smart fire detection and suppression system based on an STM32 microcontroller programmed in Rust.
The firmware uses the Embassy async framework to run multiple tasks concurrently.

The system continuously monitors ambient temperature using a temperature sensor. When the measured temperature exceeds a predefined safety threshold, the system enters danger mode.

In danger mode:

  • A buzzer alarm is activated
  • A water pump starts automatically
  • The LCD displays the warning message DANGER

When the temperature returns to a safe value:

  • The pump stops
  • The buzzer turns off
  • The LCD displays SAFE

A push button is included for manual emergency stop. A potentiometer allows manual control of the water pump speed / pressure.

Motivation

Fire hazards can happen unexpectedly and cause serious damage. I wanted to build a practical system that can automatically detect dangerous conditions and immediately react.

This project combines sensors, displays, motors, alarms, user input, and async embedded programming in Rust — covering many of the concepts studied throughout the course.

Architecture

The STM32 microcontroller acts as the central controller, coordinating all peripherals through Embassy async tasks:

  • Sensor Task — reads temperature from the DHT11 sensor continuously
  • Display Task — updates the LCD 16x2 with current status (SAFE / DANGER)
  • Alarm Task — controls the buzzer based on system state
  • Pump Task — activates or stops the water pump via the MOSFET module
  • Input Task — reads the push button for manual emergency stop

Peripheral interfaces used:

  • GPIO — button input and buzzer output
  • Digital Sensor Input — DHT11 temperature sensor
  • PWM / GPIO Output — water pump activation through MOSFET
  • I2C — LCD 16x2 display
  • ADC — potentiometer for pump speed adjustment

Log

Week 5 - 11 May

Project idea selected and requirements defined. Components researched and ordered. Rust embedded environment and Embassy framework configured.

Week 12 - 18 May

Hardware assembled on breadboard. Implemented sensor reading task and threshold detection logic. Tested buzzer and pump switching via MOSFET.

Week 19 - 25 May

Integrated LCD display over I2C. Added push button debounce and manual stop logic. Potentiometer ADC reading connected to pump PWM speed control. Full system integration and testing.

Hardware

The project is based on an STM32 development board which provides GPIO pins, timers, ADC inputs, and I2C communication. The DHT11 sensor reads temperature digitally. The water pump is switched by a MOSFET driver module controlled via GPIO/PWM. An LCD 16x2 screen shows system status over I2C. A buzzer provides audio alerts. A push button handles manual emergency stop and a potentiometer adjusts pump speed.

Schematics

See schematic.svg

Bill of Materials

DeviceUsagePrice
STM32 Development BoardMain controller104 RON
DHT11 Temperature Sensor ModuleTemperature monitoring15.55 RON
LCD 16x2 with I2C backpackStatus display23.22 RON
Mini Water Pump 3-6VWater spraying13.31 RON
MOSFET IRF520 ModulePump switching12.60 RON
Active Buzzer ModuleAudio alarm7.42 RON
Push ButtonManual emergency stop6.36 RON
Potentiometer 10KPump speed adjustment8.31 RON
Breadboard 830 pointsPrototyping10.00 RON
Jumper Wires SetConnections10.00 RON
PVC TubeWater output routing2.49 RON
Resistor SetPull-up / protection5.00 RON
Diode 1N4007Pump protection2.00 RON
Total~220 RON

Software

LibraryDescriptionUsage
embassy-stm32Async HAL for STM32Peripheral drivers for GPIO, PWM, ADC, I2C
embassy-executorAsync task executorRuns concurrent tasks for sensor, LCD, buzzer, pump
embassy-timeAsync timers and delaysPeriodic temperature monitoring and scheduling
embassy-syncChannels and mutexesShares state between async tasks
embedded-halHardware abstraction traitsGeneric peripheral interfaces
hd44780-driverLCD driver for HD4478016x2 display control over I2C
cortex-mARM Cortex-M supportLow level MCU support
cortex-m-rtRuntime supportStartup and interrupt vectors
panic-haltPanic handlerStops execution on panic
  1. Embassy-rs async embedded framework
  2. Rust Programming Language
  3. Embassy GitHub Repository
  4. STM32-rs HAL crates