Go Down

Topic: MQ-2 Gas sensor , how to get sensor value (Read 1 time) previous topic - next topic

invader7

Code: [Select]


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 !

retrolefty


Code: [Select]


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


retrolefty

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


invader7

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

this http://arduinotronics.blogspot.gr/2012/03/gas-sensor-tutorial.html is a littel confusing...

retrolefty

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

Krodal

I think your resistor is too high. Try using 2k.
Do you know the basic information ? http://playground.arduino.cc/Main/MQGasSensors

invader7

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....

Go Up