To measure the current consumption of an esp32 platform:
* platforms lolin32 and sparkfun esp32 thing were used, both with a connector for a 1S lipo battery
* I did cut the red wire of a lipo battery, and connected a good milliAmpere meter in the circuit
* Connected the lipo battery to the circuit.
Now I am able to program the device, and check to program while connected to USB.
When in the correct state I disconnect the device from the USB and measure the power consumption via the LIPO battery.(without reset)
While keeping the reset button pressed
* sparkfun esp32 uses 4 mA
* lolin32 uses 0.45 mA.
The difference is caused due to the red light on the esp32 thing (+2mA) (wire can be cut to switch off the red led).
On the esp32 thing the usb2serial chip always is powered (3v3), while for the lolin32 the usb2serial chip is only powered when connected to the usb.
So for low power stuff, my advice: use the lolin32 board.
Next measures are only done on the lolin32 board.
1. No modules loaded (first statement in main.py:
Code: Select all
print("Loading module main ...")
import machine
led = machine.Pin(5, mode=machine.Pin.OUT)
print("Sleeping forever")
while True:
machine.idle()
if led.value() == 1:
led.value(0)
else:
led.value(1)
cpu 80Mhz: 25.8 mA cpu 240 Mhz: 40.2 mA
Thats really nice!
Next: import network
cpu 80 mhz: 99.0 mA (increase of 73.2 mA)
cpu 240 Mhz: 116.6 mA (increase of 76.4 mA)
Connected to an AP (no traffic) : cpu240 Mhz: 118.0 mA
wlan.disconnect() or wlan.active(False) has no change in power consumption.
So the main reason for the high current consumption is the network import, switching on the wifi stuff.
Reasonable, because wifi takes a lot of power.
For low power bluetooth 4.2 is much better!
At the moment it is not possible to switch off the network.
I hope that the esp_idf team (or micropython team) comes with a solution to be able to switch of network dynamically.
And implement the idle() and deepsleep() functions!
Thanks for the work done so far.