Introduction
Gas leaks can pose significant risks in various environments, from homes to industrial facilities. To ensure safety and prevent accidents, it’s crucial to detect gas leaks promptly.
In this article, we will guide you through the process of building a gas leakage detector using an Arduino Nano, an MQ135 gas sensor, an I2C 16×2 LCD, red and green LEDs, and a SIM800 GSM module.
This DIY project will help you create a reliable gas detection system with real-time alerts.
Components Needed
- Arduino Nano
- MQ-135 Sensor
- 16×2 LCD Display with I2C
- GSM sim800l Module
- LED
- Buzzer
- Wire
- Zero PCB
- 9V power supply
Circuit Diagram
- Connect the VCC pin of the MQ135 sensor to the 5V pin of the Arduino Nano.
- Connect the GND pin of the MQ135 sensor to the GND pin of the Arduino Nano.
- Connect the AOUT pin of the MQ135 sensor to the A0 analog input pin of the Arduino Nano.
- Connect the SDA pin of the LCD to the A4 pin (SDA) of the Arduino Nano.
- Connect the SCL pin of the LCD to the A5 pin (SCL) of the Arduino Nano.
- Connect the positive leg of the red LED to pin 4 of the Arduino Nano.
- Connect the positive leg of the green LED to pin 5 of the Arduino Nano.
- Connect the cathode (negative leg) of both LEDs to the GND pin of the Arduino Nano.
- Connect the SIM800 GSM module Tx to 2 and RX to 3 Pin of the Arduino Nano.
Arduino Uno-Based GAS Detector
Source Code
Before uploading the code just upload a few lib
Now Select the proper Board And upload the code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
//Prateek //https://justdoelectronics.com #include <LiquidCrystal_I2C.h> #include <Wire.h> #include <SoftwareSerial.h> LiquidCrystal_I2C lcd(0x27, 16, 2); SoftwareSerial mySerial(2, 3); int gasValue = A0; int data = 0; int Red = 6; int Green = 7; void setup() { randomSeed(analogRead(0)); mySerial.begin(9600); Serial.begin(9600); lcd.init(); lcd.backlight(); pinMode(gasValue, INPUT); pinMode(Red, OUTPUT); pinMode(Green, OUTPUT); lcd.print(" WELCOME TO"); lcd.setCursor(0, 1); lcd.print("JSUTDOELECTRONIC"); delay(3000); lcd.clear(); lcd.print(" Gas Leakage "); lcd.setCursor(0, 1); lcd.print(" Detector Alarm "); delay(3000); lcd.clear(); } void loop() { data = analogRead(gasValue); Serial.print("Gas Level: "); Serial.println(data); lcd.print("Gas Scan is ON"); lcd.setCursor(0, 1); lcd.print("Gas Level: "); lcd.print(data); delay(1000); if (data > 80) { SendMessage(); Serial.print("Gas detect alarm"); lcd.clear(); lcd.setCursor(0, 0); lcd.print(" Gas Leakage"); lcd.setCursor(0, 1); lcd.print(" SMS Sent"); delay(1000); digitalWrite(Red, HIGH); digitalWrite(Green, LOW); } else { Serial.print("Gas Level Low"); lcd.clear(); lcd.setCursor(0, 0); lcd.print("Gas Level Normal"); digitalWrite(Red, LOW); digitalWrite(Green, HIGH); delay(1000); } lcd.clear(); } void SendMessage() { Serial.println("Gas Alert"); mySerial.println("AT+CMGF=1"); delay(1000); mySerial.println("AT+CMGS=\"+918830584864xx\"\r"); mySerial.println("Hi Prateek Gas Detected plz Open Windows And Check Your Gas Cylinder"); delay(100); mySerial.println((char)26); delay(1000); } |
Video
Conclusion
This project offers a cost-effective solution for gas leak detection with real-time alerts, ensuring safety in various environments. Experiment with different gases, improve the system’s accuracy and extend its functionality to meet your specific requirements.
Arduino Based Projects
Hello.. Which sim to insert in Sim800L gsm..
Like normal phone sim card can i insert (Vodafone or BSNL)?