Go Down

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

cyclegadget


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
Good links: Eagle tutorial= http://www.youtube.com/playlist?list=PLDE1858BD83D19C70
General Arduion tutorials = http://tronixstuff.wordpress.com
http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=123

bedinsky

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

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

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

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.

PaulS

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

@ 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