machine.idle()
-
I am trying to get a LoPy into a low power mode using machine.idle() but not getting any results.
The Lopy is on a breadboard. It is powered from a bench supply at 5V via a multimeter measuring current, and the only thing connected to it is a FTDI cable for comms. Both boot.py and main.py are blank so it is a minimal system.
Once at the repl prompt I am drawing about 95mA.
If I try machine.idle() I see no difference, still 95mA.The documentation for machine.idle() suggests there may be a system timer interrupt every millisecond. I assume this is true, so try:
while True:
machine.idle()
but my current draw rises to 106mA.Am I doing something wrong?
Is there any example code of how to use machine.idle() so I can actually see a decrease in current draw?
What figures should I expect?
I have also tried disabling the wifi radio with no effect.uos.uname gives:
(sysname='LoPy', nodename='LoPy', release='1.11.0.b1', version='2ac6da2 on 2017-12-18', machine='LoPy with ESP32', lorawan='1.0.0')
-
@jmarcelino
I am trying to put Lopy4 in low power mode, switching off wifi but without success.
when i call wlan.deinit(), i receive a sort of reboot such as:Guru Meditation Error: Core 0 panic'ed (StoreProhibited). Exception was unhandled.
Core 0 register dump:....
================= CORE DUMP END =================
Rebooting...what could be the reason?
-
OK. Thanks for your help.
-
@theozed
All current Pycom devices
-
Thanks. I must have made a mistake when originally trying to turn off the wifi radio. No I draw about 37mA with the wifi off.
When you say machine.idle() doesn't reduce power on this platform, what do mean by platform? All Pycom devices, or just LoPy devices?
-
@theozed
machine.idle() doesn’t currently reduce power draw on this platform.However disabling WLAN will make a big difference, make sure you’re using the WLAN.deinit() function:
from network import WLAN
wlan = WLAN()
wlan.denit()