Get battery voltage from Wisblock

Hello, I am having trouble getting an accurate battery voltage reading from the RAK4630/RAK5005-O base.

I am using a 18650 size 3.7v li-ion battery (5000mAH) which is working beautifully for multiple solar-powered units in production.

Comparing readings from a multimeter across the battery while in the circuit, to the analog pin (WB_A0) I’m getting wildly different values.

  • When powered by USB, the multimeter reads 4.09VDC across the battery, the analog output raw value is 2688 (12-bit resolution).

  • In following code example from @beegee, this calculates the battery voltage to be 2688 * 1.2670898524 which equals 3.405V, which is not correct.

The battery should be fully charged around 4.2V and discharged at around 2.5 to 2.8V.

I’d appreciate any advice to calculate the accurate voltage.

Thanks

Hello @thegpx

Not sure how you measure, but it works for me.
I added the RAK1921, because I want to see whether the USB charging has an influence.

USB charging multimeter → WisBlock measurement 0.16V difference

Without USB, only battery supply multimeter → WisBlock measurement 0.05V difference