the value that you are measuring is a function of Vrl: Vrl = sensorValue * 5.0 / 1024.0. Vc is 5.0 volts, if you are connecting the sensor to a regulated power source on the Arduino. Rl is, according to the schematic, 10K.
Now, how that will help you, I don't know. The charts are all log charts, so any ppm reading will involve the log function.
i see.. i try to use the code which is posted by thermike. well i dont know exactly if its correct because i also have difficulty in interpreting the datasheet. what ive done is. every 1.4V cycle i get the value of CO and then display in LCD.im really confused
Don't know if it's of any help to you, but at the refinery I worked at they had hundreds of gas detectors, mostly for safety alarming purposes. CO2, H2S, O2, etc. These were pretty expensive industrial instruments, but the typical calibration procedure was using ambient air for the 'zero' value, and purchased 'calibration gas' bottle/regulators for setting the upper end value of the scale. That is, there was no way to calibrate just using internal voltage values, or constant values, etc, as these kinds of sensors have a finite life and age over time, so accuracy is only as good as the calibration gas you use and how frequently you performed it. We did monthly or quartily depending on the gas type and area safety ratings. The calibration gas bottles were pretty expensive also, plus they had a specified shelf life that when passed their accuracy became 'invalid' and we would have to send them back for refilling even if not empty.
Okay, now the MQ-2 seems to be working fine using the following code:
int sensorValue;
void setup()
{
Serial.begin(9600); // sets the serial port to 9600
}
void loop()
{
sensorValue = analogRead(0); // read analog input pin 0
Serial.println(sensorValue, DEC);
if (sensorValue >= 5) {
Serial.println("Someone let one rip!");
delay(10000);
}
}
Why are you using this thing? What is it that you expect this thing to tell you? Before you can convert the value returned by analogRead to something useful, it is necessary to know what the sensor is measuring, what the output of the sensor is, whether the output is linear or logarithmic, and what you want to do with the output.
You seem to have omitted a few of these details and not enabled us to find any of them.
Since the datasheet expresses the PPM value as a ratio of the resistance of the device of the device in clean air with 100PPM carbon monoxide, it suggests that the PPM value isn't accurately available without calibration with a sample gas of the correct constituants. Which is what Retrolefty said several posts back. There is a value given for clean air which is much easier to obtain but with a much lesser degree of accuracy. It still needs you to calibrate the thing though. If accuracy isn't too much of an issue, the first step would be to wire the thing up and see what its resistance is when its been running a while in clean air. Then when you have this figure you work out a nice value for a static resistor for the other side of the voltage divider for the anticipated ranges you want it to measure. I'd use a lookup table to get a figure out what the PPM is.
A completely unsuitable device to be selling to home users in other words....