DUAL POWER SUPPLY ARDUINO GAS LEAKAGE DETECTOR
MQ2 Gas Sensor Module
MQ2 gas sensor can be used to detect the presence of LPG, Propane and Hydrogen, also could be used to detect Methane and other combustible steam, it is low cost and suitable for different application. Sensor is sensitive to flammable gas and smoke. Smoke sensor is given 5 volt to power it. Smoke sensor indicates smoke by the voltage that it outputs .More smoke more output. A potentiometer is provided to adjust the sensitivity. Sn02 is the sensor used which is of low conductivity when the air is clean. But when smoke exist sensor provides an analog resistive output based on concentration of smoke. The circuit has a heater. Power is given to heater by VCC and GND from power supply. The circuit has a variable resistor. The resistance across the pin depends on the smoke in air in the sensor. The resistance will be lowered if the content is more. And voltage is increased between the sensor and load resistor.
MQ2 Module Schematic
SPECIFICATIONS
- Power Supply: 4.5V to 5V DC
- High sensitivity to Propane, Smoke, LPG and Butane
- Wide range high sensitivity to Combustible gases
- Long life and low cost
- Analog and Digital output available
- Onboard visual indicator (LED) for indicating alarm
- Compact design and easily mountable
- Simple 4 PIN header interface
- Drive circuit is simple.
- Sensor Type : Semiconductor
- Concentration : 300-10000ppm ( Combustible gas)
- Supply voltage = 5v
MQ2 Working Principle
The MQ2 has an electrochemical sensor, which changes its resistance for different concentrations of varied gasses. The sensor is connected in series with a variable resistor to form a voltage divider circuit (Fig 1), and the variable resistor is used to change sensitivity. When one of the above gaseous elements comes in contact with the sensor after heating, the sensor’s resistance change. The change in the resistance changes the voltage across the sensor, and this voltage can be read by a microcontroller. The voltage value can be used to find the resistance of the sensor by knowing the reference voltage and the other resistor’s resistance. The sensor has different sensitivity for different types of gasses.
Arduino nano
The circuit diagram above shows that Vin is connected to an internal voltage regulator, hence it can take 12 - 7V DC as supply voltage.
The arduino serial plotter is used here as an oscilloscope for callibration of the sensor. Note that we could use the analogue output of the MQ2 module only as a data source for the arduino serial plotter and use the digital output to actuate the buzzer. Doing that would require adjusting the variable resistor on the module for callibration. I actually used both (kinda). An LED on the module comes on when the digital output goes high. I adjusted this to come on under the same conditions the buzzer should on, hence eliminating the need for any extra indicator LEDs, or using the arduino built in LED.
Arduino Code
#define SENSOR_ANALOG A5
#define BUZZER 10
#define THRESHOLD 100 //This value depends on what you are sensing
#define DELAY 500
void setup() {
Serial.begin(9600);
pinMode(SENSOR_ANALOG, INPUT);
pinMode(BUZZER, OUTPUT);
}
void loop() {
int analogSensorReading = analogRead(SENSOR_ANALOG);
Serial.println(analogSensorReading);
if(analogSensorReading > THRESHOLD) {
digitalWrite(BUZZER, HIGH);
delay(DELAY);
digitalWrite(BUZZER, LOW);
delay(DELAY);
}else {
digitalWrite(BUZZER, LOW);
}
digitalWrite(BUZZER, LOW);
}
If the information above does not satisfy your needs, you are 100% free to ask in the comments, and if you feel there is a feature that should have been added, feel free to point that out. It would make me feel good to know I've got folks with similar interests out there.
Note: I do not guarantee this as an optimal commercial system. It is nothing but a hobbyist's test job.
Cool innovative product. I just upload an another innovative product of solar powered tricycle.
Checkout my blog