ATMega328p 8Mhz internal, standalone, mysensors low power problem
-
Hi ! I have started to upgrade mysensors ( 1.5 ) thats been working for a long time to version 2.1.1 but can't seem to get lowpower working.
Tried most of the stuff out there like different bootloaders and changing NRF24 chips but I end up with 17mA during transmit and between 2,4 - 3,5mA in sleep mode.
Tried using other low power libraries like http://www.gammon.com.au/power which works nice but is not compatible with mysensors because some parts are already implemented there I guess. With this library I get sleep mode like 20uA but then again can't get mysensors to work. What's the catch ?
Anyone else have this problem and hopefully a solution for standalone ATMega 328p ?
-
Here is a minimal sketch I am testing with:
#define MY_RADIO_NRF24 #include <SPI.h> #include <MySensors.h> #include <DHT.h> #define DHT_DATA_PIN 8 #define SENSOR_TEMP_OFFSET 0 static const uint64_t UPDATE_INTERVAL = 60000; #define CHILD_ID_HUM 0 #define CHILD_ID_TEMP 1 MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); DHT dht; void presentation() { sendSketchInfo("TemperatureAndHumidity", "2.2"); present(CHILD_ID_HUM, S_HUM); present(CHILD_ID_TEMP, S_TEMP); } void setup() { } void loop() { dht.readSensor(true); float temperature = dht.getTemperature(); float humidity = dht.getHumidity(); send(msgHum.set(humidity, 1)); sleep(10000); } -
Here is a minimal sketch I am testing with:
#define MY_RADIO_NRF24 #include <SPI.h> #include <MySensors.h> #include <DHT.h> #define DHT_DATA_PIN 8 #define SENSOR_TEMP_OFFSET 0 static const uint64_t UPDATE_INTERVAL = 60000; #define CHILD_ID_HUM 0 #define CHILD_ID_TEMP 1 MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); DHT dht; void presentation() { sendSketchInfo("TemperatureAndHumidity", "2.2"); present(CHILD_ID_HUM, S_HUM); present(CHILD_ID_TEMP, S_TEMP); } void setup() { } void loop() { dht.readSensor(true); float temperature = dht.getTemperature(); float humidity = dht.getHumidity(); send(msgHum.set(humidity, 1)); sleep(10000); } -
I have 4 sensors (temp/hum and contact switch) powered by 3V coin battery and with the library 1.5.4 they run for a year. I also decided to upgrade them to the library 2.1.1 and I got some issues. For example the binarysqwitchsleepsensor doesn't sleep. I also noticed that the initialization has many messages sending failure and that is a heavy blow for the battery, I went back to the 1.5.4.
-
I have 4 sensors (temp/hum and contact switch) powered by 3V coin battery and with the library 1.5.4 they run for a year. I also decided to upgrade them to the library 2.1.1 and I got some issues. For example the binarysqwitchsleepsensor doesn't sleep. I also noticed that the initialization has many messages sending failure and that is a heavy blow for the battery, I went back to the 1.5.4.
-
I have 4 sensors (temp/hum and contact switch) powered by 3V coin battery and with the library 1.5.4 they run for a year. I also decided to upgrade them to the library 2.1.1 and I got some issues. For example the binarysqwitchsleepsensor doesn't sleep. I also noticed that the initialization has many messages sending failure and that is a heavy blow for the battery, I went back to the 1.5.4.
Could it be board related ? I am using Arduino 1.8.1. I tried compiling with Ardino Pro / ATmega 328p 8Mhz as stock setup and now using both bootloader and setup from here: https://github.com/MCUdude/MiniCore/blob/master/README.md#boards-manager-installation
I was just thinking that maybe some of the command in the mysensors library are disabled if it detects another board setting ?
Also anyone know if the pin 2 / IRQ should be used ? Its not connected in my project could it be that mysensors is awakened by this ?
-
Hi ! I have started to upgrade mysensors ( 1.5 ) thats been working for a long time to version 2.1.1 but can't seem to get lowpower working.
Tried most of the stuff out there like different bootloaders and changing NRF24 chips but I end up with 17mA during transmit and between 2,4 - 3,5mA in sleep mode.
Tried using other low power libraries like http://www.gammon.com.au/power which works nice but is not compatible with mysensors because some parts are already implemented there I guess. With this library I get sleep mode like 20uA but then again can't get mysensors to work. What's the catch ?
Anyone else have this problem and hopefully a solution for standalone ATMega 328p ?
@torfinn RESOLVED:
Hi ! I had problem with properly registering on the gateway ( due to chips was used on old version earlier ). After finding this post I tried the https://www.mysensors.org/build/debug#clearing-eeprom and it fixed problem. Looking at 40uA sleeping now :-) -
I have 4 sensors (temp/hum and contact switch) powered by 3V coin battery and with the library 1.5.4 they run for a year. I also decided to upgrade them to the library 2.1.1 and I got some issues. For example the binarysqwitchsleepsensor doesn't sleep. I also noticed that the initialization has many messages sending failure and that is a heavy blow for the battery, I went back to the 1.5.4.
@mortommy Hi ! I decided to go with 2.1.1 on new sensors but still have the old 1.5.4 gw running. Had to change frequency to #define MY_RF24_CHANNEL 125 as the 2.1.1 sensors also registered partialy ( temp not humidity ) on the old 1.5 gw.
Also tried out #define MY_REPEATER_FEATURE Disabled this seems to do the opposite what i thought. Radio is never turned off ie. 17mA drain.
Added the following to try the lower the init etc. and it improves a little.
#define MY_REGISTRATION_FEATURE Disabled
#define MY_REGISTRATION_RETRIES 1I think its a serious flaw that if the gw for any case locks up our sensors will drain the battery until it's back online again.
-
@mortommy Hi ! I decided to go with 2.1.1 on new sensors but still have the old 1.5.4 gw running. Had to change frequency to #define MY_RF24_CHANNEL 125 as the 2.1.1 sensors also registered partialy ( temp not humidity ) on the old 1.5 gw.
Also tried out #define MY_REPEATER_FEATURE Disabled this seems to do the opposite what i thought. Radio is never turned off ie. 17mA drain.
Added the following to try the lower the init etc. and it improves a little.
#define MY_REGISTRATION_FEATURE Disabled
#define MY_REGISTRATION_RETRIES 1I think its a serious flaw that if the gw for any case locks up our sensors will drain the battery until it's back online again.
@torfinn said in ATMega328p 8Mhz internal, standalone, mysensors low power problem:
#define MY_REGISTRATION_FEATURE Disabled
This has no effect, the correct approach would be to comment this line:
https://github.com/mysensors/MySensors/blob/master/MyConfig.h#L146
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login
