Pages: 1 [2]   Go Down
Author Topic: INTERFACING NDIR CO2 MODULE WITH ARDUINO  (Read 4076 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for your feedback.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
The LORD is my strength and my shield.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank U Riva & DC42

what if I would just map the values? Pls inspect my assumption.

like this one,

 int sensorValue = analogRead(A0);
 int partspermillion = map(sensorValue, 205, 818, 0, 2000);

a support from telaire told me that 1V=205bits and 4V=818bits
since the sensors sensitivity is from 0-2000ppm

can this method be accurate?
Logged

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

I have a NDIR with voltage output of 0.8 - 4 VDC and the CO2 measurement is from 0 - 2000 ppm. From previous posting, the voltage output range is quite good, that is from 0 - 4 DC,1-5 DC and not fraction as above etc. Then there is a function map(). Which is better to use function map() or to calculate. Thank you in advance for any advice.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Then there is a function map(). Which is better to use function map() or to calculate. Thank you in advance for any advice.
0.8V = 163,68  (1..1023@5V)
4.0V = 818,4
map() is integer math, so the formula will look like:   ppm = map(analogRead(A0), 164, 818, 0, 2000);
you see at least 2 (small) roundings. Furthermore you have only about 654 steps (steps of 3)
Even if youaverage multiple readings this will stand.

If you calculate you can get more accurate number when you calculate the PPM as float.

in the snippet below you can compare the two methods:
Code: (example)
void loop()
{
  float value = (analogRead(A0) * 3.0  + previous) / 4.0;    // apply low pass filter - weighted average of new reading and prev reading
  float ppmF= (value -163.68) * 2000 / (818.4 -163.68);    // can be optimized to PPM = (value -163.68) * 3.05474096;

  int ppmI = map(value, 164, 818, 0, 2000);

  Serial.print("PPM int: ");
  Serial.println(ppmI, DEC);

  Serial.print("PPM float: ");
  Serial.println(ppmF, 1);  // 1 decimal place

  delay(1000);
}
 
you might need to check the math, and you must be sure that the Arduino gets 5.00V
as when it gets e.g. 4.95 or 5.05 the readings will be affected of course.

 give it a try.
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Pages: 1 [2]   Go Up
Jump to: