Go Down

### Topic: How can I convert AnalogRead to something useful? (Read 31456 times)previous topic - next topic

#30
##### Jan 24, 2013, 04:10 am

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
General Arduion tutorials = http://tronixstuff.wordpress.com
http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=123

#### bedinsky

#31
##### Feb 02, 2013, 05:48 pm
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

#### tungaw14

#32
##### Jan 27, 2014, 02:04 pm
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

#### UKHeliBob

#33
##### Jan 27, 2014, 02:25 pm
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.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

#### AWOL

#34
##### Jan 27, 2014, 02:31 pm
Code: [Select]
`ppm = 37143 * pow (ratio, -3.178);`
I suppose you should be grateful for automatic type promotion, or 37143 could fail spectacularly.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

#### PaulS

#35
##### Jan 27, 2014, 02:44 pm
Quote
where does this 37143 and -3.178 came from plss help

They came from your post. My crystal ball can't seem to tell where you got them. Made them up is my guess.

#### tungaw14

#36
##### Jan 28, 2014, 11:51 am
@ Sir Thermike I am new to this forum. I just want only to know the formula on how did you came up the value of Y and X which is 37143 and -3.178 respectively! on your code which is :

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

Thanks!

Go Up