to replace the R0 below with value of R0 tested above
void
setup() {
Serial.begin(9600);
}
void
loop() {
float
sensor_volt;
float
RS_gas;
float
ratio;
// Get ratio RS_GAS/RS_air
int
sensorValue
sensor_volt=(float)sensorValue/1024*5.0;
RS_gas
= (5.0-sensor_volt)/sensor_volt;
/*-Replace the name "R0" with the value of R0 in the demo of First
Test -*/
ratio
= RS_gas/R0;
/*-------------------------------------------------------------------
----*/
Serial.print("sensor_volt =
Serial.println(sensor_volt);
Serial.print("RS_ratio =
Serial.println(RS_gas);
Serial.print("Rs/R0 =
Serial.println(ratio);
Serial.print("\n\n");
delay(1000);
}
Now, we can get the concentration of gas from the below figure
// Get value of RS in a GAS
= analogRead(A0);
// ratio = RS/R0
");
");
");
// omit *RL
8
Need help?
Do you have a question about the Grove and is the answer not in the manual?
Questions and answers