[Microbit-Python] Detect if microbit powered by battery or usb

David Whale david at thinkingbinaries.com
Fri Jan 20 14:55:29 EST 2017


The KL26 interface processor is powered down when just on battery (hence
why the system LED is off on battery only). In order for the nRF51
application processor to send and receive serial data via USB, there are
TX/RX lines wired between the two processors.

You *might* be lucky and find that the RX in to the nRF51 is low when
powered just from battery, and high (marking) when powered from USB (and no
serial data is being sent to the micro:bit). I suppose it depends which way
the line floats.

So, you could try to do a port read of the RX pin on the nRF51 and see if
you can infer the power source from that.

You can get schematics for the micro:bit reference design here:

https://github.com/microbit-foundation/microbit-reference-design/blob/master/PDF/Schematic%20Print/Schematic%20Prints.PDF

P0.25 is the RX line at the nRF51 app processor end - so you could sample
the state of that raw pin and see if it differs when powered from USB or
from battery only.



On 20 January 2017 at 19:09, Matt Hickford <matt.hickford at gmail.com> wrote:

> Hi. Silly quesion: Is it possible to detect if my microbit is running on
> battery or powered by usb?
> -Matt
>
> _______________________________________________
> Microbit mailing list
> Microbit at python.org
> https://mail.python.org/mailman/listinfo/microbit
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/microbit/attachments/20170120/25e142da/attachment.html>


More information about the Microbit mailing list