Ticker

6/recent/ticker-posts

Gas Leakage Detector

 

Gas leakage detector using Arduino



Welcome to the Technical Praveen guys, in this article I will make Gas leakage detector utilizing Arduino that is essentially utilized for LPG identification. we can utilize this in our kitchen. on the off chance that somebody neglects to off the burner or any spillage occurred from the gas pipe. so this sensor alert can without much of a stretch distinguish and make you mindful of the spillage. so this is a valuable alert and simple to make. you need just Arduino buzzer and the presentation is consistently discretionary. you can save yourself with this modest caution. there is substantially more caution without programming yet this is the exact one. it has a significant decent exactness. Bookmark my site to learn more fundamental and moderate level undertaking. my last venture Metal Detector is awesome as should be obvious on my site.

How does it work?

My Gas leakage detector utilizing Arduino is exceptionally responsive and appealing additionally in light of the fact that I am utilizing the OLED display to show the data of the framework to the screen. as I am utilizing the MQ 6 sensor here which is the gas receptive sensor. it has a curl that responds to the gas and differs the information. at whatever point it faculties LPG gas the estimation of the yield of the sensor will begin the change as I will impart to you. the sensor can give both yield simple just as advanced. as I am turning out here for the precision since I can take the risk so I will utilize the simple one. simple is more exact than the computerized. so at whatever point the sensor come in the contact with the gas it changes the worth and sends it to the Arduino. Arduino measures the worth and contrasts it and the given limit an incentive in the information base. what's more, if the condition gets genuine the alert beginning and if the condition isn't accurate the caution won't begin. I likewise added some character into the OLED display which is intriguing.

The OLED display is the most alluring presentation in the ventures at this moment. this undertaking will show the estimation of the sensor and status. there are two statuses one is ALL WELL and another is WARNING. there is a buzzer and driven likewise for the warning. as the framework recognizes gas it will begin to make sound through a buzzer and the Red LED will begin to shine.

Components Required:-

  • MQ 6
  • Arduino Nano
  • OLED
  • PCB
  • Buzzer
  • RGB LED
  • Wires
CIRCUIT DIAGRAM :-



CODE :-

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET     4 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

#define NUMFLAKES     10 // Number of snowflakes in the animation example

#define LOGO_HEIGHT   16
#define LOGO_WIDTH    16
static const unsigned char PROGMEM logo_bmp[] =
{ B00000000, B11000000,
  B00000001, B11000000,
  B00000001, B11000000,
  B00000011, B11100000,
  B11110011, B11100000,
  B11111110, B11111000,
  B01111110, B11111111,
  B00110011, B10011111,
  B00011111, B11111100,
  B00001101, B01110000,
  B00011011, B10100000,
  B00111111, B11100000,
  B00111111, B11110000,
  B01111100, B11110000,
  B01110000, B01110000,
  B00000000, B00110000 };






void setup() {
  pinMode(A0, INPUT);
   pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  Serial.begin(9600);

  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }

  // Show initial display buffer contents on the screen --
  // the library initializes this with an Adafruit splash screen.
  display.display();
  delay(2000); // Pause for 2 seconds

  // Clear the buffer
  display.clearDisplay();

  // Draw a single pixel in white
  display.drawPixel(10, 10, SSD1306_WHITE);

  // Show the display buffer on the screen. You MUST call display() after
  // drawing commands to make them visible on screen!
  display.display();
  delay(2000);
  // display.display() is NOT necessary after every single drawing command,
  // unless that's what you want...rather, you can batch up a bunch of
  // drawing operations and then update the screen all at once by calling
  // display.display(). These examples demonstrate both approaches...

 //testdrawline();      // Draw many lines

  //testdrawrect();      // Draw rectangles (outlines)

  //testfillrect();      // Draw rectangles (filled)

 // testdrawcircle();    // Draw circles (outlines)

  //testfillcircle();    // Draw circles (filled)

  //testdrawroundrect(); // Draw rounded rectangles (outlines)

  //testfillroundrect(); // Draw rounded rectangles (filled)

  //testdrawtriangle();  // Draw triangles (outlines)

 // testfilltriangle();  // Draw triangles (filled)

  //testdrawchar();      // Draw characters of the default font

 // testdrawstyles();    // Draw 'stylized' characters

//  testscrolltext();    // Draw scrolling text

 // testdrawbitmap();    // Draw a small bitmap image

  // Invert and restore display, pausing in-between
  display.invertDisplay(true);
  delay(1000);
  display.invertDisplay(false);
  delay(1000);
  pinMode(A0, INPUT);
  Serial.begin(9600);

 // testanimate(logo_bmp, LOGO_WIDTH, LOGO_HEIGHT); // Animate bitmaps
}






void loop() {
  // put your main code here, to run repeatedly:



int p= analogRead(A0);
Serial.println(p);
display.clearDisplay();
  display.setTextSize(2); // Draw 2X-scale text
  display.setTextColor(SSD1306_WHITE);
 
   if(p>= 260 )

   {display.setCursor(5, 8);
    display.println(p);
  display.setCursor(60, 5);
   display.setTextSize(1); 
  display.println(F("WARNING"));



display.setCursor(60, 20);
   display.setTextSize(1); 
  display.println(F("GAS LEAKAGE"));
digitalWrite(2, LOW);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  display.display();
  delay(50);
   }
else

  
{
   display.setCursor(5, 8);
  
   display.println(p);
  display.setCursor(60, 12);
   display.setTextSize(1); 
  display.println(F("ALL WELL"));
  display.display();
  digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  delay(50);
  
  
  
  }

}
  #define XPOS   0 // Indexes into the 'icons' array in function below
#define YPOS   1
#define DELTAY 2

Post a Comment

0 Comments