Raspberry-Pi - Report - FINAL Smoke
Raspberry-Pi - Report - FINAL Smoke
School of Engineering
A Project Report on
DEC-2024
Abstract
This project presents the design and implementation of a smoke detection system using a
Raspberry Pi, aimed at enhancing fire safety and early detection. The system utilizes a smoke
sensor (such as the MQ-2) interfaced with the Raspberry Pi, which continuously monitors the
surrounding air for the presence of smoke or hazardous gases. Upon detecting a certain
concentration of smoke, the system activates an alarm or sends real-time alerts to the user via
email or SMS. The project integrates hardware components like the sensor, Raspberry Pi, and
communication modules, along with software that processes sensor data and triggers
notifications. Additionally, a graphical user interface (GUI) is developed to provide real-time
monitoring and system control. This smoke detection system serves as an affordable and effective
solution for home or industrial fire prevention, offering timely warnings to mitigate the risks
associated with fires.
Introduction
Smoke detection is a critical aspect of fire safety, aiming to provide early warnings in the event
of a fire. Traditional smoke detectors are commonly used in residential and industrial buildings,
but they often lack advanced features such as remote monitoring and real-time notifications. To
address these limitations, this project explores the use of a Raspberry Pi-based smoke detection
system. By integrating affordable, off-the-shelf components like a smoke sensor and a Raspberry
Pi, the system provides an efficient and scalable solution for smoke detection and fire prevention.
The Raspberry Pi, a compact and versatile single-board computer, is chosen for its ability to
interface with various sensors and communication devices, making it an ideal platform for this
application. In combination with a smoke sensor, such as the MQ-2, which detects smoke and
hazardous gases, the Raspberry Pi continuously monitors air quality in the environment. When
the sensor detects smoke at a predefined threshold, the Raspberry Pi processes the data and
triggers an alarm or sends notifications through SMS or email, alerting users to potential danger.
The system also incorporates a graphical user interface (GUI) for real-time monitoring, allowing
users to visualize sensor data, adjust threshold levels, and manage system settings. This advanced
smoke detection system is cost-effective, customizable, and can be easily expanded for larger-
scale applications, making it a valuable tool for home and industrial fire safety solutions.
Related work
Raspberry Pi and IoT-Based Smoke Detection Systems: With the rise of the Internet of
Things (IoT), numerous studies have incorporated the Raspberry Pi into IoT-enabled
smoke detection systems. These systems enable remote monitoring of smoke levels
through cloud platforms or mobile apps. For instance, a project by researchers in the field
of smart homes integrates smoke sensors with a Raspberry Pi to transmit data to the
cloud, where users can monitor air quality and receive alerts on their smartphones. This
approach ensures users can react swiftly, even in the absence of traditional alarm systems
Implementation
Hardware Components Required:
Raspberry Pi (Model 3)
This acts as the central controller for the smoke detection system. The Raspberry Pi will
process data from the smoke sensor and handle notifications.
MQ-2 Smoke Sensor (or similar)
The MQ-2 is a gas sensor that can detect smoke, carbon monoxide, methane, and other gases. It
provides an analog output based on the concentration of smoke or gas in the air.
Breadboard and Jumper Wires
For connecting the components.
Buzzer
A simple buzzer will sound when the system detects smoke, alerting the users.
LED (Optional)
To visually indicate the status of the smoke detector (e.g., green for no smoke, red for smoke
detected).
Software Requirements:
Raspberry Pi OS (Raspberry Pi OS Lite or Full)
The operating system installed on the Raspberry Pi for development.
Python
A programming language for writing the script to read data from the sensor and control the
outputs (buzzer, LED, and notifications).
Libraries:
RPi.GPIO or gpiozero: For interacting with the GPIO pins of the Raspberry Pi.
Time: To add delays in the code (for debouncing or sensor reading intervals).
Smtplib (optional): For sending email notifications.
Twilio (optional): For sending SMS notifications.
Flask (optional): If you want to create a web interface for monitoring the sensor.
1. Raspberry Pi 4
2. Pi gas Module
3. Monitor (optional)
Software Tools
2. TensorFlow/Keras
Procedure
• Connect the gas sensor and verify its setup using basic scripts.
Result
.
Conclusion
ChatGPT
You said:
Raspberry Pi pico project for smoke detection
ChatGPT said:
ChatGPT
A smoke detection project with a Raspberry Pi Pico is a great choice for learning IoT and sensor integration.
Below is a step-by-step guide to build a simple smoke detection system:
Components Needed:
1. Raspberry Pi Pico
2. MQ-2 Smoke Sensor (or any other gas/smoke sensor)
3. Buzzer (for alarm)
4. LEDs (optional, for visual alerts)
5. Resistors (220Ω for LEDs and 10kΩ for pull-down/pull-up resistors if required)
6. Breadboard and jumper wires
7. Power supply (Micro-USB cable or battery pack)
Steps:
1. Set Up the MQ-2 Smoke Sensor
The MQ-2 sensor has 4 pins:
VCC: Connect to 3.3V or 5V pin of Pico.
GND: Connect to Pico's GND.
AO: Analog output (connect to an ADC pin like GPIO26 on Pico).
DO: Digital output (high when the smoke level exceeds a threshold, connect to a GPIO pin like
GPIO15 for monitoring).
2. Connect the Buzzer and LEDs
Buzzer: Connect the positive pin to a GPIO pin (e.g., GPIO14) through a 220Ω resistor and the negative
pin to GND.
LEDs: Connect each LED's anode (long leg) to GPIO pins (e.g., GPIO13 and GPIO12) through 220Ω
resistors. Connect the cathodes to GND.
3. Write the Code
Use MicroPython for simplicity. Install the MicroPython firmware on your Raspberry Pi Pico, and use the
Thonny IDE to program it.
python
Copy code
from machine import ADC, Pin from time import sleep # Initialize MQ-2 sensor (analog pin)
smoke_sensor = ADC(Pin( 26 )) # Initialize buzzer and LEDs buzzer = Pin( 14 , Pin.OUT) led_red = Pin( 13 ,
Pin.OUT) led_green = Pin( 12 , Pin.OUT) # Smoke threshold (adjust based on testing) SMOKE_THRESHOLD
= 500 while True : smoke_level = smoke_sensor.read_u16() # Read analog value (0-65535)
print ( f"Smoke level: {smoke_level}" ) if smoke_level > SMOKE_THRESHOLD: print ( "Smoke detected!" )
buzzer.on() led_red.on() led_green.off() else : buzzer.off() led_red.off() led_green.on() sleep( 1 )
4. Test the System
Power up the Raspberry Pi Pico.
Open the Thonny IDE to run the script.
Use a small source of smoke (like a lit match) to test the sensor. Ensure safety precautions!
You said:
Conclusion
ChatGPT said:
ChatGPT
Conclusion
The Raspberry Pi Pico-based smoke detection system is a simple yet effective project to enhance your skills in
microcontroller programming, sensor integration, and IoT development. By using the MQ-2 sensor, you can
detect smoke and gases efficiently, and with the addition of buzzers and LEDs, the system can provide audible
and visual alerts in real-time.
This project can be extended with WiFi integration, data logging, or even connecting to cloud platforms for
remote monitoring, making it a practical and scalable solution for safety applications. Always ensure proper
testing and calibration of the sensor to improve accuracy, and prioritize safety during testing with smoke.
By building this project, you'll gain hands-on experience with hardware, programming in MicroPython, and
creating systems for real-world applications.