How can I convert AnalogRead to something useful?

What do you mean by convert it to digital?

i mean converting it to ppm values..

I don't know. I imagine the datasheet for your sensor will have that information.

i see.. thank you sir. i already have a code. but still im not that confident about the about.

vhenamae:
i see.. thank you sir. i already have a code. but still im not that confident about the about.

Why do you want to convert to PPM?

What sensor are you using?

im using MQ-7 sir.. and im very confused with its datasheet..

im using MQ-7 sir

A link would be far more useful.

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.

I assume it's this: Carbon Monoxide Sensor - MQ-7 - SEN-09403 - SparkFun Electronics

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

wildbill:
I assume it's this: Carbon Monoxide Sensor - MQ-7 - SEN-09403 - SparkFun Electronics

yes sir.. im using that one.

hi all,

how should I do the preheating? does it need to be 24+ hours continously, or can I do it in 2 or 3 passes (so 2x12 or 3x8 hours)?

Hi everybody,
I'm a newbie of arduino and I'm playing with air quality sensors.
I want to purchase this MQ-135 sensor
http://www.ebay.com/itm/170969528013

There are 4 pins (S,Vcc,TTL, G)
There is a LM393 chip on pbc

Description says that there are 2 outputs:
analog output, and TTL-level output
I do not fully understand what is the usage of TTL-level output:
TTL output valid signal is low (low output signal light, which can be accessed microcontroller IO port)

what will be read from an arduino digital pin connected to TTL?

let me know where I can found a sketch that explains usage of TTL pin

regards

A little google goes a long way.

http://itp.nyu.edu/~sl2631/blog/?p=576

This is the most concise reference for air quality sensors
http://www.staceyk.org/airSensors/sensorsetup.php

I'm already reading from MQ-135. I want to buy another one which is mounted on a little pcb with a LM393.
There is an extra pin that they said it can be used for digital read from a microprocessor.
LM393 is low power dual voltage comparator.
I would like to know if anyone is using that kind a sensor.

You can find other sensor of mq type mounted on small pcb (with a variable resistor to change load resistance) but they have only 3 pin to read analog value like this one
http://itp.nyu.edu/physcomp/sensors/Reports/MQ135

I can't help you anymore with the information available. Here is one more link that may help. http://www.thaieasyelec.com/Review-Product-Article/Gas-Sensor-Getting-Started.html

Thank you for that link. It is very usefull for doing calibration of MQ sensors.
I would never find it since it is written in thai

anyone pls help i cant understand this line of codes

// get CO ppm
float get_CO (float ratio){
float ppm = 0.0;
ppm = 37143 * pow (ratio, -3.178);
return ppm;

where does this 37143 and -3.178 came from plss help

When constants like these are included in a program without explanation they are often referred to as 'magic numbers'. They may have come from a data sheet, someone elses program or a smaller program written to discover the values, but who knows ?

If such constants are used they are better as variables with meaningful names and comments to explain their origin.

ppm = 37143 * pow (ratio, -3.178);

I suppose you should be grateful for automatic type promotion, or 37143 could fail spectacularly.