ESP32-H2-DevKit-Lipo - Battery measures

Started by lmerckx, October 12, 2025, 07:27:57 PM

Previous topic - Next topic

lmerckx

Hello,

I have the Olimex ESP32-H2-DevKit-Lipo and a battery 3.7V 1400mAh (JA-803450P) and try to measure the voltage of the battery to compute the percentage of the battery but I receive strange results.

I soldered jumpers BAT_SENSE_E and PWR_SENSE_E1 as explained in the manual and tried the example code to read pins 25 (POWER_SENSE) and 2 (BATTERY).

It works perfectly for the POWER_SENSE: testing with USB connection or battery only, it returns me the expected result.
But I have issues when trying to read the battery voltage.
- when connecting USB only: I always receive the analog value 652 or 653 (so 3716.40 mV or 3722,10 mV after multiplying by 5.7).
- when connecting both USB and battery: most of the time, I receive the same value but once on 10 measures I receive another value: 667 or 668 (so 3801.90 mV or 3807.60 mV). -> I suppose this to be the real measure of the battery because the value slightly increase with time.
- when connecting with battery only: again, I think I receive only the value 652 or 653. To be honest, I'm still not sure of that because I don't have the serial connection to debug and must rely only on my Zigbee report.

Is it the normal behavior of the pin ? I check my solder twice with multimeter and it seems quite good.
Any idea ?

Thanks in advance.

LubOlimex

Seems fine to me. It just takes a lot of time to fully charge and discharge. The board is set to charge with only 100mA. Let it charge for a couple of hours and compare the value again. The JA-803450P should go up to 4.2V when fully charged. Alternatively let your software run only on battery and check the progress without connecting the USB to it.
Technical support and documentation manager at Olimex

lmerckx

Thanks for the answer.
I will try a longer charge and check values.

Thanks.

LubOlimex

Notice that when you have both USB and a battery attached, the battery measurement will not be correct, it will be influenced by the battery charger. The battery measurement is only correct when there is only battery powering the board. Hence it is helpful to utilize the External Power Sense and only measure the battery when there is no external power applied.
Technical support and documentation manager at Olimex