Skip to main content

Smoke And Gas Detector

Smoke Detector with Arduino & MQ-2 Sensor



Welcome, In this Blog we will simulate how to use the gas sensor, to detect the presence of a toxic gas, or smoke, in a given location. we will process and display the results, using an LCD display and 2 indicator lights.

Components Used:

  • MQ-2 Gas sensor
  • Arduino
  • LED 16*2
  • Breadboard
  • Connecting wires
  • Led Bulb (Red and Green)
In this project the MQ2 gas sensor is used for the detection of gas leaks for equipment in the consumer and industrial markets. This sensor  detects LPG, i-butane, propane, methane, alcohol, hydrogen and smoke. He has great sensitivity and a quick response time. his sensitivity can also be adjusted by a potentiometer. it has two outputs: analog and digital, for this project we use the digital output. Open Proteus, new project, you can name it gas sensor, find a place to save it, choose a default project, and follow the steps.


Open the component library, search for Arduino Uno, or any other , if you can't find it, you download it from the net, and add it to your library. search for the Gas MQ-2 detector, you can download and add it to your library. To Download click on the link below. choose a resistance of 560 ohms, that we will put it in series with the witness lights. Bring a green LED. Bring a red LED. search for the LCD display 2 lines and 16 columns, it is more than enough for this application. add a status indicator to indicate the presence of gas or smoke. We position our Arduino in the middle, then we slide the gas sensor, and the status indicator. We add a voltage source, we name it Vcc, And a mass, then we connect all that. The mass with the mass of the Arduino, and the sensor. Like for the voltage sources, connect the status indicator with the Test Pin input. We connect the OUT pin of the sensor with the digital pin 9 of the Arduino. It is a choice, you can choose any digital pin as long as you configure it as input. place our LED , we start with the green in series with the resistance  of 560 ohms. Then we put the red LED. If there is gas or smoke in the room, the red light will be turned on, and a message will appear. else,  the green LED is turned on. connect the red bulb with the digital pin 6, and the green bulb with the digital pin 7. Of course we don't forget the mass. still have the LCD display to set up. 

Connections:

Connect pins D4 to D7 of the display with the digital inputs / outputs of the Arduino 2 to 5. You can modify this choice, I'll show you later how to initialize all this in the program. connect the Pin E with 11, and RS with 12. Vss and RW with the mass. This wiring method is almost a convention, unless there are space constraints.Open the Arduino compiler, the first thing to do is to declare the LIQUID CRYSTAL library which contains the functions of the display. Then, we call the LCD function which is used to initialize the digital inputs / outputs of the Arduino with the display, The two first  parameters are the numbers of  the digital pin Arduino, linked with the E and RS Pin of the LCD display. the other 4 parameter, are the Pin of Arduino connected with the Pin, D2 to D7 on the LCD display. All of these inputs / outputs are digital. declare a Gas as an integer, wich represents the number of the Pin that will read the state of the sensor. declare 2 integers: red led and green led, which represent the digital output numbers of Pin connected with the red and green LED bulbs respectively. configure the digital pin 9 as inputs, it will certainly have 2 states, that is HIGH which indicates the presence of a gas or smoke. Or LOW which indicates no Gas or Smoke.

Code:

int Input = A0;
int SensorVal = 0;

int Check = 0;

void setup() {
  Serial.begin(9600);
  pinMode(Input, INPUT);
  Serial.println("Interfacing of Smoke Sensor with Arduino");
  Serial. println("Design by www.TheEngineeringProjects.com");
  Serial.println();
}

void loop() {

  SensorVal = analogRead(Input);
  if((SensorVal > 500) && (Check == 1))
  {
    Serial.println("Smoke Detected . . .");
    Check = 0;
  }

  if((SensorVal < 500) && (Check == 0))
  {
    Serial.println("All Clear . . .");
    Check = 1;
  }
  //Serial.println(SensorVal);
  delay(500);
}

Conclusion:

If we read the value of digital input 9 is HIGH or equal to 1, then Position the display cursor on the zero line and the zero column And write the following message: Gas detected Yes. And turn on the red light. And of course turn off the Green light. Otherwise, if there is no gas or smoke. Then position yourself on the line and the column 0, And write: No gas detected, and turn on the green light. and turn off the red light, With the digital write function (digital output number, status) wait 500 milliseconds, the time to read the results. clear the display and resume the cycle again. We're trying to simulate all of this. We  save the 
project. if you want the file to be accepted by the Arduino, you need to export it in the form .HEX, For that, go to sketch, then choose: export compiled binary, you will find it with your Arduino file. Return to Proteus, make sure the LEds bulbs have a digital configuration. Double click on the Gas sensor, search its  HEX file, it is in the Gas Sensor Library for Proteus, Then, Double click on the Arduino and you import the file. HEX that you have compiled. start the simulation, switch the state of the sensor to verify that everything is working well. See you next time for another Arduino tutorial. 

Arduino Library For Proteus: Download Here

Comments

Post a Comment

If you have any doubts ,Please let me know.

amazon banner

Popular posts from this blog

Automatic Water Tap Control

Automatic Water Tap Control System Using Arduino Hello, viewers welcome to our new project demonstration.The project title is automatic basin tap control system using Arduino with IR obstacle sensor. The project have another part which is detect the motion and control the light automatically.  Let's see how it is made.  Components list: * Arduino Nano * 16*2 LCD display * Water Tap * IR Sensor * 10k potentiometer * PIR Motion Sensor * 5v LED light * 12v Dc water pump * 12v transformer * BC547 Transistor * 4*2 Battery * On/OFF Switch * 10k Resistor * 100ohm resistor * Veroboard * Some Jumper wire For making this project single Arduino nano-board, 16*2 LCD Display. This is a PIR motion sensor and 5v LED light.The power switch for the circuit. This is another PIR motion sensor and 5v LED light. Here we supply the power using two 4V batteries. This is the rectifier circuit with 12V Auto Dc Transformer. Here we connect the 12V dc water pump motor. This IR obstacle sensor and water ...

Motion Detector Camera

Motion Detector With Photo Capture Camera   Hello friends!! Welcome to This Blog. In this Blog, we will make a motion sensor detector with photo capture using ESP32CAM and the PIR module. The logic behind is when the PIR sensor detects any motion, the ESP32CAM will start taking the pictures. So you can use this project as a security camera. In thisblog, I will share the circuitdiagram, Arduino sketch, and the component list, so after reading the complete article you can easily make this project. Now ESP32 CAM is a small camera module that has ESP32S chip on the back and some GPIO pins to connect peripherals and it also has a micro-SD card slot, where you can insert the micro-SD card and store the pictures. Now before going to the circuit diagram and Arduino sketch, let me give you a quick overview of this project.  Components Required ESP32-CAM  PIR Motion Sensor Module BC547 NPN Transistor 220ohm, 1k, 10k Resistor. LED 5-mm FTDI 232 USB to Serial Interface board 5 v...

Wireless Weather Station

Wireless weather station u sing Arduino   Dear friends welcome back! Today we are going to build a wireless weather station project using Arduino.Without any further delay, let’s get started!  A Wireless Weather Station with a big 3.2” Color TFT display. The project is up and running,and it displays the current date and time, the indoor temperature and humidity, and the outdoor temperature and humidity. The readings of the outdoor sensor are updated every second in order to demonstrate that we have a reliable communication link established with the transmitter which is outside at a distance of 5m. The readings of the indoor sensor are updated once every minute. The heart of the project is the fast Arduino Due, there is no flickering of the screen when the values are updated. Let’s now see the transmitter.  The transmitter is much simpler. It consists of an Arduino Nano, a DHT22 sensor and the NRF24L01 wireless transceiver module. The transmitter reads the temperature and ...