Power Reduction Question

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
JimTal001
Posts: 176
Joined: Thu Jul 30, 2015 4:59 pm

Power Reduction Question

Post by JimTal001 » Tue Oct 06, 2015 12:05 am

I am using the suspend() method and I have several switch and LED (as shown below) which are used as a sort-of interrupt. For example, if the user wants to know the status of the battery they can move the switch to the ON position and once the pyboard wakes from suspend() it responds with a green or red light showing the status of the battery.

Problem: I've noted an increase in power each time I add another switch or LED (even if the switch/LED is not activated).

My question: Is there a way to reduce power during the suspend/sleep period for this configuration using a mosfet or via code?

Code: Select all

LED_1 = pyb.Pin('X5', pyb.Pin.OUT_PP, pull=pyb.Pin.PULL_UP)
Switch_1 = pyb.Pin('Y9', pyb.Pin.IN, pull=pyb.Pin.PULL_UP)
...
if(Switch_1.value() == 0): 
	# do somthing


Image

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

Re: Power Reduction Question

Post by pythoncoder » Tue Oct 06, 2015 8:37 am

Are you using pyb.standby() or pyb.stop()? If standby I'd be puzzled by this: in my testing and reading of the device datasheet, after pyb.standby() the pins go high impedance.

However in stop() (as I understand it) they don't. You could try changing them to inputs with no pullup before entering stop(), then setting them back again on return.
Peter Hinch
Index to my micropython libraries.

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

Re: Power Reduction Question

Post by JimTal001 » Tue Oct 06, 2015 1:54 pm

I'm using pyb.standby() not stop().

I discovered that one of my LED was slightly glowing in standby mode (while sleeping). By changing the LED pin from X10 to Y1 the issue went away.

change from:
GRN_Data_Led = pyb.Pin('X10', pyb.Pin.OUT_PP, pull=pyb.Pin.PULL_UP)
change to:
GRN_Data_Led = pyb.Pin('Y1', pyb.Pin.OUT_PP, pull=pyb.Pin.PULL_UP)

Can this be explained?

blmorris
Posts: 348
Joined: Fri May 02, 2014 3:43 pm
Location: Massachusetts, USA

Re: Power Reduction Question

Post by blmorris » Tue Oct 06, 2015 2:50 pm

Somehow the weak pull-up was remaining active on X10 in standby mode, so it wasn't truly going high-impedance. No idea at this point why this would happen for X10 but not Y1.
Side note- this is also the reason why the pyboard LEDs are faintly lit in DFU mode.
If you have a situation where there is a pin that you must use for an LED and you are having this problem with a pull-up remaining active, another possible solution is to connect the other end of the LED to 3.3V and use the pin to sink current. This can work with either PP or Open Drain outputs.
-Bryan

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

Re: Power Reduction Question

Post by dhylands » Tue Oct 06, 2015 4:56 pm

X9, X10, Y9, and Y10 all have 4.7k pullups on the board since they're used for I2C.

So that would explain why the LED would light even when the processor pin is configured as an input.

Post Reply