CO2 gas sensor problem

mogul
Posts: 19
Joined: Mon Nov 07, 2016 12:28 pm

CO2 gas sensor problem

Post by mogul » Mon Nov 14, 2016 2:44 pm

Trying to get readings from the calibrated CO2 sensor on a Smart Environmental PRO.

CO2 sensor (9372-P) connected to socket A and temp/hum/pres (9370-p) on socket E

Often I get obviously wrong reading from temp/hum/pres sensor, which affects the compensations of the CO2 readings.

Code is boiled down to a minimum:

Code: Select all

#include <WaspSensorGas_Pro.h>

/*
 * P&S! Possibilities for this sensor:
 * 	- SOCKET_A (4)
 * 	- SOCKET_B (5)
 * 	- SOCKET_C (1)
 * 	- SOCKET_F (3)
 */
Gas sens(SOCKET_A);

float concentration;
float temperature;
float humidity;
float pressure;


void setup() {
  sens.ON();
  USB.println(F("Ready"));
}	



void loop() {
  concentration = sens.getConc();
  temperature = sens.getTemp(1);
  humidity = sens.getHumidity();
  pressure = sens.getPressure();

  USB.print(F("Gas concentration: "));
  USB.print(concentration);
  USB.println(F(" ppm"));
  
  USB.print(F("Temperature: "));
  USB.print(temperature);
  USB.println(F("C"));
  
  USB.print(F("Relative humidity: "));
  USB.print(humidity);
  USB.println(F("%"));
  
  USB.print(F("Pressure: "));
  USB.print(pressure);
  USB.println(F(" Pa"));
  USB.println("");
  
  delay(15000);
}
and after a few iterations sample readings looks like these:

Code: Select all

GP.Reading NDIR sensor; t: 1078923
GP.Measure 1/4 from ADC: 682.4375000000 mV
GP.Measure 2/4 from ADC: 682.4375000000 mV
GP.Measure 3/4 from ADC: 683.0625000000 mV
GP.Measure 4/4 from ADC: 682.3750000000 mV
GP.V_conc: 682.5781250000 mV
GP.m_conc: 3.1250000000 mV/ppm || baseline: 400.0000000000 mV
GP.Reading BME280
Gas concentration: 904.8782348632 ppm
Temperature: 0.0000000000C
Relative humidity: 0.0000000000%
Pressure: 0.0000000000 Pa
or

Code: Select all

GP.Reading NDIR sensor; t: 62660
GP.Measure 1/4 from ADC: 706.5000000000 mV
GP.Measure 2/4 from ADC: 706.4375000000 mV
GP.Measure 3/4 from ADC: 706.4375000000 mV
GP.Measure 4/4 from ADC: 706.4375000000 mV
GP.V_conc: 706.4531250000 mV
GP.m_conc: 3.1250000000 mV/ppm || baseline: 400.0000000000 mV
GP.Reading BME280
Gas concentration: 980.1374511718 ppm
Temperature: -185.0000000000C
Relative humidity: 0.0000000000%
Pressure: 16668927.0000000000 Pa

mogul
Posts: 19
Joined: Mon Nov 07, 2016 12:28 pm

Re: CO2 gas sensor problem

Post by mogul » Mon Nov 14, 2016 3:03 pm

Ah yes, I should have mentioned I'm using IDE version: waspmote-pro-ide-v04-linux64

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: CO2 gas sensor problem

Post by libelium-dev » Mon Nov 14, 2016 5:21 pm

Hi,

Could you test the BME sensor (temp/hum/pres sensor) with the following code? Only connect the BME sensor to the P&S.

Code: Select all

#include "BME280.h"

float temp;
float pressure;
float humidity;

long time_temp, time_press, time_hum;


void setup() {
  // put your setup code here, to run once:
  pinMode(ANA0, OUTPUT);

    digitalWrite(ANA0, HIGH);
  PWR.setSensorPower(SENS_3V3, SENS_ON);
  
  BME.ON();
  
}


void loop() {
  // put your main code here, to run repeatedly:
  temp = BME.getTemperature(BME280_OVERSAMP_16X, 0);

  pressure = BME.getPressure(BME280_OVERSAMP_16X, 0);

  humidity = BME.getHumidity(BME280_OVERSAMP_16X);

  USB.print(temp);
  USB.println(F(" C\t"));
  USB.print(pressure);
  USB.println(F(" Pa\t"));
  USB.print(humidity);
  USB.println(F(" %RH\t\t"));	

  delay(5000);
  USB.println();

}

mogul
Posts: 19
Joined: Mon Nov 07, 2016 12:28 pm

Re: CO2 gas sensor problem

Post by mogul » Tue Nov 15, 2016 8:05 am

Sure. With your code and only the BME connected it gave expected results:

Code: Select all

E#
22.0400009155 C	
101272.6718750000 Pa	
30.6601562500 %RH		

22.0499992370 C	
101275.3437500000 Pa	
30.6708984375 %RH	
However, with the first test run of your code I forgot to unplug the CO2 sensor and then I got

Code: Select all

E#
0.0000000000 C	
-1000.0000000000 Pa	
-1000.0000000000 %RH		

-1000.0000000000 C	
-1000.0000000000 Pa	
-1000.0000000000 %RH	
which is similar to what I saw with my own code, temp/hum/pres is good if I "forget " to plug in the CO2

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: CO2 gas sensor problem

Post by libelium-dev » Tue Nov 15, 2016 9:50 am

Hi,

It is normal that you get wrong values if you connect sensors that aren't declared in the code.

Do you only connect the CO2 and the BME sensors when you run your code?

Also check the battery level.

Regards.

mogul
Posts: 19
Joined: Mon Nov 07, 2016 12:28 pm

Re: CO2 gas sensor problem

Post by mogul » Tue Nov 15, 2016 10:52 am

Yes. Only CO2 sensor in socket-A and BME in socket-E.

Battery level, measured with "PWR_4 example" to "Battery Level: 88 % | Battery (Volts): 4.1032257080 V" - should be good.

Experimented with other gas sensors in socket-A: (only gave them about a minute to warm up, so the actual gas readings might be wrong, but for getting some numbers it should be useful)

CO

Code: Select all

Gas concentration: 6.9065785408 ppm
Temperature: 23.9400005340C
Relative humidity: 31.3652343750%
Pressure: 101163.9765625000 Pa
O3

Code: Select all

Gas concentration: 12.2618360519 ppm
Temperature: 23.9300003051C
Relative humidity: 31.1455078125%
Pressure: 101154.2890625000 Pa
NO2

Code: Select all

Gas concentration: 0.0000000000 ppm
Temperature: 23.8799991607C
Relative humidity: 30.8886718750%
Pressure: 101143.4062500000 Pa
Notice NO2 reading is zero, dunno if that is to be expected in a suburb to Copenhagen

And then for completion, the CO2 sensor again where everything go haywire:
CO2

Code: Select all

Gas concentration: 20.9756851196 ppm
Temperature: 0.2599999904C
Relative humidity: 0.0000000000%
Pressure: 58340.9375000000 Pa

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: CO2 gas sensor problem

Post by libelium-dev » Tue Nov 15, 2016 3:15 pm

Hi,

Could you try to read the CO2 sensor in other socket? Do you get the same error?

Regards

mogul
Posts: 19
Joined: Mon Nov 07, 2016 12:28 pm

Re: CO2 gas sensor problem

Post by mogul » Wed Nov 16, 2016 11:10 am

Bingo. Tried the CO2 sensor in SOCKET-B, C and F. all works a charm.

Now I have NO2, O3, C0 and CO2 in Socket A,B,C and F. getting values from all 4 and the BME reads good too.

Is this, "don't put CO2 in socketA" a documented behavior? where could I have read about it?

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: CO2 gas sensor problem

Post by libelium-dev » Wed Nov 16, 2016 12:31 pm

Hi,

What IDE and API are you using? Do you have P&S v12?

CO2 gas sensor should work on socket A. We are going to do some tests to detect where is the problem.

Regards

mogul
Posts: 19
Joined: Mon Nov 07, 2016 12:28 pm

Re: CO2 gas sensor problem

Post by mogul » Wed Nov 16, 2016 1:28 pm

I use what ever API came with the waspmote-pro-ide-v04-linux64 package. In the packed file revisions.txt I found

Code: Select all

***********************************
***         IDE v04             ***
***********************************
--> Released 12th December 2013
--> New IDE only compiles with API v005 and so on.
--> New toolchain for IDE:
        > avr-gcc 4.7.2 compiler
        > avr-libc 1.8.0
Yes, we are on P&S v12

Also perhaps of interest to understanding this problem I have learned that the NO2 sensor constantly read 0.00 when in SOCKET-A and B, but seems to give meaningful reading in SOCKET-C

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest