Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Techatronic
Published

Blynk LPG Detector

This is an LPG detector project that uses an MQ-6 sensor for detecting LPG gas leakage.

BeginnerFull instructions provided2 hours266
Blynk LPG Detector

Things used in this project

Story

Read more

Code

Code snippet #1

Plain text
void setup() 
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  timer.setInterval(1000L, getSendData);
}
 
void loop() 
{
  timer.run(); // Initiates SimpleTimer
  Blynk.run();
}

Code snippet #2

Plain text
void setup() 
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  timer.setInterval(1000L, getSendData);
}
 
void loop() 
{
  timer.run(); // Initiates SimpleTimer
  Blynk.run();
}

Code snippet #3

Plain text
void getSendData()
{
data = analogRead(mq6); 
  Blynk.virtualWrite(V2, data); // Blynk INPUT Connect V2 Pin
 
  if (data > 700 )
  {
    Blynk.notify("LPG Detected!"); 
  }
 
}

Code snippet #4

Plain text
void getSendData()
{
data = analogRead(mq6); 
  Blynk.virtualWrite(V2, data); // Blynk INPUT Connect V2 Pin
 
  if (data > 700 )
  {
    Blynk.notify("LPG Detected!"); 
  }
 
}

Code snippet #5

Plain text
//TECHATRONIC.COM
// BLYNK LIBRARY
// https://github.com/blynkkk/blynk-library
// ESP8266 LIBRARY
// https://github.com/ekstrand/ESP8266wifi

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
char auth[] = "your-auth-code"; //Enter Authentication code sent by Blynk
 

char ssid[] = "your-wifi-ssid"; //Enter WIFI Name
char pass[] = "your-wifi-password"; //Enter WIFI Password
 
SimpleTimer timer;
 
int mq6 = A0; // LPG sensor MQ -6 is connected with the analog pin A0 
int data = 0; 
void setup() 
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  timer.setInterval(1000L, getSendData);
}
 
void loop() 
{
  timer.run(); // Initiates SimpleTimer
  Blynk.run();
}
 
void getSendData()
{
data = analogRead(mq6); 
  Blynk.virtualWrite(V2, data); // Blynk INPUT Connect V2 Pin
 
  if (data > 700 )
  {
    Blynk.notify("LPG Detected!"); 
  }
 
}

Code snippet #6

Plain text
//TECHATRONIC.COM
// BLYNK LIBRARY
// https://github.com/blynkkk/blynk-library
// ESP8266 LIBRARY
// https://github.com/ekstrand/ESP8266wifi

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
char auth[] = "your-auth-code"; //Enter Authentication code sent by Blynk
 

char ssid[] = "your-wifi-ssid"; //Enter WIFI Name
char pass[] = "your-wifi-password"; //Enter WIFI Password
 
SimpleTimer timer;
 
int mq6 = A0; // LPG sensor MQ -6 is connected with the analog pin A0 
int data = 0; 
void setup() 
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  timer.setInterval(1000L, getSendData);
}
 
void loop() 
{
  timer.run(); // Initiates SimpleTimer
  Blynk.run();
}
 
void getSendData()
{
data = analogRead(mq6); 
  Blynk.virtualWrite(V2, data); // Blynk INPUT Connect V2 Pin
 
  if (data > 700 )
  {
    Blynk.notify("LPG Detected!"); 
  }
 
}

Credits

Techatronic

Techatronic

72 projects • 127 followers
Electronic engineer

Comments