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

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 volt DC supply  The

Bidirectional Visitor Counter

Bidirectional Visitor Counter using Arduino A bidirectional visitor counter using Arduino may be a reliable circuit that takes over the task of counting variety of Persons/Visitors within the Room very accurately. if somebody enters into the space then the Counter is incremented by one and also leaves it might be incremented. MATERIALS REQUIRED: Arduino IR Module 16*2 LED 5V Relay Resistor(1K,220 ohm) Breadboard Jumper Wires The total number of persons inside the space is Shows on the 16X2 LCD module. The microcontroller does the work it receives the signals from the sensors, and this signals operated under the control of software which is stored in EPROM of Arduino. There are two IR Modules are used. first, one are often wont to count the amount of persons entering a hall within the up mode at the doorway gate. and therefore the other can count the amount of persons leaving the hall by decrementing the count at the exit gate. In this Project will helps to Wastage of electricity. In ou

Obstacle Avoiding Robot

Obstacle Avoiding Robot using Arduino and Ultrasonic Sensor A simple project on Obstacle Avoiding Robot is meant here. Robotics is a stimulating and fast growing field. Being a branch of engineering, the applications of robotics are increasing with the advancement of technology.The concept of Mobile Robot is fast evolving and therefore the number of mobile robots and their complexities are increasing with different applications. There are many kind of mobile robot navigation techniques like path planning, self – localization and map interpreting. An Obstacle Avoiding Robot may be a sort of autonomous mobile robot that avoids collision with unexpected obstacles. In this project, an Obstacle Avoiding Robot is supposed. It's an Arduino based robot that uses Ultrasonic range finder sensors to avoid collisions.  Components Required Arduino NANO or Uno  🛒 HC-SR04 Ultrasonic Sensor  🛒 LM298N Motor Driver Module  🛒 5V DC Motors  🛒 Battery  🛒 Wheels 🛒 Chassis  🛒 Jumper Wires  🛒 Circ