SMOKE DETECTION using MQ-5 GAS SENSOR
INTRODUCTION
Hello everyone, I hope you all are doing great. In today’s tutorial, we are gonna have a look at how to design a Smoke Detector with Arduino. It’s quite a simple project but if you are working on any security project then you must add this feature in it
OVERVIEW
The gas sensing material used in MQ-5 smoke sensors is tin dioxide (SnO5) with lower conductivity in clean air. When there is a flammable gas in the environment where the sensor is located, the conductivity of the sensor increases as the concentration of flammable gas in the air increases. The change in conductivity can be converted to an output signal corresponding to the gas concentration using a simple circuit. The MQ-5 smoke sensor has high sensitivity to butane, propane and methane, and has a good balance between methane and propane.This sensor detects a wide range of flammable gases, especially natural gas, and is a low-cost sensor for a wide range of applications.
DETAILS
Smoke Detectors are very useful in detecting smoke or fire in buildings, and so are the important safety parameters. In this DIY session, we are going to build a Smoke Detector Circuit which not only sense the smoke in the air but also reads and displays the level of Smoke in the Air in PPM (parts per million). This circuit triggers the Buzzer when Smoke level becomes higher than 1000 ppm, this threshold value can be changed in the Code according to the requirement. This circuit mainly uses MQ-5 Smoke/Gas sensor and Arduinoto detect and calculate the level of smoke. MQ-5 smoke sensor is also sensible to LPG, Alcohol, and Methane etc.
COMPONENTS NEEDED:
- Arduino Uno
- MQ5 Gas Sensor – 1
- Piezo Buzzer – 1
- LEDs – 2
- 100 ohms Resistor – 3
- Male – Male Jumper Wires
PIN WIRING
The MQ-5 sensor has 4 pins.
Pin————————————-Wiring to Arduino Uno
A0————————————-Analog pins
D0————————————-Digital pins
GND———————————–GND
VCC————————————5V
So, before jumping into the coding part, let’s check whether we’ve assembled all the necessary hardware components correctly
CODE
int redLed = 12; int greenLed = 11; int buzzer = 10; int smokeA0 = A5; // Your threshold value int sensorThres = 400; void setup() { pinMode(redLed, OUTPUT); pinMode(greenLed, OUTPUT); pinMode(buzzer, OUTPUT); pinMode(smokeA0, INPUT); Serial.begin(9600); } void loop() { int analogSensor = analogRead(smokeA0); Serial.print("Pin A0: "); Serial.println(analogSensor); // Checks if it has reached the threshold value if (analogSensor > sensorThres) { digitalWrite(redLed, HIGH); digitalWrite(greenLed, LOW); tone(buzzer, 1000, 200); } else { digitalWrite(redLed, LOW); digitalWrite(greenLed, HIGH); noTone(buzzer); } delay(100); }