Go Down

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


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


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.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.


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.


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.
The art of getting good answers lies in asking good questions.


@ 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;//


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131