Is it possible to determine if a Wemos D32 is being powered by battery or USB?

I would like to be able to determine, programmatically, if my D32 is currently running via the battery or if it's plugged in (i.e. USB powered). This way I can operate differently when the device has USB power (e.g. more frequent updates, not entering deep sleep, etc).

Does anyone know if this is possible?

use voltage divider from both power source to appropriate pins. not necessary analog input.

All you need to know is if VBUS is present or not
Use this circuit:
vbus

1 Like

Thank you!

Just to be clear, if VBUS is present then it is running from the USB input, if VBUS is not present then it is running off the battery.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.