General

ESP32 C6 - battery voltage

userHead iisfaq 2024-03-14 12:00:30 198 Views2 Replies

Following the tutorial for ESP32-C6 at https://wiki.dfrobot.com/SKU_DFR1075_FireBeetle_2_Board_ESP32_C6_Basic_Tutorial#target_1

 

My question is this:

 

With no other components and it connected via USB C from my computer.

 


17:02:11.805 -> --------------

17:02:12.318 -> ADC analog value = 2080

17:02:12.318 -> ADC millivolts value = 2107

17:02:12.318 -> mV

17:02:12.318 -> BAT millivolts value = 5470.63mV

 

I get this basically. Is this correct?

 

The source code mentions Please adjust the calculation coefficient according to the actual measurement.  

 

Serial.print("BAT millivolts value = ");  

Serial.print(analogVolts * 2.1218 + 1000);  

Serial.println("mV");

 

But how do I know how to adjust it?  I do not know what * 2.1218 + 1000 means to start with?

 

2024-03-14 15:49:32

Your battery is charging if the Charge indicator is always on.

 

 

 

As for "analogueVolts * 2.1218 + 1000", you can consider it as a conversion formula. Since the ESP32 has a pin tolerance of 3.3V, and most batteries are above 3.3V, the FireBeetle2 is designed with a voltage divider resistor on top.
This resistor is what converts the ADC value to the real battery value.

 

Theoretically as long as you are using a 3.7V Lipo (with a charge cut-off voltage of 4.2V). The voltage calculated by this formula won't vary much.

If there is a big difference you will have to modify the formula yourself. You can derive your own formula from the actual voltage value measured by the multimeter.
The schematic diagram is labelled with the resistance value of the voltage divider, so you can draw a simple circuit diagram to calculate it yourself.

userHeadPic Yeez_B
2024-03-14 12:26:55

So I plugged a battery into the ESP32-C6 (I assume it is dead flat as it only arrived in the mail today) and connected the ESP32-C6 via USB to the computer and it now reads 2264.59mV or there abouts.

 

Will this charge the battery? or does it actually need a solar panel?

 

Chris

 

 

 

 

userHeadPic iisfaq