CO and H2S sensor measurements take 5 s

New sensors integration, sensor boards usage...
Post Reply
jburgues
Posts: 25
Joined: Tue Jul 23, 2019 10:47 am
Company: IBEC

CO and H2S sensor measurements take 5 s

Post by jburgues » Mon Sep 16, 2019 11:09 am

Hello,

I'm testing the Gases PRO board and I noticed that the CO sensor (SOCKET_5) and H2S sensor (SOCKET_3) take around 5.5s to complete a reading (each one) while two other sensors (NH3 and SO2) connected to Sockets 2 and 6 return the measurement in less than 1 s. Is this normal? Is this related to the sensor itself or the socket it is connected to? Is there any way to reduce this measurement time without sacrificing quality of measurement?

Thanks!
Javier.

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

Re: CO and H2S sensor measurements take 5 s

Post by libelium-dev » Mon Sep 16, 2019 5:02 pm

Hi jburgues,

It should be related to the sensor itself, in any case, could you please share the program you're using to check it's not related to the code?

Regards

jburgues
Posts: 25
Joined: Tue Jul 23, 2019 10:47 am
Company: IBEC

Re: CO and H2S sensor measurements take 5 s

Post by jburgues » Mon Sep 16, 2019 7:48 pm

Hello,

This is the code (I measure the time with a stopwatch based on the prints to the serial port):

Gas CO2_sensor(SOCKET_1);
Gas CO_sensor(SOCKET_5);
Gas NH3_sensor(SOCKET_2);
Gas SO2_sensor(SOCKET_6);
Gas H2S_sensor(SOCKET_3);

float CO2_conc; // Stores the concentration level in ppm
float CO_conc; // Stores the concentration level in ppm
float NH3_conc; // Stores the concentration level in ppm
float SO2_conc; // Stores the concentration level in ppm
float H2S_conc; // Stores the concentration level in ppm

void setup()
{
////////////////////////////////////////////////////////////
// 1. Initialize USB to print data to Serial monitor
////////////////////////////////////////////////////////////
USB.ON();
USB.println(F("Waspmote reading Gases PRO and sending data to XBee Gateway"));

///////////////////////////////////////////
// 2. Turn on gas sensors and wait
///////////////////////////////////////////
USB.println(F("Initialize Gas sensors"));
// Set sensor power to 3.3 V
PWR.setSensorPower(SENS_3V3, SENS_ON);
//Power on gas sensors
CO2_sensor.ON(); < 1 s
CO_sensor.ON(); // This one takes 5.5 s
NH3_sensor.ON(); // < 1 s
SO2_sensor.ON(); // This one takes 5.5 s
H2S_sensor.ON(); // < 1s

USB.println(F("Sleep for 1 minute"));
delay(60000);
USB.println(F("Wake up!!"));
}

void loop()
{
// Read electrochemical and NDIR sensors
USB.println(F("Reading NDIR sensor"));
CO2_conc = CO2_sensor.getConc();
USB.println(F("Reading CO sensor"));
CO_conc = CO_sensor.getConc();
USB.println(F("Reading NH3 sensor"));
NH3_conc = NH3_sensor.getConc();
USB.println(F("Reading SO2 sensor"));
SO2_conc = SO2_sensor.getConc();
USB.println(F("Reading H2S sensor"));
H2S_conc = H2S_sensor.getConc();

///////////////////////////////////////////
// 2. Send data via Xbee
///////////////////////////////////////////
// create new frame
frame.createFrame(ASCII);

// add frame fields
frame.addSensor(SENSOR_GASES_PRO_CO, CO_conc);
frame.addSensor(SENSOR_GASES_PRO_H2S, H2S_conc);
frame.addSensor(SENSOR_GASES_PRO_CO2, CO2_conc);
frame.addSensor(SENSOR_GASES_PRO_NH3, NH3_conc);
frame.addSensor(SENSOR_GASES_PRO_SO2, SO2_conc);

// send XBee packet
USB.println(F("Send Gases PRO frame"));
xbee868.send( RX_ADDRESS, frame.buffer, frame.length );
}

jburgues
Posts: 25
Joined: Tue Jul 23, 2019 10:47 am
Company: IBEC

Re: CO and H2S sensor measurements take 5 s

Post by jburgues » Mon Sep 16, 2019 7:52 pm

Sorry, my comments such as "// This one takes 5.5 s" are in the wrong place. They should be at the side of the calls to CO_sensor.getConc(), etc.

Javier.

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

Re: CO and H2S sensor measurements take 5 s

Post by libelium-dev » Tue Sep 17, 2019 9:02 am

Hi,

Could you please post the output through the serial monitor with debug mode 2 enabled to check if the sensors are detected properly? You can enable it inside WaspSensorGas_Pro.h file

Code: Select all

#define DEBUG_GASES_PRO		2
The sensors have different AFE boards so the time to turn ON or readings could be different.
- NDIR: CO2 sensor
- 3-electrodes: NH3 and H2S sensors
- 4-electrodes: SO2 and CO sensors

Regards

jburgues
Posts: 25
Joined: Tue Jul 23, 2019 10:47 am
Company: IBEC

Re: CO and H2S sensor measurements take 5 s

Post by jburgues » Tue Sep 17, 2019 12:58 pm

You are right. The 4-AFE sensors (CO and SO2) take 5.5s/measurement whereas the 3-AFE sensors (NH3, H2S) are much faster (0.75s/measurement).

Find below the serial output for one sensor (CO) that takes 5s per measurement and one sensor (NH3) that takes 0.75 s/measurement (I added the stopwatch time at relevant points):

Electrochemical gas sensor example
[GASES PRO] ON function
[GASES PRO] Sensor power 3V3 to ON
[GASES PRO] Checksum generated OK
[GASES PRO] ******************************************************
[GASES PRO] SOCKET -> A
[GASES PRO] SERIAL NUMBER: 132870662 059
[GASES PRO] AFE VER: 3
[GASES PRO] SENSOR TYPE: CO-4E
[GASES PRO] SENSITIVITY: 361.500 nA/ppm
[GASES PRO] BASELINE: -19.900 nA
[GASES PRO] O3-NO2 SENSITIVITY: 0.000 nA/ppm
[GASES PRO] AUX BASELINE: 19.500 nA
[GASES PRO] WORK ADJ: 0.000 | 1.0000000000
[GASES PRO] AUXL ADJ: 0.000 | 1.0000000000
[GASES PRO] WORK OFFSET: 0.046
[GASES PRO] AUX OFFSET: 3172.455
[GASES PRO] ZERO STATUS: 3C
[GASES PRO] ******************************************************
[GASES PRO] AFE Configured

Reading sensor!
//// t = 0 s ///
[GASES PRO] SOCKET_4_A
//// t = 0.1 s /// Time at which the previous statement is printed out
[GASES PRO] VOL-WRK: 33.461 mV
[GASES PRO] Iwe: 0.304 uA
//// t = 3 s /// Time at which the previous statements are printed out
[GASES PRO] VOL-AUX: 8.146 mV
[GASES PRO] Iae: 0.074 uA
[GASES PRO] Iwe-Iae: 0.230 uA
[GASES PRO] Sensitivity temperature compensated (ppm): 0.952
[GASES PRO] T-Comp: 0.219 uA
[GASES PRO] Sensitivity: 361.500 nA/ppm
[GASES PRO] Concentration: 0.606 ppm
DONE
//// t = 5.5 s /// Time at which the previous statements are printed out



And here find the serial output of one sensor (NH3) that measures in 0.75s.

Electrochemical gas sensor example
[GASES PRO] ON function
[GASES PRO] Sensor power 3V3 to ON
[GASES PRO] Checksum generated OK
[GASES PRO] ******************************************************
[GASES PRO] SOCKET -> E
[GASES PRO] SERIAL NUMBER: CLEW80001-W8
[GASES PRO] AFE VER: 3
[GASES PRO] SENSOR TYPE: NH3-3E
[GASES PRO] SENSITIVITY: 149.000 nA/ppm
[GASES PRO] BASELINE: 116.000 nA
[GASES PRO] Calibration table
[GASES PRO] 0: 0.0000000000 ; 1.0000000000
[GASES PRO] 1: 0.0000000000 ; 1.0000000000
[GASES PRO] 2: 0.0000000000 ; 1.0000000000
[GASES PRO] 3: 0.0000000000 ; 1.0000000000
[GASES PRO] 4: 0.0000000000 ; 1.0000000000
[GASES PRO] 5: 0.0000000000 ; 1.0000000000
[GASES PRO] 6: 0.0000000000 ; 1.0000000000
[GASES PRO] 7: 0.0000000000 ; 1.0000000000
[GASES PRO] ******************************************************
[GASES PRO] AFE Configured

Reading sensor!
//// t = 0 s ///
[GASES PRO] Vo: 786.922 mV
[GASES PRO] Vref: 1024.000 mV
[GASES PRO] Rgain: 35.000 kOhms
[GASES PRO] Vmeas: -237.078 mV
[GASES PRO] Ie: -6.774 uA
[GASES PRO] Ie-Ibase: -6.890 uA
[GASES PRO] Sensitivity temperature compensated (ppm): 1.000
[GASES PRO] Compensated conc: -6.890 uA
[GASES PRO] concentration: -46.239 ppm
[GASES PRO] Baseline temperature compensation value (ppm): 0.698
[GASES PRO] after baseline temp compensation: -46.937 ppm
[GASES PRO] CONC: 0.000 ppm
DONE
//// t = 0.75 s ///



Isn't there any way to reduce the measurement time of the 4-AFE boards down to 1 s or so??

Thanks for your help,
Javier.

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

Re: CO and H2S sensor measurements take 5 s

Post by libelium-dev » Wed Sep 18, 2019 10:46 am

Hi,

No, it isn't possible to reduce the measurement time of the 4-electrode boards. It's the time needed to communicate with those boards.

Regards

jburgues
Posts: 25
Joined: Tue Jul 23, 2019 10:47 am
Company: IBEC

Re: CO and H2S sensor measurements take 5 s

Post by jburgues » Thu Oct 10, 2019 6:08 pm

Hello again,

In an attemp to reduce the measurement time, I'm looking at the 100-ms delays you introduce after calling to LMP.setModeReg() and digitalWrite(sensor_config.i2c_pin, HIGH); See below. Why do we need this delay? Could it be reduced? What is the minimum value? Is it necessary to call LMP.setModeReg() inside read3ElectrodeSensor() or could I simply call it once at initialization time and remove it from read3ElectrodeSensor()?

float Gas::read3ElectrodeSensor(uint8_t resolution, float temperature)
{
float V_conc = 0;
float conc = 0;
float V_ref = 0;
float R_gain = 0;
int n_samples = 4;

// Select amperometric mode
LMP.setModeReg( LMP91000_MODEC_REG_FET_NOT_SHORTED,
LMP91000_MODEC_REG_PWR_MODE_3_LEAD_AMPEROMETRIC);
delay(100);

...
}

AND

float Gas::getConc(uint8_t resolution, float temperature, float NO2_conc)
{

float conc = 0;

// Before to measure, check if the sensor is properly initializated
if ((pwrGasPRORegister & (1 << sensor_config.socket)) == 0)
{
#if DEBUG_GASES_PRO>0
PRINTLN_GASES_PRO(F("Error,sensor not started"));
#endif
// If not return -1
return -1;
}

disableCommSockets();
delay(10);

// Enable communication with the AFE
digitalWrite(sensor_config.i2c_pin, HIGH);
delay(100);
...
}


Thanks!
Javier.

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

Re: CO and H2S sensor measurements take 5 s

Post by libelium-dev » Fri Oct 11, 2019 9:36 am

Hi,

The pins need time to stabilize their values. You can try to reduce them but it can cause instability. We don't recommend to modify the library.

Regards

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest