CO2 probe stops to sense

Post Reply
danielcapelo
Posts: 5
Joined: Thu Nov 08, 2018 4:39 pm
Company: Data Lights

CO2 probe stops to sense

Post by danielcapelo » Tue Dec 04, 2018 10:43 pm

Greetings support,

I am developing an application for sense with a 9370-p, a 9325-p and a 9372-p. The Plug and Sense connects with the net and transmit the measures to the system and apparently everything is ok. the problem is that after some hours of sensing the CO2 measures falls to cero and it takes several minutes or even a couples of hours to restore to the normal working.

Some details. in order to guarantee the reconection, the applications follows the next logics in the main loop:

1. Conection with the network ESSID.
2. Turn on the sensors.
3. Get the measures.
4. Transmit the data.
5. Turn off the sensors (except the CO2 probe, because it needs 1 minute of warm-up time).
6. Unconect to the network.

The loop is repited every 16 seconds approximatelly. I am ussing a Smart Cities with the three probes.

Please, I need some ideas for solving the issue, any suggestion is wellcome!!

Regards,
Daniel Capelo

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

Re: CO2 probe stops to sense

Post by libelium-dev » Wed Dec 05, 2018 1:25 pm

Hi Daniel,

The CO2 sensor returns 0ppm when it isn't warm. We think that 1 minute isn't enough to warm the sensor, please try to increase the warp up time to 2-3 minutes. Or you can also try to not turn the sensor OFF.

Let us know if it solves the issue.
Regards

danielcapelo
Posts: 5
Joined: Thu Nov 08, 2018 4:39 pm
Company: Data Lights

Re: CO2 probe stops to sense

Post by danielcapelo » Wed Dec 05, 2018 3:17 pm

Thanks for your answer,

Actually it keep turned on since the first time, I will include the code, maybe you can check it out. By the way sorry for the comments in spanish.

/*
------ CONEXION WIFI PARA CLIENTE TCP --------
DATA LIGHTS COMPAÑIA LIMITADA
DEPARTAMENTO DE AUTOMATIZACION E INSTRUMENTACION
PROYECTO: VIVIENDA SOCIAL
CLIENTE: INER
INGENIERO DE APLICACIONES: DANIEL CAPELO
FECHA: 8/11/2018

FUNCIONES DE LA APLICACION:
CONEXION WIFI (CAPA FISICA)
DIRECCION IP ESTATICA
SUSCRIPCION A ESSID (RED + PASSWORD)
CLIENTE TCP (ENVIO Y RECEPCION DE INFORMACION)
LECTURA DE SENSORES, EN ESTA VERSION SE INCLUYE EL SENSOR DE CO2
PROCESAMIENTO DE INFORMACION Y CONSTRUCCION DE LA TRAMA DE DATOS
TX DE TRAMA
esta revision se crea a partir de que la aplicacion pierde la conexion TCP
temporalmente (peor caso 29 minutos), se plantea la adicion de resets adicionales
y demoras. ademas el apagado del sensor de c02 temporalmente

COMENTARIOS:
El programa se conecta en a un Access Point (AP) con una direccion IP estatica
y con una clave (en la declaracion de constantes) con seguridad WPA2.
Para la verificacion del funcionamiento se usa una modificacion del VI
Simple TCP server encontrado en los ejemplos de LabView.

En la presente version se arma la trama de comunicación para la transmisión
de las mediciones de los sensores. En esta version se incluyen las tres lecturas
del sensor 9370-P (temperatura, humedad relativa y presion atmosferica),
el sensor de luz y el de CO2.

De presentarse codigos de error durante la ejecucion del programa, dirigirse a la
libreria del modulo que genera el error y verificar el codigo, para ello
hace falta usar un editor que soporte cpp, por ejemplo sublime text.

NOTA!!!! SEGUN SE PRUEBE HACIA UNA PC O UN CRIO SE DEBE CAMBIAR LA DIRECCION DEL HOST

*/
////////////////////////////
// DECLARACION DE LIBRERIAS
#include <WaspWIFI_PRO.h>
//#include <WaspFrame.h>
#include <WaspSensorCities_PRO.h>

//////////////////////////////////////////
// DECLARACION DE HARDWARE (PUERTOS A USAR)
uint8_t socket = SOCKET0; //PUERTO DE COMUNICACION WIFI
bmeCitiesSensor bme(SOCKET_A); //PUERTO PARA t, h y p
luxesCitiesSensor luxes(SOCKET_E); //PUERTO PARA LUXOMETRO
Gas gas_sensor(SOCKET_F); //PUERTO PARA SENSOR DE CO2
////////////////////////////////////////////////////////
// DECLARACION DE CONSTANTES PARA ACCESO AL ACCESS POINT
char ESSID[] = "Datalights_Capacitacion"; //cambiar para ejecutar en la casa con la red local
char PASSW[] = "viviendasocial";
/////////////////////////////////////////////////////////////////////////////
// DECLARACION DE CONSTANTES PARA ACCEDER A LA RED CON UNA DIRECCION ESTATICA
//////////////////////////////////////
char STATIC_IP[] = "192.168.0.102";
char GATEWAY[] = "192.168.0.1";
char NETMASK[] = "255.255.128.0";
///////////////////////////////////////////////////////
// DECLARACION DE CONSTANTES PARA ACCEDER AL TCP SERVER
///////////////////////////////////////
char HOST[] = "192.168.0.100";
char REMOTE_PORT[] = "3000";
char LOCAL_PORT[] = "2000";
///////////////////////////////////////////////////////
//DEFINICION DE VARIABLES PARA MANEJO DE COMUNICACIONES
////////////////////////////////////////
uint8_t error;
uint8_t status;
unsigned long previous;
uint16_t socket_handle = 0;
///////////////////////////////////////
//DECLARACION DE VARIABLES PARA MANEJO DE SENSORES
/////////////////////////////////////////
float temperature;
float humidity;
float pressure;
uint32_t luminosity;
float concentration;
//////////////////////////////////////////
//ESTABLECIMIENTO DE CONDICIONES INICIALES
//////////////////////////////////////////
void setup()
{
USB.println(F("Iniciando Programa"));
gas_sensor.ON();
// After 2 minutes, Waspmote wakes up thanks to the RTC Alarm
//PWR.deepSleep("00:00:00:34", RTC_OFFSET, RTC_ALM1_MODE1, ALL_ON);
}
////////////////////////////////////////////
//LAZO PRINCIPAL A REPETIRSE INDEFINIDAMENTE
////////////////////////////////////////////
void loop()
{
//////////////////////////////////////////////////
// 1. RUTINA DE ENCENDIDO DE MODULO WIFI
//////////////////////////////////////////////////
error = WIFI_PRO.ON(socket);
if ( error == 0 )
{
//USB.println(F("1. WiFi encendio correctamente"));
}
else
{
USB.println(F("1. El WiFi no inicio correctamente"));
WIFI_PRO.printErrorCode();
}
//////////////////////////////////////////////////
//2. OBTENIENDO UNA DIRECCION ESTATICA
////////////////////////////////////////////////
error = WIFI_PRO.setIP(STATIC_IP);
//USB.println("2. Estableciendo direccion IP fija");
if (error == 0)
{
//USB.println("2.1. Direccion IP Estatica establecida");
}
else
{
USB.println("2.1. Error estableciendo direccion Estatica");
WIFI_PRO.printErrorCode();
}
error = WIFI_PRO.setGateway(GATEWAY);
if (error == 0)
{
//USB.println("2.2. Gateway establecido");
}
else
{
USB.println("2.2. Error estableciendo el Gateway");
WIFI_PRO.printErrorCode();
}
error = WIFI_PRO.setNetmask(NETMASK);
if (error == 0)
{
//USB.println("2.3. Mascara de Subred establecida");
}
else
{
USB.println("2.3. Error estableciendo Mascara de Subred" );
}
///////////////////////////////////////////////////
//3. SUSCRIBIENDOSE A ESSID
////////////////////////////////////////////////
error = WIFI_PRO.setESSID(ESSID);
if (error == 0)
{
//USB.println("3. Dispositivo conectado a ESSID");
}
else
{
USB.println("3. Error de conexion a ESSID");
WIFI_PRO.printErrorCode();
}
////////////////////////////////////////////////
//4. VALIDANDO PASSWORD
////////////////////////////////////////////////
error = WIFI_PRO.setPassword(WPA2, PASSW);
if (error == 0)
{
//USB.println("4. Codigo aceptado por Access Point");
}
else
{
USB.println("4. Error de validacion en el Acces Point");
WIFI_PRO.printErrorCode();
}
////////////////////////////////////////////////
// 5. EJECUCION DE RESET POR SOFTWARE
/////////////////////////////////////////////////
error = WIFI_PRO.softReset();
delay(30);
if (error == 0)
{
USB.println("5. Reset por software Correcto");
}
else
{
USB.println("5. Error en reset por software");
WIFI_PRO.printErrorCode();
}
//////////////////////////////////////////////////
// 6. VERIFICAR CONEXION
//////////////////////////////////////////////////
status = WIFI_PRO.isConnected();
USB.println("6. Enlazando WIFI");
// check if module is connected
if ( status == true )
{
//USB.println("6.1. Enlace Wifi Correcto");
}
else
{
USB.println("6.1. Error en enlace WiFi");
}

//////////////////////////////////////////////////
// 7. COMUNICACION TCP
//////////////////////////////////////////////////
// Checando si el modulo esstá conectado
if (status == true)
{
////////////////////////////////////////////////
// 7.1. ABRIR UN TCP socket (HANDSHAKE)
////////////////////////////////////////////////
error = WIFI_PRO.setTCPclient( HOST, REMOTE_PORT, LOCAL_PORT);
if (error == 0)
{
USB.println(F("7.1. TCP socket Abierto: "));
}
else
{
USB.println(F("7.1. Error llamando a la funcion 'setTCPclient'"));
WIFI_PRO.printErrorCode();
status = false;
}
if (status == true)
{
///////////////////////////////////////////////
//7.2. ENCENDIDO, ADQUISICION Y APAGADO DE LOS SENSORES
//////////////////////////////////////////////
//gas_sensor.OFF();
bme.ON();
luxes.ON();

temperature = bme.getTemperature();
humidity = bme.getHumidity();
pressure = bme.getPressure();
luminosity = luxes.getLuminosity();

bme.OFF();
luxes.OFF();

//gas_sensor.ON();
// After 2 minutes, Waspmote wakes up thanks to the RTC Alarm
//PWR.deepSleep("00:00:02:00", RTC_OFFSET, RTC_ALM1_MODE1, ALL_ON);
concentration = gas_sensor.getConc(temperature);
//gas_sensor.OFF();

///////////////////////////////////////////////
//PROCESAMIENTO DE LA INFORMACION PARA CONSTRUIR LA TRAMA
/////////////////////////////////////////////////
char Trama[100]; //CADENA DE CARACTERES QUE CONTENDRÁ EL MENSAJE A TRANSMITIR
char Temp[8]; //VARIABLE USADA PARA TEMPERATURA (STRING)
char Hum[9]; //VARIABLE USADA PARA HUMEDAD RELATIVA (STRING)
char Pres[7]; //VARIABLE USADA PARA PRESION ATMOSFERICA (STRING)
char Lum[6]; //VARIABLE USADA PARA LUZ (STRING)
char CO2[8];
Utils.float2String(temperature, Temp, 2); //CONVERSION DE DATO FLOTANTE A STRING
Utils.float2String(humidity, Hum, 3);
Utils.float2String(pressure, Pres, 2);
Utils.float2String(concentration, CO2, 3);
// CONVERSIOND DE DATO DE ENTERO DE 32 BITS A CADENA DE CARACTERES
Utils.long2array(luminosity, Lum);
//CONCATENACION DE STRING PARA FORMAR EL MENSAJE A TRANSMITIR
snprintf(Trama, sizeof(Trama), "T= %s H= %s P= %s L= %s C= %s", Temp, Hum, Pres, Lum, CO2);
USB.println(Trama);
////////////////////////////////////////////////
// 7.4. ENVIANDO INFORMACION
////////////////////////////////////////////////
error = WIFI_PRO.send(socket_handle, Trama);
// check response
if (error == 0)
{
//USB.println("7.2. Mensaje enviado correctamente");
}
else
{
USB.println("7.2. Error de envio de datos");
WIFI_PRO.printErrorCode();
}
////////////////////////////////////////////////
// 7.4. CIERRA LA COMUNICACION TCP
////////////////////////////////////////////////
error = WIFI_PRO.closeSocket(socket_handle);

// check response
if (error == 0)
{
//USB.println(F("7.4. Socket cerrado"));
}
else
{
USB.println(F("7.4. Error cerrando el socket"));
WIFI_PRO.printErrorCode();
}
}
}
//////////////////////////////////////////////////
// APAGANDO TODO
//////////////////////////////////////////////////
//USB.println(F("WiFi APAGADO\n\n"));

WIFI_PRO.OFF(socket);
delay(100);
}

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

Re: CO2 probe stops to sense

Post by libelium-dev » Mon Dec 10, 2018 2:14 pm

Hi,

Apologies for our delay answering, Libelium facilities was closed due to national festivities.

Could you please share the output through the serial monitor with debug mode 2 enabled for gases sensor? You can enable it inside WaspSensorGas_Pro.h file. Please post the output after few hours working,

Code: Select all

#define DEBUG_GASES_PRO		2
On the other hand, please turn OFF/ON the gases sensors when the bme and lux sensors are reading to avoid issues in the I2C bus.

Code: Select all

gas_sensor.OFF();
bme.ON();
luxes.ON();

temperature = bme.getTemperature();
humidity = bme.getHumidity();
pressure = bme.getPressure();
luminosity = luxes.getLuminosity();

bme.OFF();
luxes.OFF();

gas_sensor.ON();
Regards

danielcapelo
Posts: 5
Joined: Thu Nov 08, 2018 4:39 pm
Company: Data Lights

Re: CO2 probe stops to sense

Post by danielcapelo » Wed Dec 12, 2018 4:12 pm

Thanks for your recommendations,

Regarding the debug mode, I modified the library and I can notice that the failure takes longer time to appears, any way the result on the serial monitor is as follows:

Code: Select all

[GASES PRO] Average measure: 201.875 mV
[GASES PRO] AFE compensation: 0.000 mV
[GASES PRO] Measure baseline compensated: -197.744 mV
[GASES PRO] Compensated measure: -617.948 %
T= 18.72 H= 57.496 P= 75393.6114 L= 114 C= 0.000
5. Reset por software Correcto
6. Enlazando WIFI
7.1. TCP socket Abierto: 
[GASES PRO] Average measure: 201.828 mV
[GASES PRO] AFE compensation: 0.000 mV
[GASES PRO] Measure baseline compensated: -197.789 mV
[GASES PRO] Compensated measure: -618.089 %
T= 18.72 H= 57.475 P= 75396.9114 L= 114 C= 0.000
5. Reset por software Correcto
6. Enlazando WIFI
7.1. TCP socket Abierto: 
[GASES PRO] Average measure: 201.688 mV
[GASES PRO] AFE compensation: 0.000 mV
[GASES PRO] Measure baseline compensated: -197.924 mV
[GASES PRO] Compensated measure: -618.511 %
T= 18.73 H= 57.876 P= 75399.5114 L= 114 C= 0.000
5. Reset por software Correcto
6. Enlazando WIFI
7.1. TCP socket Abierto: 

And so on, regarding to extend the OFF tiem or alternate the ON/OFF with the reading with other sensors is not possible because I need measures each minute. If you have some idea from this results please share them with me.

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

Re: CO2 probe stops to sense

Post by libelium-dev » Thu Dec 13, 2018 10:13 am

Hi,

What API version did you use to upload the code to the node?

What is the battery level of the node? Could you include the readings of the battery in the code to check if the CO2 returns 0 since the battery level is low.

Regards

danielcapelo
Posts: 5
Joined: Thu Nov 08, 2018 4:39 pm
Company: Data Lights

Re: CO2 probe stops to sense

Post by danielcapelo » Fri Dec 14, 2018 12:18 am

Hi,

The version of IDE is v06.08 and the API is v034. I already add the message with battery information, but the problem is that when the node is connected to a USB port (PC) the failure is less frecuent. I have connected to my laptop and I am waiting for the failure. Till now the battery is 95% as minimum.

Thanks again for your comments

danielcapelo
Posts: 5
Joined: Thu Nov 08, 2018 4:39 pm
Company: Data Lights

Re: CO2 probe stops to sense

Post by danielcapelo » Fri Dec 14, 2018 10:00 pm

Hi again,

I tryied to monitoring the result, hoping that the system fails when it is connected to the laptop, but it did'nt happen. So yesterday, I connected only to the power supply and the CO2 sensor failed again giving a measure equal to 0 ppm.

Just clarifying, the failure without serial monitor happens 12 hours after connection, approximately.

I am testing the receptor so I cannot change the application for receiving the battery information, do you have any suggestion for detect the problem?

Thanks for your help,
Daniel

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

Re: CO2 probe stops to sense

Post by libelium-dev » Mon Dec 17, 2018 9:39 am

Hi Daniel,

Please try to perform the test to motorize the battery level. If the battery level is good when the sensor fail, please fill the RMA form and our tech support team will contact you to solve the issue.
https://www.libelium.com/contact/#rma

Regards

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest