Reading Battery Voltage internally

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
mikruth
Posts: 19
Joined: Wed Jan 11, 2017 6:00 pm

Reading Battery Voltage internally

Post by mikruth » Mon Jan 16, 2017 12:51 pm

I am running some ESP's on batteries. Is there any way to read battery voltage like I can in Arduino...

ADC_MODE(ADC_VCC)
ESP.getVcc()

or will I have to read the voltage via a resistor divider on the ADC pin?

shaoziyang
Posts: 363
Joined: Sun Apr 17, 2016 1:55 pm

Re: Reading Battery Voltage internally

Post by shaoziyang » Mon Jan 16, 2017 1:30 pm

mikruth wrote:I am running some ESP's on batteries. Is there any way to read battery voltage like I can in Arduino...

ADC_MODE(ADC_VCC)
ESP.getVcc()

or will I have to read the voltage via a resistor divider on the ADC pin?
ESP8266 has one adc pin, but it can't read internal voltage.

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: Reading Battery Voltage internally

Post by deshipu » Mon Jan 16, 2017 2:11 pm

The ESP8266 hardware can do it, however, this has to be enabled at the time of compiling the firmware/flashing, and MicroPython doesn't have support for it.

mikruth
Posts: 19
Joined: Wed Jan 11, 2017 6:00 pm

Re: Reading Battery Voltage internally

Post by mikruth » Mon Jan 16, 2017 2:55 pm

Thanks for that. I will just have to use resistors.

Post Reply