Lpg detection using mq2 gas sensor







Materials required
1.arduino uno
2.breadboard
3.male to female jumper wire
4. Male to male jumper wire
5.16x2 LCD display
6. Potentiometer
7.mq2 gas sensor

Circuit
Lcd vss-gnd
Lcd vcc-5v
Lcd vee/vo-potensiometer
Lcd rs-Arduino pin 12
Lcd r/w-gnd
Lcd enable-Arduino pin 11
Lcd dB4-Arduino pin 5
Lcd dB5-Arduino pin 4
Lcd dB6-Arduino pin 3
Lcd dB7-Arduino pin 2
Lcd led+-5v
Lcd led-_gnd

Code
#include <MQ2.h>
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
//change this with the pin that you use
int pin = A0;
int lpg, co, smoke;
MQ2 mq2(pin);
void setup(){
Serial.begin(9600);
lcd.begin(16, 2);
// Print a message to the LCD.
mq2.begin();
}
void loop(){
float* values= mq2.read(true); //set it false if you don't want to print the values in the Serial
lcd.setCursor(0, 1);
//lpg = values[0];
lpg = mq2.readLPG();
lcd.print("LPG:");
lcd.print(lpg);
delay(2000);
lcd.clear();
}



Comments

  1. Urban Titanium Art: An Overview of the World's Top Techno-Techno-Techno
    Urban titanium art is a titanium strength technique titanium guitar chords used to titanium hair trimmer create art for the production of a new concept tungsten titanium art for the titanium for sale production of art.

    ReplyDelete

Post a Comment