MQ-2 Gas sensor , how to get sensor value

void setup() {
  Serial.begin(9600); 
}

void loop() {

 sensorValue = analogRead(A0);  //tried 14 with same results...         
 Serial.print("sensor = " );                       
 Serial.println(sensorValue);     
  delay(10);                     
}

At my serial box i get only 1023.... this is it... If i messure the voltage with voltmeter , it works , it increases volts when it detects gas... from 5.10V it goes to 5.16V

How can i make it work ? thanks !

invader7:

void setup() {

Serial.begin(9600);
}

void loop() {

sensorValue = analogRead(A0);  //tried 14 with same results...         
Serial.print("sensor = " );                       
Serial.println(sensorValue);     
  delay(10);                     
}




At my serial box i get only 1023.... this is it... If i messure the voltage with voltmeter , it works , it increases volts when it detects gas... from 5.10V it goes to 5.16V

How can i make it work ? thanks !

That sounds a little confusing. Any voltage equal to or over 5.000 VDC applied to a analog input pin will return only 1023 counts. Valid DC voltage range for a analog input pin is 0 to 5vdc only. So 5.1V and 5.16V will both return 1023 values. Maybe a link to your sensor will help us help you.

Lefty

Tutorial Arduino Your Home & Environment: Gas Sensor Tutorial
Datasheet http://www.pololu.com/file/0J309/MQ2.pdf
Tutorial http://www.geeetech.com/wiki/index.php/Gas_Sensor_-_MQ-2

What value load resistor are you using with your sensor? Sounds like it's best to use a 20K pot as a load resistor so you can 'calibrate' the sensor such that it's maximum value will be less the 5vdc output that the arduino analog input pin can handle correctly.

Lefty

I used 20k? resistor... im woried about connecting it correct... which way is the correct ?

this Arduino Your Home & Environment: Gas Sensor Tutorial is a littel confusing...

If you can post a drawing on how you specifically wired it up including wiring to the arduino board and any external DC power supply, perhaps we can find a problem.

Lefty

I think your resistor is too high. Try using 2k.
Do you know the basic information ? Arduino Playground - MQGasSensors

I was missing the 20k resistor between "Out" pin and GND , now i get value 730-780 when using analogread and >1000 when sensor is detecting a gas ! thanks guys , my bad....