Introduction
In this project, we will create a smoke detection and fire sprinkler control system using an Arduino. The system will detect smoke using an MQ2 sensor and display the smoke level on an LCD with an I2C module. When the smoke level exceeds a certain threshold, the system will activate a water pump for the fire sprinkler using a relay.
Fire safety is a critical concern in both residential and industrial environments. Early detection of smoke can prevent fires from spreading and save lives. This project uses an MQ2 smoke sensor to detect smoke levels and an LCD with I2C to display the readings. Additionally, a relay-controlled pump will activate the fire sprinkler system when the smoke level surpasses a predefined threshold.
Working Principle
The MQ2 sensor detects smoke levels in the environment by measuring changes in resistance. The Arduino processes the sensor data and displays the smoke level on an LCD. If the smoke level exceeds a set threshold, the Arduino activates a relay to power a water pump, which then activates the fire sprinkler system.
Things We Need
To build this system, you will need the following components:
- Arduino Uno
- Smoke sensor (MQ-2)
- Relay module
- LCD display (16×2) with I2C Module
- 10k ohm Potentiometer
- Fire sprinkler system (e.g., a solenoid valve and water supply)
- Jumper wires
- Breadboard or PCB for circuit assembly
- Power supply (for the Arduino and sprinkler system)
Circuit Diagram
Relay Module:
- IN to digital pin 7 on Arduino
- VCC to 5V on Arduino
- GND to GND on Arduino
- COM to one terminal of the pump
- NO to power supply positive terminal
- GND of power supply to the other terminal of the pump
Working of the System with Arduino
- Smoke Detection: The smoke sensor continuously monitors the air for the presence of smoke or other combustible gases. When smoke is detected, the sensor sends a signal to the Arduino.
- Arduino Processing: The Arduino receives the signal from the smoke sensor and processes the data. It then activates the relay module to trigger the sprinkler system.
- Fire Sprinkler Activation: The relay module is used to control the solenoid valve of the fire sprinkler system. When the relay is energized by the Arduino, it opens the valve, allowing water to flow through the sprinkler system.
- LCD Display: The LCD display provides real-time information about the system’s status. It can show messages like “System Armed” when there is no smoke detected and “Fire Detected – Sprinklers Activated” when smoke is detected and the sprinkler system is engaged.
Code
Here’s a simplified example of Arduino code for this system:
Install Liquid Crystal I2C Library before using this code. Please refer to How to interface Liquid Crystal Display.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Initialize the LCD with I2C address 0x27
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Define the pin for the MQ2 sensor
const int sensorPin = A0;
const int relayPin = 7;
// Define the smoke level threshold
const int smokeThreshold = 300;
void setup() {
// Initialize the LCD
lcd.begin();
lcd.backlight();
// Initialize the serial communication
Serial.begin(9600);
// Set the relay pin as output
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, LOW);
// Print welcome message on the LCD
lcd.setCursor(0, 0);
lcd.print("Smoke Level:");
}
void loop() {
// Read the analog value from the MQ2 sensor
int smokeLevel = analogRead(sensorPin);
// Print the smoke level to the serial monitor
Serial.print("Smoke Level: ");
Serial.println(smokeLevel);
// Display the smoke level on the LCD
lcd.setCursor(0, 1);
lcd.print(smokeLevel);
lcd.print(" "); // Clear any extra characters
// Check if the smoke level exceeds the threshold
if (smokeLevel > smokeThreshold) {
// Activate the relay to turn on the pump
digitalWrite(relayPin, HIGH);
lcd.setCursor(0, 0);
lcd.print("FIRE DETECTED! ");
} else {
// Deactivate the relay to turn off the pump
digitalWrite(relayPin, LOW);
lcd.setCursor(0, 0);
lcd.print("Smoke Level: ");
}
// Delay for a short period before the next reading
delay(500);
}
Conclusion
In this project, we created a smoke detection and fire sprinkler control system using an Arduino, an MQ2 smoke sensor, an I2C LCD module, and a relay-controlled water pump. The system detects smoke levels, displays the readings on an LCD, and activates a fire sprinkler when the smoke level exceeds a certain threshold. This project demonstrates the integration of sensors, displays, and actuators in a practical fire safety application, making it an excellent project for learning and real-world implementation.