LPG Gas Leakage Detector Circuit using Arduino is important safety tool which can stop accidents.
This project uses Arduino to check LPG gas in air.
If gas level goes too high then buzzer make sound and LCD show warning.
Through this circuit people know danger fast.
Code Programming and Explanation:
#include <LiquidCrystal.h>
// Define pins
const int gasSensorPin = A0;
const int buzzerPin = 13;
const int threshold = 300; // Adjust threshold as needed
// Initialize LCD
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// Set up sensor and LCD
pinMode(gasSensorPin, INPUT);
pinMode(buzzerPin, OUTPUT);
lcd.begin(16, 2);
}
void loop() {
int sensorValue = analogRead(gasSensorPin);
// Check for gas leak
if (sensorValue < threshold) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("No Gas Leak");
digitalWrite(buzzerPin, LOW);
} else {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Gas Leak Detected!");
digitalWrite(buzzerPin, HIGH);
}
delay(100);
}
Code Explanation:
- Code include Liquid Crystal library for LCD.
- Gas sensor pin connects to Arduino analog pin to read gas level.
- Buzzer pin connects to Arduino digital pin to control buzzer.
- Threshold is set value to detect gas leak.
- We can change it for more or less sensitivity.
- In setup(), LCD, sensor and buzzer pins are set.
- In loop() Arduino keeps reading sensor, check with threshold and then turns buzzer and LCD ON or OFF as needed.
Circuit Working:
Parts List:
Component | Quantity |
---|---|
Resistors | |
1k 1/4 watt | 1 |
Potentiometer 10k | 1 |
Semiconductors | |
Arduino Uno board | 1 |
LPG gas sensor module (MQ-2 or similar) | 1 |
16×2 LCD display | 1 |
Buzzer | 1 |
IC 7809 | 1 |
Transistor BC547 | 1 |
In this project we used Arduino board, gas sensor MQ-2, buzzer and LCD screen.
Arduino reads gas sensor and shows message on LCD and turns ON the buzzer if needed.
We can change sensor sensitivity.
MQ-2 sensor checks LPG gas by change in resistance.
More gas means less resistance.
Sensor gives analog voltage and Arduino reads it and compares with threshold.
If value is more than threshold then gas leak is detected.
Arduino turns ON the buzzer using transistor and shows warning on LCD.
System keeps checking gas level and gives updates until its safe again.
How to Build:
To build a LPG Gas Leakage Detector Circuit using Arduino we need to follow the below mentioned steps:
- Collect all parts shown in the circuit diagram.
- Connect IC1 7809 to give stable 9V DC power to Arduino.
- Connect 10k pot like this:
- 1st pin connects to VCC of LCD
- 2nd pin connects to VO of LCD,
- 3rd pin connects to GND of LCD.
Connection of LCD to Arduino are mentioned below:
- Connect LCD VCC pin to 5V on Arduino.
- Connect LCD GND pin to GND on Arduino.
- Connect LCD Anode pin to 5V through pot resistor to control brightness.
- RS pin goes to Arduino pin 12.
- E Enable pin goes to Arduino pin 10.
- D4, D5, D6, D7 pins goes to Arduino pins 4, 5, 6, 7.
- RW pin connects to GND on Arduino.
Connections for Buzzer, Transistor BC547, and LPG Gas Sensor are mentioned below:
Buzzer and BC547 Transistor Connection:
- One leg of buzzer goes to collector of BC547.
- Other leg of buzzer goes to 5V on Arduino.
- BC547 base connects to Arduino pin 13 through 1k resistor.
- Emitter of BC547 connects to GND.
LPG Gas Sensor Connections:
- VCC pin connects to 5V on Arduino.
- GND pin to connects GND on Arduino.
- AOUT pin connects to analog pin A0 on Arduino.
Note:
- Always follow safety rules when working with gas.
- For better results use high sensitivity gas sensor.
- Use a relay for big loads like fans or alarms.
- Add battery backup for nonstop working.
- Add wireless feature for alerts and remote watch.
Conclusion:
LPG Gas Leakage Detector Circuit using Arduino is a life-saving safety device.
With Arduino and basic parts a strong system we can be built.
Ensure to test and adjust the system properly.
References:
Detecting LPG Leakage and Automatic Turn off using Arduino Connected with PIR Sensor