Pages: 1 2 [3]   Go Down
Author Topic: How can I convert AnalogRead to something useful?  (Read 11106 times)
0 Members and 1 Guest are viewing this topic.
Greenville, IL
Offline Offline
Edison Member
*
Karma: 15
Posts: 1330
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


 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
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 116
Posts: 4322
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26482
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
ppm = 37143 * pow (ratio, -3.178);
I suppose you should be grateful for automatic type promotion, or 37143 could fail spectacularly.
Logged

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

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 631
Posts: 50157
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@ 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!
Logged

Pages: 1 2 [3]   Go Up
Jump to: