Smoke Detector
A smart smoke detector with visual, auditory, and remote alerting capabilities.
Author: Ureche Andreea-Maria
GitHub Project Link: https://github.com/UPB-PMRust-Students/proiect-urecheandreea
Description
This project consists of building a smoke detector using a Raspberry Pi Pico 2W. The device detects the presence of smoke and notifies the user via email. A visual indicator (LED strip), a buzzer, and a fan are also included to provide immediate feedback and ventilation. The alarm can be turned off by entering a verification code received through email on a keyboard module.
Motivation
The project was chosen to address the need for affordable, customizable, and connected safety systems for smoke detection. It aims to provide a cost-effective, open-source alternative that not only detects smoke but also alerts users in real time via email, allowing for faster reaction in emergency situations. From a learning perspective, this project also provides an opportunity for me to lear and deepen my understanding of embedded systems and to gain practical experience with Rust programming in a real-world context. Overall, this is both a learning journey and a way to build something useful.
Architecture
The architecture consists of the following main components:
- Sensor Module: Smoke detection using MH MQ-2 sensor.
- Microcontroller: Raspberry Pi Pico 2W acts as the main controller.
- Network Stack: Provides email notifications via SMTP over WiFi.
- User Interface: 3x4 Keyboard module for disabling the alarm with code verification.
- Feedback Systems:
- WS2812 RGB LED strip for smoke level indication.
- Buzzer for audible alert.
- L293D H-Bridge Motor Driver because the board isn't powerful enough alone to power a motor
- DC Motor with fan for smoke evacuation.
- LCD to provide an interface for displaying information.
Log
Week | Activity |
---|---|
Week 5 - 11 May | Finished the project documentation and started working on the initial wiring as well as some part of the software. |
Week 12 - 18 May | Updated the project documentation, uploaded the pictures with the hardware and the Schematics. |
Week 19 - 25 May | Completed the software , finished the logic for sending emails via SMTP and uploaded the source code and documentation |
Hardware
The smoke detector system is built around the Raspberry Pi Pico 2W, a Wi-Fi enabled microcontroller that serves as the core of the project. To detect the presence of smoke, the project uses an MH MQ-2 gas sensor, which provides analog readings corresponding to the level of smoke in the air. These readings are processed by the Pico through its ADC (analog-to-digital converter), and if a dangerous threshold is crossed, an alert is initiated. As part of the feedback mechanism, the system includes a WS2812 RGB LED Bar, which visually indicates the current smoke level using different color patterns. Additionally, a buzzer is used to provide a loud audio alert when smoke is detected. It is connected via a PWM-capable GPIO pin for tone control. For active smoke evacuation, a small DC motor with propeller (fan) is activated during high smoke levels. I also used a L293D H-Bridge Motor Driver between the MCU and the motor that enables a voltage to be applied across a load in opposite direction as the MCU isn't powerful enough alone to power the DC motor. User interaction is facilitated by a 3x4 keyboard module, which allows users to input a verification code received by email to stop the alert. A 1602 LCD is also included in the system to display useful information when smoke is detected and to enter the code provided.
Schematics
Bill Of Materials
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico 2W | The microcontroller | 40 RON |
MQ-4 Gas Sensor | Smoke detection | 10 RON |
DC Motor with Propeller Fan | Smoke evacuation | 8 RON |
Keyboard Module | User input (code entry) | 19 RON |
WS2812 RGB LED Bar | Visual feedback | 7 RON |
1602 LCD | Information display | 17 RON |
Passive Buzzer | Audio alert | 1.40 RON |
L293D Motor Driver | Control the direction and speed of DC motor | 3 RON |
Breadboard & Wires | Board | 22 RON |
Software
Library | Description | Usage |
---|---|---|
embassy-net | Networking stack on top of Embassy | Wi-Fi setup, TCP/IP sockets, DNS, SMTP transport |
embassy-rp | RP2040 Peripherals | GPIO, ADC, PWM, PIO, I²C on RP2040 |
embedded-hal | Standard traits for embedded hardware abstraction | Abstract ADC, GPIO, SPI, I²C in drivers |
lcd1602-diver | Display Library | Allows text display on LCD1602 screens via I2C interface |
heapless | Fixed-size data structures without dynamic allocation | Buffers for messages, queues, and heapless strings |
defmt | Logging framework optimized for embedded Rust | Compact, efficient logs over UART for debugging |
probe-rs | Flashing and debugging tools for ARM microcontrollers | Flash firmware, debug live over SWD |
smart-leds | Crate for controlling addressable LEDs such as WS2812 | Allows control of colors and effects for LED strips |
embassy-time | Time Library | Timers and delays |