Smart Environment Pro

New sensors integration, sensor boards usage...
Post Reply
Jimsh
Posts: 5
Joined: Tue Oct 01, 2019 2:25 pm
Company: IoTDanmark A/S

Smart Environment Pro

Post by Jimsh » Wed Oct 02, 2019 1:23 pm

I seem to have a problem with the waspmote SE Pro. I am using two H2S sensors on A and F ports and this works typically one time and then hangs.

If i comment out the PWR.deepSleep call (as in the code) and replace with delay(xxxxx), the unit performs as expected.

Any suggestions as to what I should do?

Secondarily, what are the correct settings for the 3 dip switches on the WaspMote board?

/jim

Code used

/*
* ------------ [GP_v30_01] - Electrochemical gas sensors --------------
*
* Explanation: This is the revised program to manage and read electro-
* chemical gas sensors of type 9381-P (Hydrogen Sulphide – H2S).
*
* This program has been further modified in order to communicate with the
* Sigfox network.
*
* Cycle time is 10 minutes due to limitation of sending a maximum of
* 144 Sigfox payloads a day.
*

*/

#include <WaspSensorGas_Pro.h>
#include <WaspSigfox.h>
#include <WaspRTC.h>


/*
* Define object for sensor: gas_PRO_sensor
* Input to choose board socket.
* Waspmote OEM. Possibilities for this sensor:
* - SOCKET_1
* - SOCKET_2
* - SOCKET_3
* - SOCKET_4
* - SOCKET_5
* - SOCKET_6
* P&S! Possibilities for this sensor:
* - SOCKET_A
* - SOCKET_B
* - SOCKET_C
* - SOCKET_F
*/

Gas gas_PRO_sensor_1(SOCKET_A);
Gas gas_PRO_sensor_2(SOCKET_F);

float concentration_1; // Stores the concentration level in ppm
float temperature_1; // Stores the temperature in ºC
float humidity_1; // Stores the realitve humidity in %RH
float pressure_1; // Stores the pressure in Pa

float concentration_2; // Stores the concentration level in ppm
float temperature_2; // Stores the temperature in ºC
float humidity_2; // Stores the realitve humidity in %RH
float pressure_2; // Stores the pressure in Pa

char payload[24];
uint8_t socket = SOCKET0;
uint8_t error;
int16_t payloaddata[6];


#define MAX_TEMP_SENSOR_VALUE 200
#define MIN_TEMP_SENSOR_VALUE -200
#define MAX_CONC_SENSOR_VALUE 999
#define MIN_CONC_SENSOR_VALUE -999

void setup()
{
USB.println(F("H2S gas sensors program"));

///////////////////////////////////////////
// 1. Turn on the sensors
///////////////////////////////////////////
Utils.setExternalLED(LED_ON); // Turns external led ON
// Power on the electrochemical sensor.
// If the gases PRO board is off, turn it on automatically.
gas_PRO_sensor_1.ON();
gas_PRO_sensor_2.ON();


// First sleep time
// After 10 minutes, Waspmote wakes up thanks to the RTC Alarm
//PWR.deepSleep("00:00:02:00", RTC_OFFSET, RTC_ALM1_MODE1, ALL_ON); //DOES NOT WORK AS EXPECTED!, replaced by delay
delay(3000);

}
int16_t lround(float number )
{
return number;
}

void loop()
{
//////////////////////////////////////////////
// 1. switch on
//////////////////////////////////////////////
error = Sigfox.ON(socket);

// Check sending status
if( error == 0 )
{
USB.println(F("Switch ON OK"));
}
else
{
USB.println(F("Switch ON ERROR"));
}

///////////////////////////////////////////
// 2. Read sensors and battery level
///////////////////////////////////////////

// Sensor 1

// Read the electrochemical sensor and compensate with the temperature internally
concentration_1 = gas_PRO_sensor_1.getConc();

// Read enviromental variables
temperature_1 = gas_PRO_sensor_1.getTemp();
//humidity_1 = gas_PRO_sensor_1.getHumidity();
//pressure_1 = gas_PRO_sensor_1.getPressure();

// And print the values via USB
USB.println(F("***************************************"));
USB.print(F("Gas concentration 1: "));
USB.print(concentration_1);
USB.println(F(" ppm"));
USB.print(F("Temperature 1: "));
USB.print(temperature_1);
USB.println(F(" Celsius degrees"));
/*
USB.print(F("RH 1: "));
USB.print(humidity_1);
USB.println(F(" %"));
USB.print(F("Pressure 1: "));
USB.print(pressure_1);
USB.println(F(" Pa"));
*/

// Sensor 2

// Read the electrochemical sensor and compensate with the temperature internally
concentration_2 = gas_PRO_sensor_2.getConc();

// Read enviromental variables
temperature_2 = gas_PRO_sensor_2.getTemp();
humidity_2 = gas_PRO_sensor_2.getHumidity();
pressure_2 = gas_PRO_sensor_2.getPressure();

// And print the values via USB
USB.println(F("***************************************"));
USB.print(F("Gas concentration 2: "));
USB.print(concentration_2);
USB.println(F(" ppm"));
USB.print(F("Temperature 2: "));
USB.print(temperature_2);
USB.println(F(" Celsius degrees"));
/*
USB.print(F("RH 2: "));
USB.print(humidity_2);
USB.println(F(" %"));
USB.print(F("Pressure 1: "));
USB.print(pressure_2);
USB.println(F(" Pa"));
*/
// Read battery level
uint16_t batt_lvl = 0;
batt_lvl = PWR.getBatteryLevel(); // battery_level contains the % of remaining battery

// And print the values via USB
USB.print(F("Battery level: "));
USB.print(batt_lvl, DEC);
USB.println(F(" %"));

///////////////////////////////////////////
// 3. Make Sigfox payload
///////////////////////////////////////////

USB.println(F("Sigfox payload: rounded values "));
// test values, to be commented out when running
/*
concentration_1=-156;
concentration_2=1500;
temperature_1=24.21;
temperature_2=-225.97;
*/

// prepare conc1 part of payload
if (concentration_1 < MIN_CONC_SENSOR_VALUE)
concentration_1 = MIN_CONC_SENSOR_VALUE;
else if (concentration_1 > MAX_CONC_SENSOR_VALUE)
concentration_1 = MAX_CONC_SENSOR_VALUE;

int16_t conc1;
conc1 = lround(concentration_1);
USB.println(conc1);


// prepare conc2 part of payload
if (concentration_2 < MIN_CONC_SENSOR_VALUE)
concentration_2 = MIN_CONC_SENSOR_VALUE;
else if (concentration_2 > MAX_CONC_SENSOR_VALUE)
concentration_2 = MAX_CONC_SENSOR_VALUE;

int16_t conc2;
conc2 = lround(concentration_2);
USB.println(conc2);

// prepare temperature 1 part of payload
if (temperature_1 < MIN_TEMP_SENSOR_VALUE)
temperature_1 = MIN_TEMP_SENSOR_VALUE;
else if (temperature_1 > MAX_TEMP_SENSOR_VALUE)
temperature_1 = MAX_TEMP_SENSOR_VALUE;
temperature_1 = 100*temperature_1;

int16_t temp1;
temp1 = lround(temperature_1);
USB.println(temp1);


// prepare temperature 2 part of payload
if (temperature_2 < MIN_TEMP_SENSOR_VALUE)
temperature_2 = MIN_TEMP_SENSOR_VALUE;
else if (temperature_2 > MAX_TEMP_SENSOR_VALUE)
temperature_2 = MAX_TEMP_SENSOR_VALUE;
temperature_2 = 100*temperature_2;

int16_t temp2;
temp2 = lround(temperature_2);
USB.println(temp2);

payloaddata[0] = conc1;
payloaddata[1] = conc2;
payloaddata[2] = temp1;
payloaddata[3] = temp2;
payloaddata[4] = batt_lvl;

// Send 12 bytes at most
//error = Sigfox.send("000405060708090102030D0E");
error = Sigfox.send((uint8_t *)payloaddata, 10);

// Check sending status
if( error == 0 )
{
USB.println(F("Sigfox packet sent OK"));
}
else
{
USB.println(F("Sigfox packet sent ERROR"));
}

///////////////////////////////////////////
// 4. Sleep
///////////////////////////////////////////

// Go to deepsleep
// After 10 minutes, Waspmote wakes up thanks to the RTC Alarm
Utils.setExternalLED(LED_OFF); // Turns external led OFF
//PWR.deepSleep("00:00:02:00", RTC_OFFSET, RTC_ALM1_MODE1, ALL_OFF); //DOES NOT WORK AS EXPECTED!, replaced by delay
delay(400000);

}

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

Re: Smart Environment Pro

Post by libelium-dev » Thu Oct 03, 2019 8:36 am

Hi,

The deepSleep function turns OFF the gases sensor and they are turned ON gain since it is done in the setup part. If you want to keep the gases sensor ON, you need to use the following function

Code: Select all

PWR.deepSleep("00:00:02:00", RTC_OFFSET, RTC_ALM1_MODE1, ALL_ON);
You can know the position of the switches in the following links
http://www.libelium.com/downloads/docum ... df#page=12
http://www.libelium.com/downloads/docum ... df#page=64

Regards

Jimsh
Posts: 5
Joined: Tue Oct 01, 2019 2:25 pm
Company: IoTDanmark A/S

Re: Smart Environment Pro

Post by Jimsh » Tue Oct 08, 2019 1:21 pm

I have done as you suggest ... however this doesn't help. The switches are set as described in the documentation and my code is adjusted so that the sensors are turned on in the Setup:

// If the gases PRO board is off, turn it on automatically.
gas_PRO_sensor_1.ON();
gas_PRO_sensor_2.ON();

The loop now ends with:

PWR.deepSleep("00:00:02:00", RTC_OFFSET, RTC_ALM1_MODE1, ALL_ON);

The program runs once only and then hangs.

I am convinced that the problem is with the RTC deep sleep function. Any suggestions?

/jim

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

Re: Smart Environment Pro

Post by libelium-dev » Wed Oct 09, 2019 9:42 am

Hi,

Please share with us some images of your Waspmote board to check if there is any component damaged.

Also, please disconnect the sensor board from Waspmote and upload the following code to check if the RTC works properly. Copy here the output through the serial monitor
http://www.libelium.com/development/was ... leep-mode/

Regards

Jimsh
Posts: 5
Joined: Tue Oct 01, 2019 2:25 pm
Company: IoTDanmark A/S

Re: Smart Environment Pro

Post by Jimsh » Wed Oct 09, 2019 11:21 am

Thank you for reply.
I have no idea how to attach a photo here, however there is no apparent component damage that I can see. Please tell me how to do this and I will send a picture of the WaspMote board.

Have run the RTC check and it works ok with the expected output.

/jim

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

Re: Smart Environment Pro

Post by libelium-dev » Thu Oct 10, 2019 8:54 am

Hi,

You can use dropbox, google drive, etc. to share the images.

Does the deepSleep example work when the gases board is connected to Waspmote?

Regards

Jimsh
Posts: 5
Joined: Tue Oct 01, 2019 2:25 pm
Company: IoTDanmark A/S

Re: Smart Environment Pro

Post by Jimsh » Tue Oct 22, 2019 11:49 am

The DeepSleep test does network when the sensor board is connected. Can I assume that the sensor board is defective and can you advise as to next steps...

/jim

Jimsh
Posts: 5
Joined: Tue Oct 01, 2019 2:25 pm
Company: IoTDanmark A/S

Re: Smart Environment Pro

Post by Jimsh » Tue Oct 22, 2019 11:50 am

The DeepSleep test does NOT work when the sensor board is connected. Can I assume that the sensor board is defective and can you advise as to next steps...

/jim

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

Re: Smart Environment Pro

Post by libelium-dev » Wed Oct 23, 2019 8:32 am

Hi,

It seems that the gases board is causing interference in the I2C bus and therefore the RTC doesn't work properly. 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