Hi,
I am running a few experiments on power consumption on an Arduino Portenta H7 + Vision Shield (LoRa) and I’ve been recording 9 mA current draw on machine.lightsleep()
and 14 mA draw on machine.deepsleep()
.
Shouldn’t machine.deepsleep()
draw lesser current?
PC
The board is not optimized for low-power. We can achieve 30uA on the RT1062.
To get super low numbers every component and many design decisions have to be made to get them this low.
As for the numbers being inverted… @iabdalkader may wish to take a look.
I see…
I have tried a few things following suggestions here- (Nicla Vision - deep sleep after accessing camera sensor - Arduino Boards - OpenMV Forums) but nothing really significantly reduces the draw in Portenta. I maybe now understand why.
My system basically sits idle until motion is detected (PIR sensor), and ExtInt()
+ machine.lightsleep(
) seems like a good option for a quick recovery to power.
I wanted to try sensor.sleep()
and see if I can further improve, but am getting OSError: Sleep Failed
PC
I just remembered this, the power consumption should be a lot lower when you power it via the battery terminals. So, the only way to measure this really is via a current meter monitoring VBAT input, and no other voltage supplies applied.
2 Likes
I’ve considered this option in the past but realised it’s easier to power the device via VIN on a PCB board compared to VBAT. If lightsleep mode can bring the power down to ~10 mA, I think my application’s field time will increase considerably, which is good enough for now.
PS I used to assume powering from VIN or USB should be the same but I was mistaken. I am reading 20.2 mA in lightsleep() on my USB powermeter; almost double the current when using VIN.
Thanks for the help!
PC
It’s unfortunate. The RT1062 with the PIR shield achieves <40uA draw and wakeup on motion. Works right out the box.
2 Likes
Can I not use machine.lightsleep()
with ExtInt()
and machine.lightsleep(time_ms)
in the same program? Seems to me the former is overriding the latter when I do.
import machine, pyb
# Callback for ExtInT
def cb():
pass
# ExtInt()
pin = pyb.Pin("D6", pyb.Pin.IN, pyb.Pin.PULL_DOWN)
ext = pyb.ExtInt(pin, pyb.ExtInt.IRQ_FALLING, pyb.pin.PULL_DOWN, cb)
# Function called in main loop
def body():
machine.lightsleep(10*60*1000)
# Main loop
while True:
pyb.delay(5000)
machine.lightsleep()
body()
While I expect the Portenta to go to sleep for 10 min after waking up, it does not. Am I doing something wrong?
PC
So, this program kina works:
import machine, pyb
from pyb import LED
red_led = LED(1)
green_led = LED(2)
blue_led = LED(3)
# Callback for ExtInT
def cb():
pass
# ExtInt()
pin = pyb.Pin("D6", pyb.Pin.IN, pyb.Pin.PULL_DOWN)
ext = pyb.ExtInt(pin, pyb.ExtInt.IRQ_FALLING, pyb.Pin.PULL_DOWN, cb)
# Function called in main loop
def body():
machine.lightsleep(10*60*1000)
green_led.on()
# Main loop
while True:
blue_led.on()
pyb.delay(1000)
machine.lightsleep()
blue_led.off()
pyb.delay(1000)
red_led.on()
pyb.delay(1000)
red_led.off()
machine.lightsleep(10000)
However, once triggered the first lightsleep appears to wakeup on a timer now and not a rising interrupt.
Can you report this bug to Arduino? They can then assign it to us as billable hours.
You need to report it to Arduino.
Issue reported to MicroPython. Thanks!
Deepsleep only works on the Nicla vision, as requested by Arduino. Back when I was working on this, they were only interested in low-power modes on the Nicla. As Kwabena mentioned, you can reach out to Arduino and see if they’re interested in fixing it, they’ll assign me or someone else to do it. Note that it could take time and it might be harder to get right on the Portenta due to external shields that could draw extra current or keep it from entering deepsleep at all.
Hi @iabdalkader, thanks for confirming the issue. I’ll raise the issue with Arduino; although I’ve had little success doing that lately due to some issue in their contact form:
PC