AeroGuard 180
A smart gas-detection and evacuation system with a 180 ° pivoting fan
Author: Victor Sandu GitHub Project Link: https://github.com/UPB-PMRust-Students/proiect-Victor270104
Description
AeroGuard 180 continuously monitors the concentration of smoke and automatically evacuates contaminated air through a blower fan that can be rotated up to 180 °. The system sends Wi‑Fi alerts and provides local visual (LED) and audible (buzzer) feedback.
-
Dual MQ‑2 gas sensors detect smoke, LPG, and CO in real‑time.
-
An SG90 micro‑servo sweeps a 3 – 6 V DC blower fan up to 180 °, directing the airflow toward the gas source.
-
Raspberry Pi Pico 2 W runs async Rust firmware, processes sensor data, and publishes MQTT/HTTP alerts.
-
Status LEDs (green = safe, red = alert) and a passive buzzer offer immediate on‑site feedback.
Motivation
This project lets me dive deeper into embedded development with Rust while addressing a real‑world safety issue: preventing smoke or fires in homes and small labs by automating ventilation and issuing rapid notifications.
Architecture
MQ‑2 gas sensors – supply analog voltage proportional to smoke/gas concentration. The Pico’s ADC samples these signals continuously for threshold analysis.
SG90 micro‑servo – receives PWM commands from the Pico and rotates the blower fan up to 180 °, so contaminated air is pushed away from the danger zone.
L298N dual H‑bridge – drives the 3 – 6 V DC blower fan under Pico control (start/stop and optional speed modulation).
Status LEDs & passive buzzer – connected to GPIO pins; green LED indicates safe air, red LED and buzzer indicate dangerous concentrations and trigger ventilation.
LED indicators:
- Green LED: Air concentration is safe.
- Red LED: Air concentration is dangerous.
Power source – a single USB‑C cable from the laptop delivers 5 V. The Pico distributes logic power, while the L298N shares the same 5 V rail for the fan. No external batteries are required.
Log
Week 5 - 11 May
Completed the hardware wiring on a breadboard, connecting the Raspberry Pi Pico 2W with the MQ-2 gas sensor, L298N motor driver, DC motor, passive buzzer, SG90 servo, and status LEDs. Each component was individually tested to ensure functionality and correct pin connections.
Week 12 - 18 May
Transferred all components from the breadboard to a prototyping PCB. Soldered the connections and tested circuit continuity to avoid shorts or loose connections. Power delivery was stabilized, and the system was verified to operate correctly on the permanent board.
Week 19 - 25 May
Developed the software using Rust and the Embassy framework. Implemented the gas detection logic, motor control via L298N, servo positioning, and buzzer signaling. Successfully integrated hardware and software components, achieving full system functionality.
Hardware
-
Raspberry Pi Pico 2 W:
- Purpose: Central control unit.
- Function: Runs Rust code to control sensors, fan, and LEDs.
-
MQ‑2 Gas Sensor Module:
- Purpose: Detect flammable gases, CO, and smoke.
- Function: Provide analog voltage proportional to gas concentration—read by the Pico ADC to trigger ventilation and alarms.
-
Micro‑servo SG90 180 °:
- Purpose: Mechanically orient the blower fan.
- Function: Receives PWM from the Pico to sweep up to 180 °, directing the airflow toward the contamination source.
-
DC Blower Fan 3 V – 6 V:
- Purpose: Evacuate contaminated air from the monitored space.
- Function: Powered through an H‑bridge; speed and on/off state controlled by the Pico.
-
L298N Dual H‑Bridge Driver:
- Purpose: Safely switch and drive the DC blower motor (with one spare channel for future actuators).
- Function: Translates Pico logic‑level signals into motor currents up to 2 A.
-
LEDs (Red, Green):
- Purpose: Visual indicator.
- Function: Green = safe, Red = alert; driven by Pico GPIO lines via current‑limiting resistors.
-
Passive Buzzer 3 V - 3.3 V:
- Purpose: Audible warning when gas thresholds are exceeded.
- Function: Generates a tone when toggled by a Pico GPIO pin.
Hardware Overview
- The Pico 2 W reads air concentration.
- Based on air conditions, it controls the ventilator and the motors.
- LEDs give real-time feedback on air concentration.
Schematics
Bill of Materials
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico 2W | Main microcontroller | ~40 RON |
Senzor Module Gas MQ-2 | Air concentration sensing | ~11 RON |
Micro Servomotor SG90 180° | Pivot for fan | ~12 RON |
Driver module Dual L298N | Driver for motor | ~11 RON |
Motor DC 3V-6V | Motor | ~11 RON |
3V Passive Buzzer | Buzzer | ~1 RON |
LED Verde 3mm Difuz | Status indicator (safe) | ~0.50 RON |
LED Roșu 3mm Difuz | Status indicator (alert) | ~0.50 RON |
Software
Library | Description | Usage |
---|---|---|
embassy-rp | Suport async pentru RP2040 | GPIO, PWM, ADC, inițializare periferice |
embedded-hal | Abstracție hardware standard | GPIO, PWM, ADC, SPI/I2C |
embassy-time | Timeri asincron și delay-uri | Timer::after pentru întârzieri |
fixed | Numere fixe cu virgulă mobilă | Configurare divizor PWM (frecvență) |
defmt | Logging eficient embedded | Mesaje info! pentru debugging |
panic-probe | Gestionare panică embedded | Debug prin probe-run RTT |
cortex-m-rt | Suport runtime pentru ARM Cortex-M | Start-up și vectori de întrerupere |
Links
- Rust Embedded Book – Ghid complet pentru dezvoltare embedded în Rust.
- Embassy Rust Project – Framework async pentru microcontrolere în Rust.
- Raspberry Pi Pico SDK Documentation – Documentație oficială C SDK pentru RP2040.
- RP2040 Datasheet – Specificații hardware detaliate pentru RP2040.
- embedded-hal crate – Interfață standard pentru periferice embedded (GPIO, ADC, PWM etc).
- defmt (embedded logging) – Sistem de logare eficient pentru debugging embedded.
- fixed crate – Tipuri de date cu virgulă fixă folosite pentru divizoare PWM.
- probe-rs - Toolchain pentru debugging, flashing și RTT log în Rust embedded.
- embassy-examples – Exemple oficiale Embassy pentru RP2040.