Battery level for TLORA_V2_1_16 board

I have this board “T3 V1.6.1 20210104” and flashed it with fw: tlora-v2-1-1.6 build 1.2.52
Works fine. I connected a user button on IO-pin 12 so scrolling works as expected.
Only … the battery voltage is not as expected, it actually is showing 10% too low and the battery level never comes above 3.82V & 60% while the battery itself measures 4.2 volt.

Compiling the sourcecode I had to add line 20 " default_envs = tlora-v2-1-1.6" in platformio.ini

I searched for a way to change the voltage divider but it seems that part of code is missing for this board ?

I wonder how I can adapt the code for changing the voltage divider for my board.

here there is some info on the battery level code: Heltec ESP32 only charging to 40% at 3.65V

there is a lot of refactoring going on to better organize the different devices and variations that might help.

1 Like

Thanks AndreK , that was very helpfull

I did a quick and dirty hack in the configuration.h file .
I copied this line from the helltec device :
// ratio of voltage divider = 3.20 (R1=100k, R2=220k)
#define ADC_MULTIPLIER 3.2

and inserted this line in the part for the (TLORA_V2_1_16) device
// ratio of voltage divider = 2 (R1=100k, R2=100k)
#define ADC_MULTIPLIER 2.2 // 2 + 10% correction for undervoltage

Now my display shows the right value within 1%, i am happy with that.

3 Likes

Confirmed here on the same board.
Maybe the voltage divider value could be set to a default value depending on build target (like now), but could also be overriden with a run-rime setting, in order to accommodate for the fast changing hardware details ?

1 Like

I have been thinking about a solution like that.

Hardware details can change and it looks like the voltage dividers for the same model vary from device to device,
So the best option i.m.h.o. would be a user definable compensation variable.

In the web interface that can finetune the ADC_MULTIPLIER in percent-points.
For the CLI it may be a command like meshtastic --set battery_compensation nn
Where the user can calculated this factor by measuring the battery divided by the reading on the display * 100 or when user has no mulimeter he must charge the battery for 24h or so and assume it is 4.17 Volt , then read the display voltage and calculate the factor.

1 Like