current used by pyboard

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
smhodge
Posts: 80
Joined: Tue Jan 22, 2019 2:16 am
Location: Kirkland, WA, USA

current used by pyboard

Post by smhodge » Wed Feb 05, 2020 4:03 am

The specs for the v1.1 board list 56 mA as the current consumption at 168 MHz as 56 mA running and 16 mA "idling". I have a simple test program that uses a timer interrupt every 250 ms to toggle one of the boards leds and waits for a pin to go low. My code is simply:

set up timer interrupt to flash led
set up pin interrupt
while (True):
check flag set by a pin interrupt
if set
do something
else
wfi()

The led flashes just fine, toggling every 250 ms. I know that the system wakes up every ms, but even so I would expect it to be mostly asleep most of the time. However, when I measure the current consumption is is a pretty steady around 75 mA. I can account for the extra because of some leds on the motherboard that are on, and a bunch of IC's not doing anything but still drawing a few mA. This is without doing anything with the external pin, so there is no power consumption there.

I would have expected the number to be down closer to the 16 mA level on average, as measured with a multimeter on the input power wire. Is "idling" what you get with wfi()? Is there something about wfi() I don't know?

Thanks.

User avatar
jimmo
Posts: 1845
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: current used by pyboard

Post by jimmo » Wed Feb 05, 2020 4:32 am

How are you measuring the current? How are you powering the pyboard? Can you provide the exact code you used to test this.

I just did a quick test -- I see 22mA at the REPL prompt (i.e. idle), and if I set up a timer to toggle the red LED every 1 second, it goes between 22mA (LED off) and 25mA (LED on). When I put it into a "while True: pass" loop, it's 60mA.

Code: Select all

import pyb, machine

def foo(t):
  pyb.LED(1).toggle()
t = machine.Timer(callback=foo, freq=1)

>>>
Note: my setup has the pyboard v1.1 powered directly from 3.3V supply, accessing the REPL over UART.

User avatar
Roberthh
Posts: 2141
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: current used by pyboard

Post by Roberthh » Wed Feb 05, 2020 8:15 am

Running from 5V, REPL through USB, PYB V1.1, I confirm @jimmo's values. at 168 MHz ~22mA idle, ~68mA in the busy loop. At 48 MHz it's 11mA.

smhodge
Posts: 80
Joined: Tue Jan 22, 2019 2:16 am
Location: Kirkland, WA, USA

Re: current used by pyboard

Post by smhodge » Wed Feb 05, 2020 8:26 pm

Well, I wrote another test program, one that does not repeatedly cycle a led on/off but only toggles it if the USR switch is pressed. That way when not pressed it is only waiting for an interrupt. I measure a steady 33 mA. If I subract out 3 motherboard leds, 13 mA total, I'm left with 20 mA, which agrees with what you are measuring, in fact a tad less. (The led draw is based on Vf spec and known input V and current-limiting resistor values, so I'm pretty confident in that, more or less.) At most there is another mA maximum for all the IC's sitting idle. It is still bigger than the spec of 16 mA for "idling" but maybe "idling" is not what wfi() is? At any rate, I'm ok with the results now. Thanks for your help.

BTW, a bonus of this was that when I toggle the pyboard led on, it draws a consistent 36 mA. I always wondered what those leds draw. Now I know, at least for the red one, namely 3 mA.

FYI, the test program was:

from pyb import Switch, LED, wfi
sw=Switch()
redLed=LED(1)
usrFlag = 0

def irqUsr():
global usrFlag
usrFlag = 1

sw.callback(irqUsr)

while True:
if usrFlag == 1:
redLed.toggle()
usrFlag = 0
wfi()

Post Reply