I have one, it’s an HT7333, I didn’t show it on the shemat, that’s it.
I set the flag to (VDD) for the VDD pin of rack2172
I run a quick test with the equipment I have
WisBlock Base Board RAK19007
WisBlock Core module RAK3382
This provides a regulated 3.3V for the RAK3372 (RAK3172) and has the same resistor network on Ain0.
I am getting a 0.2V difference between voltage measured at the battery connector and the reported voltage over LoRaWAN packet. My application is using api.system.bat.read().
I am not sure why it doesn’t work on your setup.
Thank you for your help, if your assembly is equivalent to mine, then this is probably due to an ancillary problem, I will redo a PCB with the minimum of components and see if it still works, thank you.
Here is my solution:
V_BAT connected to PB4/ADC 2
Source code:
uint16_t getBatteryLevel()
{
//430 =3v, 395= 2.15v
int16_t percent = map(analogRead(adcBatteryPin), 430, 395, 100, 0);
if(percent < 0)
{
return 0;
}
if(percent > 100)
{
return 100;
}
return percent;
}
hello ,I will modify the wiring of the rak for testing yours, but a strange thing happened twice, I wanted to measure the consumption in standby mode, it completely blocks the rak, I don’t dare try it anymore, because it has to be reflashed with Cubeprogrammer??? I mean measuring manually with a multimeter.
Hello! Can you please help with one issue with ultra-low ADC resolution on voltage?
I have following schematic:
V_BAT connected to PB4.
When I measure ADC on PB4 with 3.4v and 2.9v the difference only 11 points:
It looks like something wrong, but I am not sure what exactly.
Appreciate any ideas. Thank you!
Your problem might be related to a (strange) limitation of the ADC input of the STM32WLE5 MCU itself.
The analog inputs work only reliable with a external input impedance of 50kOhm:
STM32WLE5 datasheet:
RUI3 function api.system.bat.get() is applying some calculations to get the 1M/1.5M resistor divider to work but limits the accuracy.