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 sensor.
- Microcontroller: Raspberry Pi Pico 2W acts as the main controller.
- Network Stack: Provides email notifications via SMTP over WiFi.
- User Interface: Keyboard module for disabling the alarm with code verification.
- Feedback Systems:
- LED strip for smoke level indication.
- Buzzer for audible alert.
- 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 | |
Week 19 - 25 May |
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-type 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 5V 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. User interaction is facilitated by a 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 such as system status, sensor readings or 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 |
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 |
ag-lcd | Display Library | Write to LCD display |
lettre | High-level email library for Rust | Compose and send email notifications |
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 |
embassy-time | Time Library | Timers and delays |