LiFePO4 and ESP-Now
As a follow up on the 19+ Months battery lifetime, a few small updates:
As mentioned in the last blog post I have been trying out some 18650 LiFePO4 batteries. This battery seems to be a good alternative, the voltage is perfect for powering an ESP.
- The output voltage is around 3.2V, perfect for the ESP, it keeps this for a long time during the discharge curve.
- The max charging voltage (3.65V) is still close to the max that the ESP takes (3.6V).
So I setup an experiment with a wemos D1 that wake up, connect to wifi and send battery voltage every 5 minutes. The wemos takes +- 60uA when in sleep. No voltage regulator or anything was added.
The results are not very positive, I had a 1800mAh cell. It seems to provide around 1400mAh in practice. The battery lifetime i got was less then 2 months. The uptime for each sample was around 4.25 seconds. This result was surprising, given I lasted 19 months on a 3400mAh li-ion battery with a LDO (sampling every 15 minutes). I would have expected a little bit longer. I still need to look into this (e.g. what is the self-discharge rate of this battery?), anybody has measurements for his?
Clearly one of the problems is the time the esp is awake while it is sampling the sensor and sending the data. I started logging this for several of my sensors and the result where interesting, It basically varied between 1 and 6 seconds depending on the sensor attached and the location relative to the AP.
For this purpose I started to look around for alternatives, without having to replace the hardware. So I wound up looking at ESP-Now.
ESP-NOW is a kind of connectionless Wi-Fi communication protocol that is defined by Espressif. In ESP-NOW, application data is encapsulated in a vendor-specific action frame and then transmitted from one Wi-Fi device to another without connection. CTR with CBC-MAC Protocol(CCMP) is used to protect the action frame for security. ESP-NOW is widely used in smart light, remote controlling, sensor, etc.
This seems it would drastically reduce the time the sensor needs to spend connecting and talking over the wifi. So I setup a quick experiment where I made a ESP-Now to Serial bridge as target and setup another ESP to wake-up and send a json to the slave (it needs to be less then 250bytes, but this is no problem). Some first experiments show this reduced the wake-up time significantly. The same sensor as above (wake up, sample battery and send data) took 37ms to reach the transmit state. Scoping the current usage showed the whole esp went back to sleep after +- 68ms. This is a significant improvement. Setting up a sensor that includes sampling a BME280 took around 570ms to reach transmit state (so around 600ms being awake). The gain here is less, but still an improvement.
A nice experiment to do is to measure the consumption over 1 hour, but I currently do not have the equipment that can do this accurately given the low current when sleeping (60uA) and the high peaks (200mA?). Once lockdowns are over, I can do these experiments. I am very curious about the results.
With a small supercap (for the peaks) I am now able to power the sensors from a ER14250 battery. I have a box full of these batteries, so would be nice if they can be used.
I had a weird situation with the bridge, I used a wemos pro, with an external antenna. When I mounted a nice 2.4GHz +6dB antenna, the range dropped severely and I had many missed packages. Downgrading the antenna made it reliable again. Curious what is wrong (mistuned antenna? will check).comments powered by Disqus