Battery based NRF52 sensor compile options?

  • I have NRF52-based rain gauge. works well and got finally proper power consumption, but seem to have one problem to solve.
    It sends multiple sensor values and then goes to sleep for 20 minutes. This one is on the edge of radio coverage and occasionally seem to loose connection. Below is battery voltage measurement. You can see, that when there's a gap in the values (something wrong in radio coverage) the battery voltage drops rapidly, which suggests it does not sleep, but keeps trying something:

    0_1558718789617_2019-05-24 (2).png

    So the question is is there a good set of compile options to remove all checks etc, as I only want this one to send the values? If it fails just try again after the sleep period.

    Currently I have

    #define MY_TRANSPORT_WAIT_READY_MS  5000
    #define MY_RADIO_NRF5_ESB

    values are sent like


    Any suggestions?

  • When a MySensors node can't find the gateway, it will try to find another one or a repeater. That might be what you are seeing. I used the code listed below in a node I was using just as a beacon to tell if my car was nearby or not. It might be worth a try. It tells the node to just stop looking if it can't find the specified gateway.

    Note: If you are using a repeater to get to the gateway, then this is not what you want to do.

     * @brief Enable MY_PARENT_NODE_IS_STATIC to disable fall back if parent node fails
    #define MY_PARENT_NODE_ID 0

  • @nagelc

    good point, have to try. Actually I now have one repeater, but can remove it or maybe move it even closer and use that as static.

  • Hardware Contributor

    You also have the MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS, which is set by default to 10s. It means before going to sleep it will keep the radio on for 10 consecutive seconds, which will obviously hit the battery, you can shorten this interval.

    Also, you can set a static parent node ID with MY_PARENT_NODE_IS_STATIC (and MY_PARENT_NODE_ID), this will avoid the search for a "better" parent. You can set the parent node ID to the ID of your repeater if you use one.

    And if you don't care at whether your value has arrived or not, then you can configure your node as a passive node with MY_PASSIVE_NODE: it will only send the message and never listen to anything. No ACKs, no possibility of OTA and it also seems (if I believe the comments in the config file) no signing.

  • I tried all the options and maybe got a bit better battery life. However I have now found out, that the actual problem is not likely radio connection after all, but I2C related problem. Started getting more of random drops and after adding some more debug stuff I finally found, that it sometimes get stuck in HTU21 driver, that had a forever loop if there was no proper response. The driver code has later been modified (Adafruit) to avoid this loop. I had my own async version of it, which had the same bug (same code, but split into start() and read() to avoid the delay saving run time).

    So likely this random dead battery issue was forever loop draining the battery. Have no idea why it sometimes rebooted by itself, recently it has just died and after reset (battery off and back on) the battery is more or less empty.

Log in to reply

Suggested Topics

  • 7
  • 16
  • 6
  • 9
  • 8
  • 6
  • 2
  • 7