High battery consumption

Post Reply
greensmartie
Posts: 2
Joined: Mon Aug 26, 2019 2:47 pm
Company: IBM

High battery consumption

Post by greensmartie » Mon Aug 26, 2019 3:20 pm

Hi Support,

I have a Smart Environment PRO with PM sensor and external battery pack.
I wish to measure NO2 and particles. I have created the code based upon the provided examples. However I find that the battery level deplete very rapidly and that the external battery does not seem to provide a charge which the main unit can hold for any period of time. On a five minute interval the power depletes by half over a couple of days. I was under the impression that unit would last alot longer. I am also surprised to see that any charge received by the external battery is also gone within one measurement interval.

I really appreciate any guidance you could provide. Thanks!

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

Re: High battery consumption

Post by libelium-dev » Tue Aug 27, 2019 8:26 am

Hi,

The particle matter sensor has a higher current consumption, 250mA. How many time is the PM sensor power ON? How often is this sensor measured?

Could you please share the code with us? So we will try to improve it to save battery. If the sensor is read frequently, it is normal for the battery level to drain quickly.

Regards

greensmartie
Posts: 2
Joined: Mon Aug 26, 2019 2:47 pm
Company: IBM

Re: High battery consumption

Post by greensmartie » Tue Aug 27, 2019 9:14 am

Please find code below:



#include <WaspSensorCities_PRO.h>
#include <Wasp4G.h>
#include <WaspPM.h>

// NO2 Sensor must be connected physically in SOCKET_3
Gas sensor_no2(SOCKET_A);

float concentration_no2;

uint8_t sensorBat;
char NO2PPM_str[10];
char PM1_str[10];
char PM2_5_str[10];
char PM10_str[10];
char temp_str[10];
char hum_str[10];

// APN settings
///////////////////////////////////////
char apn[] = "xxxxxx.xxxxxx.xxx";
char login[] = "";
char password[] = "";
///////////////////////////////////////

// SERVER settings
///////////////////////////////////////
char host[] = "xxxxxx.xxxxx.xxx";
uint16_t port = 9999;
char resource[] = "/xxxxx/xxxxx/xxx";
char datatest[] = "waspmote";
///////////////////////////////////////

// buffer of memory to create the request
char data[500];

int error;

char info_string[61];
char serial_number[61];
int status;
int measure;

void setup()
{

// Configure the USB port
USB.ON();
USB.println(F("Start program setup()"));

//////////////////////////////////////////////////
// 1. sets operator parameters
//////////////////////////////////////////////////
_4G.set_APN(apn, login, password);

//////////////////////////////////////////////////
// 2. Show APN settings via USB port
//////////////////////////////////////////////////
_4G.show_APN();

//////////////////////////////////////////////////
// 1. Switch ON
//////////////////////////////////////////////////
error = _4G.ON();

if (error == 0)
{
USB.println(F("1. 4G module ready..."));
}

////////////////////////////////////////////////
// 3. Powers off the 4G module
////////////////////////////////////////////////
_4G.OFF();
USB.println(F("3. Switch OFF 4G module\n\n"));

USB.println(F("Particle Matter Sensor On"));

// switch on sensor
status = PM.ON();

// check answer
if (status == 1)
{
// get info from sensor
status = PM.getInfoString(info_string);

if (status == 1)
{
USB.println(F("Information string extracted:"));
USB.println(info_string);
}
else
{
USB.println(F("Error reading the particle sensor"));
}

// read serial number from sensor. That funtion isn't avalable for OPC-N2 sensor
status = PM.readSerialNumber(serial_number);
if (status == 1)
{
USB.print(F("Serial number: "));
USB.println(serial_number);

}
else
{
USB.println(F("Error reading the serial number"));
}

// switch off sensor
PM.OFF();
USB.println(F("3. Switch OFF PM module\n\n"));
}
else
{
USB.println(F("Error starting the particle sensor"));
}

USB.println(F("END program setup()"));
}



void loop()
{
USB.println(F("Start Loop"));

// init RTC and get time
RTC.ON();
RTC.getTime();

// Reading time
USB.print(F("Time [Day of week, YY/MM/DD, hh:mm:ss]: "));
USB.println(RTC.getTime());

sensorBat = PWR.getBatteryLevel();
// Show the remaining battery level
USB.print(F("Battery Level: "));
USB.print(sensorBat,DEC);
USB.println(F(" %"));


///////////////////////////////////////////
// 3. Ready gas sensors
///////////////////////////////////////////'

// switch on all gas sensor again
USB.println(F("starting NO2 Sensor..."));
sensor_no2.ON();

///////////////////////////////////////////
// 2. Turn on the PM sensor
///////////////////////////////////////////

// Power on the PM sensor
status = PM.ON();

// check answer
if (status == 1)
{
USB.println(F("Particle sensor started"));
}
else
{
USB.println(F("Error starting the particle sensor"));
}

///////////////////////////////////////////
// 3. Read PM sensor
///////////////////////////////////////////
if (status == 1)
{
// Power the fan and the laser and perform a measure of 3 seconds
USB.println(F("get 3 second Particle measurement"));
measure = PM.getPM(3000, 3000);

// check answer
if (measure == 1)
{
USB.println(F("Measure performed"));
USB.print(F("PM 1: "));
USB.printFloat(PM._PM1, 3);
USB.println(F(" ug/m3"));
USB.print(F("PM 2.5: "));
USB.printFloat(PM._PM2_5, 3);
USB.println(F(" ug/m3"));
USB.print(F("PM 10: "));
USB.printFloat(PM._PM10, 3);
USB.println(F(" ug/m3"));
USB.print(F("Temp: "));
USB.print(PM._temp);
USB.println(F(" ºC"));
USB.print(F("Hum: "));
USB.print(PM._hum);
USB.println(F(" %RH"));
USB.print("Bin: ");
for (int i = 0; i < 24; i++)
{
USB.print(PM._bin);
USB.print(";");
}
USB.println();


//Convert PM measurements to strings
dtostrf( PM._PM1, 1, 4, PM1_str);
dtostrf( PM._PM2_5, 1, 4, PM2_5_str);
dtostrf( PM._PM10, 1, 4, PM10_str);
dtostrf( PM._temp, 1, 2, temp_str);
dtostrf( PM._hum, 1, 2, hum_str);
}
else
{
USB.print(F("Error performing the measure. Error code:"));
USB.println(measure, DEC);
}
}
///////////////////////////////////////////
// 4. Turn off the PM sensor
///////////////////////////////////////////

// Power off the PM sensor. If there aren't other sensors powered,
// turn off the board automatically
PM.OFF();

///////////////////////////////////////////
// 2. Wait heating time
///////////////////////////////////////////

// Sensors need time to warm up and get a response from gas
// To reduce the battery consumption, use deepSleep instead delay
// After 2 minutes, Waspmote wakes up thanks to the RTC Alarm
USB.println();
USB.println(F("Enter deep sleep mode to wait for sensors heating time..."));
PWR.deepSleep("00:00:01:00", RTC_OFFSET, RTC_ALM1_MODE1, ALL_ON);
USB.ON();
USB.println(F("wake up!!\r\n"));

// Read the sensors and compensate with the temperature internally
concentration_no2 = sensor_no2.getConc(PM._temp);
USB.print(F("SOCKET_C -- > NO2 concentration : "));
USB.printFloat(concentration_no2, 3);

dtostrf(concentration_no2, 1, 6, NO2PPM_str);

USB.println(F("switching NO2 Sensor off..."));
sensor_no2.OFF();

///////////////////////////////////////////
// 4. Create ASCII frame
///////////////////////////////////////////
USB.println(F("2.1. Create frame:"));

// Create new frame (ASCII)

char http_format[] =
"{\"growsmarter\": {\r\n"\
"\"RTC\": \"%s\",\r\n"\
"\"BAT\": \"%d\",\r\n"\
"\"NO2\": \"%s\",\r\n"\
"\"PM1\": \"%s\",\r\n"\
"\"PM2_5\": \"%s\",\r\n"\
"\"PM10\": \"%s\",\r\n"\
"\"temp\": \"%s\",\r\n"\
"\"hum\": \"%s\"}}";

snprintf( data, sizeof(data), http_format,RTC.getTime(),sensorBat,NO2PPM_str,PM1_str,PM2_5_str,PM10_str,temp_str,hum_str);

USB.println( data );
//////////////////////////////////////////////////
// 1. Switch 4G ON
//////////////////////////////////////////////////

error = _4G.ON();

if (error == 0)
{
USB.println(F("1. 4G module ready..."));

////////////////////////////////////////////////
// 2. HTTP POST
////////////////////////////////////////////////

USB.print(F("2. HTTP POST request..."));

//Set content-type text/plain
_4G.httpSetContentType(1);
// send the request
error = _4G.http( Wasp4G::HTTP_POST, host, port, resource, data);

// check the answer
if (error == 0)
{
USB.print(F("Done. HTTP code: "));
USB.println(_4G._httpCode);
USB.print("Server response: ");
USB.println(_4G._buffer, _4G._length);
}
else
{
USB.print(F("Failed. Error code: "));
USB.println(error, DEC);
}
}
else
{
// Problem with the communication with the 4G module
USB.println(F("4G module not started"));
USB.print(F("Error code: "));
USB.println(error, DEC);
}

////////////////////////////////////////////////
// 3. Powers off the 4G module
////////////////////////////////////////////////
USB.println(F("3. Switch OFF 4G module"));
_4G.OFF();

////////////////////////////////////////////////
// 5. Sleep
////////////////////////////////////////////////
USB.println(F("5. Enter deep sleep..."));
PWR.deepSleep("00:00:04:00", RTC_OFFSET, RTC_ALM1_MODE1, ALL_OFF);

USB.ON();
USB.println(F("6. Wake up!!\n\n"));

}

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

Re: High battery consumption

Post by libelium-dev » Tue Aug 27, 2019 11:52 am

Hi,

The current consumption of the node is normal keeping in mind that the sleeping time is 4 minutes. We recommend increasing it to 15-30 minutes at least since the current consumption of the 4G module and PM sensor is very high.

The maximum current that the panel solar socket admit is 300mA. The external battery recharges the battery for 5 minutes per day at the maximum current (300mA) but the 4G module (100-400mA) and PM sensor (250mA) consumes much more energy and they are used every 4 minutes.

Regards

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest