low power support?

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.
Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: low power support?

Post by Damien » Wed Apr 29, 2015 8:33 am

moose wrote:Is there any way to reduce the amount of time and/or current required to come out of pyb.standby()? I ran a do-nothing program to determine how much current (actually, charge) is consumed during the bootup after pyb.standby():
Nice plots!

I didn't yet get to this stage, checking the dynamic power consumption as it turns on and off. I was more concerned about trying to get as low as possible in the stop() and standby() modes first.

The main thing contributing to a long startup is waiting for the RTC to initialise. There are definitely optimisations that can be done in this respect, and in other parts of the boot process.

It would be easy to not flash the green LED when waking from a standby() and I think that's a good thing to implement.

One other thing is to reduce the frequency of the main clock, but unfortunately on waking from standby() it will be reset to 168MHz. This could also be fixed by saving the freq settings and restoring them on wakeup.

Anyway, there's heaps that can be done to improve the startup consumption.

moose
Posts: 9
Joined: Fri Apr 17, 2015 4:22 pm
Location: Anchorage, Alaska
Contact:

Re: low power support?

Post by moose » Wed Apr 29, 2015 3:28 pm

@manitou: I powered the pyboard from Vin and Gnd, which made it easier to put a 1 ohm resistor in series with the Vin lead. I then used my PC scope (PicoScope 2205) to measure the voltage across that current sense resistor--1 mV equals 1 mA of current. It is important that scope ground is isolated from the pyboard power supply ground. Powering from a battery will work, or in my case, my desktop power supply has isolated outputs. Make sure the USB cable to the PC is disconnected to eliminate grounding issues.

Alternatively, you may be able to put the current sense resistor in the ground lead of the pyboard and avoid grounding issues.

The sleep current is very small and not easily measurable by the above technique. Instead, I just used a digital multimeter in series with Vin to measure that. My program stays asleep for 2 seconds, so there is plenty of time to get a stable multimeter reading.

manitou
Posts: 73
Joined: Wed Feb 25, 2015 12:15 am

Re: low power support?

Post by manitou » Thu Apr 30, 2015 12:57 pm

I get 29ua in standby mode on my pyboard IF the microSD card is not inserted. if I insert the microSD card, the current climbs to 190ua. Is this from the quiescent current of a microSD card? I assume the media sense switch on PA8 (in PULLUP mode) is disabled (not drawing current) in standby. if i remove the microSD card, current drops back to 29ua

I tried a SANS 8 GB and 16GB microSD card, and the behavior was the same.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: low power support?

Post by dhylands » Thu Apr 30, 2015 2:51 pm

Even though the MCU went into standby, the sdcard doesn't know that and it will still continue to draw current.

I'm not familiar enough with the scard spec to know if there is a command you can send to the sdcard to tell it to go into some low power mode.

Otherwise, I think you'd need to stick a FET in the VDD line going to the card.

The NetDuino Plus 2 board (which uses the same processor as the pyboard) allows sdcard power to be switched off using a FET.

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: low power support?

Post by Damien » Thu Apr 30, 2015 8:24 pm

I think 190uA for the SD card is already its minimum, and, as @dhylands says, you'll need to actually disable power to the card to eliminate this.

The pyboard supports external SD cards in SPI mode: wire up a connector in SPI mode to one of the SPI ports and use https://github.com/micropython/micropyt ... /sdcard.py . Then you can put your own FET inline with the VDD of the SD card and control its power using a Pin. You'll probably need to unmount the filesystem before entering standby() mode.

manitou
Posts: 73
Joined: Wed Feb 25, 2015 12:15 am

Re: low power support?

Post by manitou » Thu May 07, 2015 8:31 pm

Using a standalone SD breakout board, I confirmed quiescent SD currents of 100ua (varies depending on make and mode of SD or microSD) ....
The pyboard supports external SD cards in SPI mode:
I must be having a senior moment, I tried to get the SPI SD driver to work using hint in firmware source drivers/sdcard.c

Code: Select all

    import pyb, sdcard, os
    sd = sdcard.SDCard(pyb.SPI(1), pyb.Pin.board.X5)
    pyb.mount(sd, '/sd2')
    os.listdir('/')

the import fails, no module named sdcard .... i'm running Micro Python v1.4.2-48-g6f218d7-dirty

is there documentation/examples for using SPI SD driver ??

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: low power support?

Post by dhylands » Thu May 07, 2015 8:54 pm

You need to copy sdcard.py from here:
https://github.com/micropython/micropyt ... /sdcard.py

onto your pyboard (in either the root directory or a directory called lib)

manitou
Posts: 73
Joined: Wed Feb 25, 2015 12:15 am

Re: low power support?

Post by manitou » Thu May 07, 2015 9:00 pm

dang, I keep forgetting all things in firmware directory are not in firmware ....
copied sdcard.py, and things are better ... working on OSError: no SD card

Edit: I get the "no SD card" the first time i do
>>> sd = sdcard.SDCard(pyb.SPI(1), pyb.Pin.board.X5)
if i do that again, then it works and i can mount /sd2 ... whatever



thanks

JimTal001
Posts: 176
Joined: Thu Jul 30, 2015 4:59 pm

Re: low power support?

Post by JimTal001 » Thu Jul 30, 2015 6:06 pm

When you enter sleep mode using pyb.stop() does it affect the RTC in terms of keeping track of time?

Thanks

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: low power support?

Post by pythoncoder » Thu Aug 06, 2015 8:21 am

The RTC continues running after stop() and standby().
Peter Hinch
Index to my micropython libraries.

Post Reply