In a previous blog: https://www.element14.com/community/people/neilk/blog/2019/02/17/esp8266-power-consumption-further-studies I observed that the power consumed by the Wemos d1 mini during deep sleep was pretty negligible - about 22.7 mAh over a period of 100 hours, including the Serila-USB interface and the resistor chain used to connect the battery to the A/D converter. I concluded, therefore, that the majority of the power consumed was during the actual sketch execution and that anything that could be done to shorten the execution time should reduce power consumption.
I carried out several modifications, all of which seemed to be of benefit:
- Suppress all output to the IDE serial monitor
- Stop listening to the Server response - this was taking about 3.5 to 4 seconds
- Don't bother to start the Serial Interface
Before carrying out the above modifications, a long term test of power consumption showed that after about 90 hours, the battery voltage had fallen from about 4.1V to about 3.53V - just under 0.6V in total
Results of the Second Test
My wife and I will be flying out to Majorca tomorrow, for a week, so I decided to terminate the test early, in order to be able to report the results.. As can be seen from the chart, the results are very good:
In this second test, we can see that the battery voltage has fallen from about 3.98V to about 3.65V - a fall of about 0.33V, over a period of over 138 hours! This is a significant improvement over the performance before the sketch was optimised.
As before, there are a number of "glitches" visible in the graph. As I mentioned before, my test rig is a bit of a "rat's nest" and is easily disturbed. The presence of extra "layers" of connections in the battery cables is almost certainly a problem. I am pleased to report that 2.54mm connectors for the battery have arrived today!
The chart has a horizontal axis of 360 readings per label - a nominal 6 hours. It is quite easy to see that there is a positive inaccuracy in the sleep time, as the time stamp advances by something over 3 minutes for every 360 readings.
There is also an indication that the size of the error may also vary with temperature - it is possible to detect a discrepancy between the error during the day (warmer) and the error during the night (colder). Whilst this test has been running, the typical temperature difference in my office, between day and night, has been around 8 degC. The lowest temperature being recorded at around 6am, just before the heating system kicks in. I have also observed similar, temperature related changes in the WItty device I am investigating.
However, taking into consideration my application, a precise time interval between readings is not important - although it is relevant to know precisely when the readings are taken
When I get to the point of releasing my system into the wild - ie one of my greenhouses - I will be taking readings at 5 minute intervals. This should give me a battery life of at least 690 hours, or over 28 days.