Can the ADC actually read A0 Battery Voltage on the C6?
Dan.Levin 2026-03-10 01:19:09 548 Views4 Replies I am having trouble reading the battery voltage using Esphome on a Firebeetle ESP32-C6 V1.0 board. I found a forum posting on the Esphome community that suggests that the 1M ohm resisters used in the on board voltage divider are too high impedance for the ESP32 ADC to read correctly, and that they need to be replaced with 100k ohm resisters.
Has the ability of the onboard ADC to measure ADC_BAT been tested and verified to operate properly?
Dear DFRobot technical support,
I have bought several FireBeetle2 ESP32-C6 IoT Development Board for my new product design. I hope it will become the base board of my new product.
Today, I planned to use your example codes to measurement a Li+ Poly battery's voltage.
https://wiki.dfrobot.com/dfr1075/docs/17359
The result is a total failure. I didn't even connect any battery to it and it shew a battery voltage. Please advice.
ADC analog value = 2102
ADC millivolts value = 2108 mV
Battery millivolts value = 4216 mV
--------------
ADC analog value = 2097
ADC millivolts value = 2104 mV
Battery millivolts value = 4208 mV
--------------
ADC analog value = 2102
ADC millivolts value = 2111 mV
Battery millivolts value = 4222 mV
HKPhysicist Hi, the ~4200mV reading without a Li-Po battery is normal for FireBeetle2 ESP32-C6:
The CN3165 charging chip outputs a 4.2V open-circuit voltage when only USB-powered.Connect a battery, and it will display the real voltage.1. Function & Usage
The board supports battery voltage measurement via ADC_BAT. Please refer to our Wiki for the voltage calculation code.
Battery Voltage Measurement Code for FireBeetle 2 ESP32-C6 | DFRobot Wiki
The 1MΩ+1MΩ voltage divider is designed for rough battery level estimation, optimized for ultra-low power consumption, so some measurement error is expected.
2. Power vs. Accuracy Trade-off
Replacing R15/R16 with lower-value resistors improves accuracy, but will increase sleep power consumption.

3. Suggestions for Better Accuracy
• Hardware: Use smaller resistors
• Software : Extend sampling interval (≥2s), enable filtering and ADC calibration, and use averaged readings.
4. Note
This is a deliberate trade-off between power consumption and accuracy, not a design flaw. It is ideal for low-power IoT applications, and you can adjust hardware/software for higher precision as needed.
niu.yixuan Ok, fair enough. To document the situation then for future users, here is what I believe to be true about the ability on ESPHome to monitor battery voltage / fuel gauge on the Fire beetle ESP32-C6, and to use the onboard charger to charge a 3.7 volt Li-ion battery connected to the battery connector. I hope others find this useful.
1) The ADC_BAT signal, which is the battery input voltage on the battery connector, is available on AD0, which is mapped in ESPHome to GPIO0 - and passes through the onboard voltage divider before being presented on that pin.
2) The ADC_BAT voltage goes through an on-board 2:1 voltage divider, so the measured voltage at pin AD0 / GPIO0 is half the battery voltage. So use something like this:
sensor:
- platform: adc
pin: GPIO0
name: "Battery Voltage"
attenuation: 12db
update_interval: 10s
accuracy_decimals: 2
samples: 30
filters:
- multiply: 2.0 # The voltage divider requires us to multiply by 2
3) The onboard voltage divider uses 1M ohm resisters. That means that the measured voltage will not be extremely accurate, but it also means that the power loss during operation is very low. When using samples = 30 and attenuation = 12db, I get a pretty stable reading using ESPHome's built in ADC platform - but that reading is not accurate, it is low by about half a volt (maybe I am doing something wrong, but that is what I am seeing). When charging with 5 volts from USB for example, I read 4.88 volts on the battery, but the ADC reports 4.21 volts.
4) Beware that the battery connector on the board has reverse polarity from many common battery cables, such as those commonly available on Amazon. Take care to verify that you have your battery polarity correct before plugging in your battery.
5) The onboard battery charger will operate from any source of power connected to the VCC and GND pins on the board - OR from the USB port. The only requirement is that the provided voltage be at least 60 mv over the battery voltage and less than the charger's max input voltage of 6 volts. Use a 5 volt solar panel delivering up to 1A of current.
6) While Platform.io does not include a board config for this board, PIOArduino does, and since 2024.12.0 ESPHome has been using PIOArduino under the covers. The following configuration works correctly, even though it does not appear on the official ESPHome board list (which should be updated, but has not been as of 3/9/2026).
esp32:
board: dfrobot_firebeetle2_esp32c6
variant: ESP32C6
framework:
type: esp-idf

