Robotics & Autonomous Systems Lab
Lab Manual 6
Multi-Sensor Fire Detection System using Raspberry Pi
(Flame + Gas + Light Sensors)
University: Al-Balqa Applied University
Faculty: Faculty of Artificial Intelligence
Course: Robotics & Autonomous Systems Lab
Instructor: Dr. Ahmad Zuhair Irjoob
1. Objective of the Experiment
The objective of this laboratory experiment is to design and implement a multi-sensor
safety monitoring system using Raspberry Pi.
The system detects:
• Fire (Flame Sensor)
• Gas leakage (Gas Sensor MQ-2)
• Light intensity changes (Light Sensor LDR)
This experiment demonstrates the importance of sensor fusion in robotics and
intelligent safety systems — وهو مفهوم أساسي في أنظمة الروبوتات الحديثة واألنظمة الصناعية الذكية.
At the end of this experiment, students will be able to:
• Interface multiple sensors with Raspberry Pi
• Read digital signals from sensors
• Implement a real-time monitoring system
• Design a smart safety alert system
• Understand reliability improvement using multiple sensors
2. Required Components
Component Quantity
Raspberry Pi 4 1
Flame Sensor Module 1
Gas Sensor (MQ-2) 1
Light Sensor (LDR Module) 1
LED (Red) 1
Buzzer 1
Resistor (220Ω) 1
Breadboard 1
Jumper Wires Several
Component Quantity
Power Supply 1
3. System Overview
The system continuously monitors environmental conditions using three sensors
simultaneously.
If any abnormal condition is detected:
• Fire detected
• Gas leak detected
• Sudden light detected
Then:
• LED turns ON
• Buzzer activates
• Warning message is displayed
4. Raspberry Pi GPIO Pin Configuration
Device GPIO Pin
Flame Sensor GPIO 17
Gas Sensor GPIO 27
Light Sensor GPIO 22
LED GPIO 18
Buzzer GPIO 23
Power 5V
Ground GND
5. Real Wiring Photos — Raspberry Pi Multi-Sensor System
Figure 1 — Raspberry Pi with Breadboard Setup
Figure 1: Basic Raspberry Pi hardware setup used in robotics laboratories.
Figure 2 — Flame Sensor Wiring to Raspberry Pi
Figure 2: Flame sensor connected to Raspberry Pi GPIO.
Figure 3 — Gas Sensor (MQ-2) Wiring
Figure 3: Gas sensor wiring for gas leak detection.
Figure 4 — Light Sensor (LDR) Wiring
Figure 4: Light sensor used for detecting light intensity.
Figure 5 — LED and Buzzer Alarm System
Figure 5: LED and buzzer alarm system.
6. Complete Wiring Diagram
Figure 6 — Full Multi-Sensor Safety System
Figure 6: Complete multi-sensor detection system.
7. Python Program
import [Link] as GPIO
import time
FLAME_SENSOR = 17
GAS_SENSOR = 27
LIGHT_SENSOR = 22
LED = 18
BUZZER = 23
[Link]([Link])
[Link](FLAME_SENSOR, [Link])
[Link](GAS_SENSOR, [Link])
[Link](LIGHT_SENSOR, [Link])
[Link](LED, [Link])
[Link](BUZZER, [Link])
print("Multi-Sensor Safety Monitoring System Running...")
try:
while True:
flame = [Link](FLAME_SENSOR)
gas = [Link](GAS_SENSOR)
light = [Link](LIGHT_SENSOR)
if flame == 0:
print("Fire Detected!")
[Link](LED, True)
[Link](BUZZER, True)
elif gas == 0:
print("Gas Leak Detected!")
[Link](LED, True)
[Link](BUZZER, True)
elif light == 0:
print("High Light Detected!")
[Link](LED, True)
[Link](BUZZER, True)
else:
print("Environment Normal")
[Link](LED, False)
[Link](BUZZER, False)
[Link](1)
except KeyboardInterrupt:
print("Program stopped")
[Link]()
8. Experiment Procedure
Students must perform the following steps:
1. Connect Raspberry Pi to power
2. Connect Flame sensor
3. Connect Gas sensor
4. Connect Light sensor
5. Connect LED and buzzer
6. Run Python program
7. Test each sensor individually
8. Observe system behavior
9. Expected Results
The system should:
• Detect fire using flame sensor
• Detect gas leakage using gas sensor
• Detect light intensity changes
• Activate LED and buzzer alarm
• Return to normal state when conditions are safe
10. Applications
This system can be used in:
• Smart homes
• Industrial safety systems
• Warehouse monitoring
• Robot safety monitoring
• Hospital safety systems
• Autonomous robots
• Smart factories
11. Safety Instructions
Students must:
• Use a small flame only
• Keep water nearby
• Avoid direct exposure to gas
• Turn off power after experiment
• Work under instructor supervision