Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Adafruit Nrf52840 Express - LoraWan (lmic) & Power Consumpti
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit Nrf52840 Express - LoraWan (lmic) & Power Consumpti

by Dardrai on Sat Feb 15, 2020 5:13 am

Hello Adafruit Team

I have a problem with my NRF52840 Express to get to a low power State:

Hardware:
Feather nRF52840 Express this one: Image
-FeatherWing RFM95W (loraWan Module)
DHT Sensor https://learn.adafruit.com/dht

Libraries used:
Lmic - https://github.com/mcci-catena/arduino-lmic
LPP-Payload - https://github.com/dardrai/CayenneLPP
DHT - at least for this sketch

in the Attachments I have to solutions from my two sensor. The function of these Sensor is as fallowed: Send every 5min your Values to the TTN backend, then sleep.
The two solutions are trying the same thing, but with different approaches to the sleep.

temHumidity_1 does his job like this:

void loop() {

// Send every TX_INTERVAL millis
static uint32_t last = 0;
if (0 == last || millis() - last > SLEEP_DELAY) {
last = millis();
sendMessage();
}

ttn_loop();
}

if (EV_TXCOMPLETE == message) { //this Event get returned, when the msg was send successfully
__WFE();
delay(SLEEP_DELAY); // SLEEP HERE!

}

temHumidity_2 does his job like this:

void loop() {
ttn_loop();
waitForEvent();
}

if (EV_TXCOMPLETE == message) {
scheduleNextSend();
}

void scheduleNextSend() {
os_setTimedCallback(&sendjob, os_getTime() + sec2osticks(TX_INTERVAL), sendMessage);
waitForEvent();
}

The result of the power consumption are like this:
Temp1 used around 14% Battery in 6 Days
Temp2 used around 8% Battery (yesterday 48% from 16:00:39 to today 40% from 09:40:24)

The Result of the temp1 looks much better but isn't even enough power saving. The Sensor should run around half a year on a single Battery Charge (2000mAh).
I found in your git Repo a issue where the suggestet way to go to a much lower power state could be a loopless solution.

I tried this as well, but do to the fact, that after caling send(); I'll have to run os_runloop_once() "often enough" - https://github.com/mcci-catena/arduino- ... ing-issues (this code below is just pseudocode - real Code in the Attached range1.zip)
void timer_callback(TimerHandle_t _handle) {
send();
for(int i = 0; i < 4000; i++){
os_runloop_once();
}
Sleep(5min);
}

Also this (loopless solution) has some additional side effects - e.g. the DHT Sensor can be read out any more (console log looks then like this):
Serial.print("Volt: ");
Serial.println(convertToVoltage(vbat_mv));
Serial.print("Percent: ");
Serial.println(mvToPercent(vbat_mv));
Serial.print("Temperature: ");
// nothing happens - no Output from any Line below
Serial.println(dht.readTemperature());
Serial.print("Humidity: ");
Serial.println(dht.readHumidity());

The loopless Example works with a different kind of sensor (http://wiki.seeedstudio.com/Grove-Ultrasonic_Ranger/) - well enough, but I couldn't see/find any improvement in the power consumption. Only that it has more possibilities to fail (like with the dht Sensor).

Do to heavy searching, googling etc I found the fallowing Commands that could send the nrf to a lower power State (find them in your git, or in the nordic documentation) but I think the won't improve a thing - or it looks like it won't - when I look at the values send from my temp2 sensor:
waitForEvent();
__WFE();

This commands compile but when I serial print the sd_app... or sd_power... etc the all return the error 2 - NRF_ERROR_SOFTDEVICE_NOT_ENABLED.
sd_app_evt_wait();
sd_power_mode_set(NRF_POWER_MODE_LOWPWR);
sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE);

Deployment via ArduinoIDE:
Image

How would you improve the power consumption for this use case?
Is the delay() function the only "sleeping" function (thanks to FreeRTOS) or does the NRF have additional function to go to a sleep/deep sleep that could be timed?
System-Off can only be Interrupted via GPIO Pins right? So with system off it wouldn't be possible to wakeup after a timer has run down right?

I would love to test also the functions like sd_app_evt_wait(), but I don't know how I could turn on the SOFTDEVICE so the returned event wouldn't be NRF_ERROR_SOFTDEVICE_NOT_ENABLED.
How do I turn on the Softdevice Function?


Thank you for your help and kind regards

David
Attachments
range_1.zip
(6.78 KiB) Downloaded 5 times
tempHumidity_2.zip
(7.68 KiB) Downloaded 4 times
tempHumidity_1.zip
(7.76 KiB) Downloaded 4 times

Dardrai
 
Posts: 4
Joined: Sat Feb 15, 2020 4:22 am

Re: Adafruit Nrf52840 Express - LoraWan (lmic) & Power Consu

by jmann19 on Thu Apr 09, 2020 10:29 pm

Have you tried the "adafruit_sleepy_dog" library?

Here is a link to the git hub repo: https://github.com/adafruit/Adafruit_SleepyDog

Lady Ada also has a video on youtube where she implements the watchdog functionality, too.

Let me know if this helps

jmann19
 
Posts: 21
Joined: Thu Apr 09, 2020 9:51 pm

Re: Adafruit Nrf52840 Express - LoraWan (lmic) & Power Consu

by jmann19 on Thu Apr 09, 2020 10:30 pm


jmann19
 
Posts: 21
Joined: Thu Apr 09, 2020 9:51 pm

Re: Adafruit Nrf52840 Express - LoraWan (lmic) & Power Consu

by Dardrai on Fri Apr 10, 2020 2:03 am

Sorry for the late response, at the end I used Adafruit SleepyDog Library but with it I could get the power consumption in check. Next step will be the installation of a TPL5110

Dardrai
 
Posts: 4
Joined: Sat Feb 15, 2020 4:22 am

Re: Adafruit Nrf52840 Express - LoraWan (lmic) & Power Consu

by jmann19 on Fri Apr 10, 2020 3:24 am

Is your setup still drawing too much power? If so the TPL will prolly be your best bet. Thank for the reply!

jmann19
 
Posts: 21
Joined: Thu Apr 09, 2020 9:51 pm

Re: Adafruit Nrf52840 Express - LoraWan (lmic) & Power Consu

by Dardrai on Fri Apr 10, 2020 5:36 am

Jep with the sleep function provided from the library the power comsumption was still to hight. We should have reached a uptime of the device of around 6-7 months. But in the end we could only reach around 30 to 60 days up time - depending on the chosen sensor - e.G ultrasonic ranger was the worst performing sensor that we had to use.

Dardrai
 
Posts: 4
Joined: Sat Feb 15, 2020 4:22 am

Re: Adafruit Nrf52840 Express - LoraWan (lmic) & Power Consu

by Dardrai on Fri Apr 10, 2020 5:38 am

Dardrai wrote:Sorry for the late response, at the end I used Adafruit SleepyDog Library but with it I couldn't get the power consumption in check. Next step will be the installation of a TPL5110

fixed my comment - couldn't edit it anymore, and I forgot the not :D

Dardrai
 
Posts: 4
Joined: Sat Feb 15, 2020 4:22 am

Re: Adafruit Nrf52840 Express - LoraWan (lmic) & Power Consu

by jmann19 on Fri Apr 10, 2020 2:25 pm

Hmm...okay, do you mind posting the code, maybe I could recreate the setup here. And see if I could find anything. You should also consider trying the "radio.sleep();" function as well.

jmann19
 
Posts: 21
Joined: Thu Apr 09, 2020 9:51 pm

Please be positive and constructive with your questions and comments.