Hi
I am trying to use the MQ-9 sensor with the arduino uno board for CO measurement. I connected the Vcc of the sensor board with 5V on the arduino board, the Ground with the ground and A0 of the sensor with A0 of the arduino. When I run my code I get -0,10 V as the R0 and an ovf for the sensor Volt. Could this be because I haven't done a "preheating" of the sensor?
My code is the following:
void setup() {
Serial.begin(9600);
}
void loop() {
float sensor_volt;
float RS_air;
float R0;
float sensorValue;
/*--- Get a average data by testing 100 times ---*/
for(int x = 0 ; x < 100 ; x++)
{
sensorValue = sensorValue + analogRead(A0);
}
sensorValue = sensorValue/100.0;
/*-----------------------------------------------*/
sensor_volt = sensorValue/1024*5.0;
RS_air = (5.0-sensor_volt)/sensor_volt; // omit *RL
R0 = RS_air/9.9; // The ratio of RS/R0 is 9.9 in LPG gas
Serial.print("sensor_volt = ");
Serial.print(sensor_volt);
Serial.println("V");
Serial.print("R0 = ");
Serial.println(R0);
delay(1000);
}
Thanks
Ben