I did some testing with the nodemcu lua firmware.
https://github.com/nodemcu/nodemcu-firmware
This is a handy scripting language for quick tests. Not sure I'd like to write a lot of code using it though. For one thing, I don't know lua, and also the upload process is a bit painful (I used this tool https://github.com/4refr0nt/luatool)
Anyway, I hacked a script to run at startup and do the following:
- Connect to my wifi
- Wait for valid IP
- log the boot time to thingspeak
- Sleep for 5 minutes
Now I can measure the time required to re-connect to wifi and send an http message after a boot.
Results are here https://thingspeak.com/channels/17374
(it's about 5 or 6 seconds)
So, I can re-do my earlier calculations:
- Sleep current: 50uA
- Wake current: 100mA
- Wake interval: 5 minutes
- Wake time: 6 seconds
Each hour, the device would be awake 12 times for 6 seconds at a time, (72 seconds or 0.02 hours) and asleep for the remainder of the time (0.998 hours). So average current consumption in any given hour is (100*0.02) + (0.05*0.998) = 2.05mA
So the 890mAh battery would last about 434 hours, or 18 days. That's not great, but better than my original estimates.
One issue still to resolve is the inconsistent sleep current. This varies from about 50uA to over 1mA!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Thanks for the estimations, I didn't know that deep sleep could save that much energy.
Are you sure? yes | no