float sensorValue;
float sensorVolts;
void setup()
{
Serial.begin(9600); // sets the serial port to 9600
delay(20000); // allow the MQ-6 to warm up
}
void loop()
{
for(int i = 0; i < 100; i++){
sensorValue = sensorValue + analogRead(0); // read analog input pin 0
}
sensorValue = sensorValue / 100; // get average reading
sensorVolts = sensorValue/1024*5.0; //convert to voltage
Serial.println(sensorVolts); // prints the value read
delay(100); // wait 100ms for next reading
}
float sensorValue;
float sensorVolts;
void setup()
{
Serial.begin(9600); // sets the serial port to 9600
delay(20000); // allow the MQ-6 to warm up
}
void loop()
{
for(int i = 0; i < 100; i++){
sensorValue = sensorValue + analogRead(0); // read analog input pin 0
}
sensorValue = sensorValue / 100; // get average reading
sensorVolts = sensorValue/1024*5.0; //convert to voltage
if(sensorVolts > 1.4){
Serial.println(“LPG gas detected!”);
}
delay(100); // wait 100ms for next reading
}
1000, 1
10000, 0.7
y = -30000x + 31000
void setup()
{
Serial.begin(9600);
}
void loop()
{
float sensor_volt;
float RS; // Get the value of RS via in a clear air
float R0; // Get the value of R0 via in LPG
float sensorValue;
for(int i = 0 ; i < 100 ; i++)
{
sensorValue = sensorValue + analogRead(A0);
}
sensorValue = sensorValue/100.0; //get average of reading
sensor_volt = sensorValue/1024*5.0;
RS = (5.0-sensor_volt)/sensor_volt; //
R0 = RS/10.0; // 10 is found using interpolation
Serial.print("R0 = ");
Serial.println(R0);
delay(1000);
}
void setup() {
Serial.begin(9600);
}
void loop() {
float sensor_volt;
float RS_gas; // Get value of RS in a GAS
float ratio; // Get ratio RS_GAS/RS_air
float LPG_PPM;
int sensorValue = analogRead(A0);
sensor_volt=(float)sensorValue/1024*5.0;
RS_gas = (5.0-sensor_volt)/sensor_volt; // omit *RL /*-Replace the name "R0" with the value of R0 in the demo of First Test -*/
ratio = RS_gas/R0; // ratio = RS/R0
LPG_PPM = -30000*ratio + 31000 //LPG PPM
Serial.print("LPG PPM = ");
Serial.println(LPG_PPM);
Serial.print("\n\n");
delay(1000);
}