I have an adafruit feather 8266 powered by battery and connected to an USB solar charger. The chip goes into deep sleep to conserve battery.

However, I want to detect when the charger is connected and charging, so that I can disable the deep sleep.

What would be the best way to do so? I thought to connect a digital pin to the charging LED directly, but that sounded more like a dirty hack. Any other way that is more elegant?


  • How about connecting the charging voltage directly to a pin (or through a voltage divider if the voltage is too big)?
    – chrisl
    Sep 18 at 9:52
  • Problem is that the USB will have the battery voltage if no USB power is connected, so having a fully charged battery or a USB cable providing 5V is almost the same, unless I do some logic to measure the precise voltage and decide over that. Besides, I’m already using the AD pin. Would love to be able to use a digital pin without much effort.
    – otmezger
    Sep 18 at 15:31


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.