From the previous post it is stated: "If 0V is 0ppm and 4V is 2000ppm and the device is linear and you are using the standard 5V analog reference, then:
ppm = (analog_reading * 2000 * 5)/(1024 * 4)"
I have a similar product ( i.e linear output 0 - 4 VDC, 0 ppm - 2,000ppm) , but from the graph attached , it does not measure voltage less than 1 VDC. It is possible to use the above formula?.
From the product manual, the calculation for the concentration is as follow:
Y = U/4FS i.e Y is the concentration (ppm), U is the voltage and FS is the full scale (2,000 ppm). Do I need to replace U with V which have the following formula:
V = (U5)/(10244)and
Y = VFS
Yes you can still use the formula
you better do the voltage (V or U) in milliVolts and use floats as integer division truncates.
Y = U/4*FS
float milliVolts = analogRead(A0) * 4.8828125; // * 5000/1024
int PPM = milliVolts /4 * 2; // 2 iso 2000 => millivolts to volts again.
Thank you for the answer, but I am confused. The answer given as follows:
"Y = U/4FS
float milliVolts = analogRead(A0) * 4.8828125; // * 5000/1024
int PPM = milliVolts /4 * 2; // 2 iso 2000 => millivolts to volts again."
At 2000 ppm , the voltage will be 4V and analogread(A0) will be 1024 , from REFERENCE. Lets substitute analogread(A0) when the ppm is 2000 with 1024
int PPM = ( 10245000/1024)*(2000/4000)
= 2500 ? Confused!
OK lets try again,
If 0V is 0ppm and 4V is 2000ppm
This means 500PPM per volt
If you use an EXTERNAL REFERENCE of 4Volt the formula is
int ppm = analogRead(A0) * 1.955034213
4Volt => 1023 * 1.955034213 => 2000
if you are using an EXTERNAL REFERENCE of 5Volt the formula is
int ppm = analogRead(A0) * 2.44987775
4Volt => 818*2.44987775=> 2000
please give it a try
Couple of physical notes around CO2 sensors.
If your sensor reads 0 ppm, something is wrong! The global average value is about 390 ppm, so you should never see less than approx 0.8 V on a 0~4V output. If you are in a closed office then the value is more likely 1000~1500 ppm, if its above this, get some outside air in and you will work better as its proven that cognitive skills are better below 1500 ppm. This could be as simple as opening a door to the rest of the house/office.
NDIR sensors depend upon an incandescent bulb that flashes, the peak power of this is (should be) monitored by the board and sensor will likely shut down if insufficient power or voltage is available.
Commercial CO2 sensor modules are not super accurate, ±40 ppm + 3% reading are typical, that equated to ±70ppm at 1,000 ppm. More accurate = much higher cost as they have to be pressure and temperature compensated.
Finally - why are you using analogue output when (on our module) there is a digital output?