After fully charge the Robo HAT battery, I used
voltage = utils.get_battery_voltage()
but the voltage that i get in return in unexpected 5.12 V.
Both LED on Robot Hat is ON, so according to documentation:
2 LEDs on → Greater than 7.6V
Python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from robot_hat import utils
>>> print(utils.get_battery_voltage())
5.13010989010989
>>>
We conducted tests and verified that the voltage data read matches closely with the actual measured battery voltage. Could you use a multimeter to measure the battery voltage and see what it is?
Hi, I do not use Thonny. I use Windows Power Shell and use SSH to connect to Raspberry Pi and execute the commend. There are no errors. Its only wrong reading of Voltage. I get wrong value when run the code in python console or if i execute a script using sudo. In both cases I get wrong reading on battery voltage in compare to reality.
Please use a multimeter to measure the resistance of R6 on the robot hat. The two points represent the voltage divider for the battery resistance. One side measures the battery voltage, while the other side measures one-third of the battery voltage. Please analyze the measurement data for us. See the image.
What you mean is that the voltage on one side of R6 is 8.05 V, and on the other side, it’s 2.69 V. When measuring the battery terminal voltage, it is also around 8.05 V. The hardware measurements are consistent, but there is a discrepancy in the software voltage readings, correct?
Have you modified your code? Our testing software is functioning properly, as you can see from the screenshots we provided.
We recommend that you reinstall the system and then install all the library codes for the product. After that, check if the software voltage readings match the actual measurements.