ItsyBitsy 32u4 - Determine Power Source

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Wellcore430
 
Posts: 2
Joined: Mon May 02, 2022 5:44 pm

ItsyBitsy 32u4 - Determine Power Source

Post by Wellcore430 »

Hello, We are using the 32u4 5V board. Is there any way to determine if it is being powered by USB or Battery? It is important that we know the power source for the board when it is running.

Thanks!

User avatar
dastels
 
Posts: 15656
Joined: Tue Oct 20, 2015 3:22 pm

Re: ItsyBitsy 32u4 - Determine Power Source

Post by dastels »

You could add a voltage divider to Vbus and monitor it using an analog input. If there's 5v on it, USB is connected and is powering the board.

100K resistor with one end connected to Vbus, another with one end connected to ground. Connect the free ends together and to an analog input. If the reading is relatively high, USB is powering the board. Relatively high will be roughly ta half of the input value range. Since the 23u4 has 10-bit ADCs that'll be close to 512. Don't go too close because the resistors won't be exact. The best thing to do is code up a script to read it and output the result. Switch between USB and battery and see what values you get.

Dave

User avatar
Wellcore430
 
Posts: 2
Joined: Mon May 02, 2022 5:44 pm

Re: ItsyBitsy 32u4 - Determine Power Source

Post by Wellcore430 »

Thanks for your helpful suggestion, Dave,

We will give it a try!

Locked
Please be positive and constructive with your questions and comments.

Return to “Itsy Bitsy Boards”