[SOLVED] High battery usage (Pro-Mini / RFM69 / Si7021)
-
Hi all,
A have a plain vanilla Temperature + Humidity sensor using all standard codes from MySensors. I saw a lot of posts mentioning +1year battery life, but I am getting a couple of weeks (11 days actually).
I use a pro-mini 3V (removed the led and regulator), with a RFM69 (433MHz) and the SI7021. I also setup the battery level measurement setup as per the website (2 resistors, but have not used the capacitor).
Below is the code I used. The only customization I made on the regular code was adding a way to measure the RSSI.
I also tried to check the actual current, but without any success with my multimeter (maybe it is not sensible enough). Does disabling DEBUG reduce battery consumption (arduino is not connected to any serial port to receive debug anyway).
Any though is much appreciated.
/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * REVISION HISTORY * Version 1.0: Yveaux * * DESCRIPTION * This sketch provides an example of how to implement a humidity/temperature * sensor using a Si7021 sensor. * * For more information, please visit: * http://www.mysensors.org/build/humiditySi7021 * */ // Enable debug prints #define MY_DEBUG // Atualizar para nรณ esperado #define MY_NODE_ID 3 // Enable REPORT_BATTERY_LEVEL to measure battery level and send changes to gateway #define REPORT_BATTERY_LEVEL // Enable and select radio type attached //#define MY_RADIO_RF24 #define MY_RADIO_RFM69 //#define MY_RS485 #define MY_RFM69_FREQUENCY RFM69_433MHZ // Define for frequency setting. Needed if you're radio module isn't 868Mhz (868Mhz is default in lib) //#define MY_IS_RFM69HW // Mandatory if you radio module is the high power version (RFM69HW and RFM69HCW), Comment it if it's not the case #include <MySensors.h> static bool metric = true; // Sleep time between sensor updates (in milliseconds) static const uint64_t UPDATE_INTERVAL = 60000; //10 minutos #include <SI7021.h> static SI7021 sensor; #ifdef REPORT_BATTERY_LEVEL //#include <Vcc.h> //static uint8_t oldBatteryPcnt = 200; // Initialize to 200 to assure first time value will be sent. //const float VccMin = 1.8; // Minimum expected Vcc level, in Volts: Brownout at 1.8V -> 0% //const float VccMax = 2.0*1.6; // Maximum expected Vcc level, in Volts: 2xAA fresh Alkaline -> 100% //const float VccCorrection = 1.0; // Measured Vcc by multimeter divided by reported Vcc //static Vcc vcc(VccCorrection); //Cรณdigo novo - BatteryPoweredSensor int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point int oldBatteryPcnt = 0; #endif #define CHILD_ID_HUM 0 #define CHILD_ID_TEMP 1 #define CHILD_ID_RSSI 2 //RSSI #define CHILD_ID_VOLT 3 //Battary Voltage int16_t rssiVal; //RSSI MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); MyMessage msgRSSI(CHILD_ID_RSSI,V_VAR5); MyMessage msgVOLT(CHILD_ID_VOLT,V_VOLTAGE); void presentation() { // Send the sketch info to the gateway sendSketchInfo("Si7021_Tem_Hum_v03", "2.0"); // Present sensors as children to gateway present(CHILD_ID_HUM, S_HUM, "Humidity"); present(CHILD_ID_TEMP, S_TEMP, "Temperature"); present(CHILD_ID_RSSI, S_CUSTOM, "RSSI"); present(CHILD_ID_VOLT, S_MULTIMETER, "Voltage"); metric = getControllerConfig().isMetric; } void setup() { while (not sensor.begin()) { Serial.println(F("Sensor not detected!")); delay(5000); } // use the 1.1 V internal reference #if defined(__AVR_ATmega2560__) analogReference(INTERNAL1V1); #else analogReference(INTERNAL); #endif } void loop() { // Read temperature & humidity from sensor. const float temperature = float( metric ? sensor.getCelsiusHundredths() : sensor.getFahrenheitHundredths() ) / 100.0; const float humidity = float( sensor.getHumidityBasisPoints() ) / 100.0; #ifdef MY_DEBUG Serial.print(F("Temp ")); Serial.print(temperature); Serial.print(metric ? 'C' : 'F'); Serial.print(F("\tHum ")); Serial.println(humidity); #endif static MyMessage msgHum( CHILD_ID_HUM, V_HUM ); static MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); send(msgTemp.set(temperature, 2)); send(msgHum.set(humidity, 2)); #ifdef REPORT_BATTERY_LEVEL // get the battery Voltage int sensorValue = analogRead(BATTERY_SENSE_PIN); // 1M, 470K divider across battery and using internal ADC ref of 1.1V // Sense point is bypassed with 0.1 uF cap to reduce noise at that point // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts // 3.44/1023 = Volts per bit = 0.003363075 int batteryPcnt = sensorValue / 10; float batteryV = sensorValue * 0.003216031; // medido #ifdef MY_DEBUG Serial.println(sensorValue); Serial.print("Battery Voltage: "); Serial.print(batteryV); Serial.println(" V"); Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %"); #endif if (oldBatteryPcnt != batteryPcnt) { // Power up radio after sleep sendBatteryLevel(batteryPcnt); oldBatteryPcnt = batteryPcnt; static MyMessage msgVolt(CHILD_ID_VOLT, V_VOLTAGE); send(msgVolt.set(batteryV, 2)); } #endif rssiVal = _radio.readRSSI(); send(msgRSSI.set(rssiVal)); #ifdef MY_DEBUG Serial.print("RSSI: "); Serial.println(rssiVal); #endif // Sleep until next update to save energy #ifdef MY_DEBUG Serial.println("Sleep Start"); #endif sleep(UPDATE_INTERVAL); #ifdef MY_DEBUG Serial.println("Wake up!"); #endif }
-
@Oumuamua what batteries are you using to power the node?
-
Duracell PlusPower (alkaline).
An update: I was able to measure the currency using the powersource below (which is actually very helpful for testing) and it seem to be using 20 mA for 1s between sleeps and less than 1mA as currency is show zero (probably the 120uA estimated by MySensors).
So consumption seem to be as expected.
If I make all calculations with the above values, I should have around 6 months battery life.
I will try to get new batteries, as those are probably +1 year old.
any further thought is welcome.
Thanks
-
******* IMPORTANTE UPDATE **********
Actually there is also a step-up converter, bought through the MySensors site (DC-DC Step Up Boost Module 3v3).
What's the impact of the step-up converter on power consumption while the circuit is in sleeping mode?
Thanks,
-
@Oumuamua said in High battery usage (Pro-Mini / RFM69 / Si7021):
Duracell PlusPower (alkaline).
Well I actually meant what type of batteries, but I suppose you're using 2xAA, correct?
The sketch indicates you started off from the sketch presented in https://www.mysensors.org/build/humidity_si7021
Please follow the exact build instructions in this article (except for the radio connection ofcourse).
You also don't need resistors to measure the battery level then, and a boost converter also isn't required with 2xAA.
I personally have no experience with battery powered RFM6x sensors, but for Nrf24 the calculations come pretty close to reality so far; i have a pir sensor that has been running for 4.5 years on a single set of varta batteries and is still at 63%!
Furthermore i wouldn't trust that current measurement. These usb sticks are ok to get a ballpark number, but they're likely milliamps off (at best). Invest in a good quality multimeter or eg a uCurrent.
And last, the individual modules (arduino, si7021,...) can all have a higher than usual current consumption for whatever reason. If the consumption of the whole node is too high, you need to measure individual modules in isolation. But again, you need a decent current meter for that...
-
@Oumuamua said in High battery usage (Pro-Mini / RFM69 / Si7021):
What's the impact of the step-up converter on power consumption while the circuit is in sleeping mode?
According to the datasheet 18-30ฮผA
-
Your sleep interval is set for 1 minute but the comment says 10 minutes.
If you want 10 minutes between sends then you have to change the sleep_interval from 60000 to 600000. (note the extra '0').
-
Hi,
Thanks for all replies.
@skywatch : thanks! I was running a test with a 1 min loop but didn't change the description.
@Yveaux : have you been able to run up to 63% without the booster? my sensor stops working when the battery is at 2.8v (2x AA)
@eiten : this might be the latest issue I'm having. Even with my limited current measurement, the step-up is actually using a crazy 11mA (not uA) when idle. Same current as when not connected with the board.
Will investigate further and post back.
Thanks all,
-
Guys, quick update:
Seems the step-up had a problem. Changed to a new one does not use that much current.
-
@Oumuamua said in High battery usage (Pro-Mini / RFM69 / Si7021):
have you been able to run up to 63% without the booster
Yes, just 2xAA, directly powering pro mini 8mhz & nrf24
What brown out level is set in the the atmega fuses? Mine are set to 1.8v (and yes, I realize I'm overclocking the atmega when batteries are low...)
-
@Oumuamua said in High battery usage (Pro-Mini / RFM69 / Si7021):
the step-up is actually using a crazy 11mA (not uA) when idle. Same current as when not connected with the board.
That is not normal! Do you have a second step up? It seems to be... not normal
-
@Oumuamua said in High battery usage (Pro-Mini / RFM69 / Si7021):
Seems the step-up had a problem. Changed to a new one does not use that much current.
Oh... Sorry. I should read all the new messages befor posting again....
-
Hi all,
Thanks for all the help.
After some testing and letting the node run for some days, it seems that the issue is partially solved: battery consumption is very low when the node is idle.
However, the battery consumption seems to reach full runtime levels when something happens with the gateway. My follow-up question is:
What exactly happens happens when the node sends a message to a gateways that is either unreachable or cannot pass the message on (to a MQTT server, for example)? Shouldn't the node try a couple of times and then move on to sleep as per the code?
I have been working on my home network and had to disconnect / reboot the router, gateway, etc.
Every time it happens, two situations occurred:
-
gateway didn't report updates to the MQTT server (probably an issue with the gateway as the sensors are meters away and have -25 to -40 RSSI levels, I reseted the gateway in those few circumstances)
-
message reaches the gateway and MQTT server, but the controller didn't record it (Openhab), in which case I rebooted the controller
Many thanks again,
-
-
Guys,
Just quick update to help others that may find this topic relevant: problem is solved. Problem was the step-up (probably low quality). Sensor is working well and with very low battery usage (no change in 5 days).
Thanks for the comments.
-
nice work @Oumuamua, thanks for reporting back.
-
The product listing for the step-up that the OP is using says:
Sucks the juice out of your batteries.
Sounds like it delivers on what it promises....