Go Down

### Topic: INTERFACING NDIR CO2 MODULE WITH ARDUINO (Read 7269 times)previous topic - next topic

#15

#### vmandin

#16
##### Dec 05, 2012, 02:28 pm
Thank U Riva & DC42

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

like this one,

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?

#### mohdrais

#17
##### Oct 10, 2013, 08:53 am
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.

#### robtillaart

#18
##### Oct 10, 2013, 04:04 pm
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) [Select]
`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.
Rob Tillaart

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

Go Up

Please enter a valid email to subscribe