As described earlier, i designed and installed 2 ultrasonic distance sensors based on an ESP32 with a LoRa radio module. They are within reach of my LoRaWAN gateway, and connected to The Things Network.
I started my experiments in March/April 2022 and i had a bit of trouble with short battery life due to sub-optimal code: from time to time the sensors did not enter their deep sleep mode, and that depletes the battery in a matter of hours. I improved the code with a watchdog timer, and a general timeout (2 minutes) in case the LoRaWAN transmission does not succeed. Now both sensors have been running for 4 months continuously, without any intervention.
[Note: on 1 Aug we had an internet outage, the gateway was offline for a few days]
Node 1 (blue) is running on a pair of 18650 cells (harvested from an old laptop battery pack), and over 4 months went from 4.23V to 3.69V. With a nominal voltage of 3.7V, that would mean it discharged to 50% capacity. Sending interval is 10 minutes, payload is 4 bytes. SF7, average RSSI -100, SNR 7.5.
Node 2 (green) has been upgraded with a small solar cell (6V 80mm x 80mm), as it is further from the gateway and the battery was depleting faster. It has a single 18650 cell, with a TP4056 charger module, which is not designed for solar but works well with a 6V panel. The above graph shows that it charges the cell pretty well, it is at 4.19V currently, even if it is only receiving very little direct sunlight. Sending interval is 10 minutes, payload 4 bytes, SF7, airtime 51ms, average RSSI -106, SNR 6.
The battery voltage graph shows that from time to time, the sensors still go offline for a few hours, losing battery capacity. This seems to happen when the firmware does a reboot [ESP.restart()] after a set number of wake-ups. I do this reboot to make sure that the unit does a new LoRaWAN ‘join’ at a regular interval (once a day). But it seems this reboot gets stuck once in a while. This could be an ESP32 issue; the firmware was compiled using a relatively old ESP32-arduino core (1.0.4), i will try to update the nodes with the current core.