Pidog - Reading battery voltage is 5.1 V

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
>>>

Then why I get this value?

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?


image (41)

Hi, thank you for checking that. Yes, my direct measurement of battery confirms 7.9 (almost 8V) - but python method call says 5.35V


Are you having trouble running the Python example using Putty? Is there any error message?

Please provide a screenshot of the error message so we can analyze and resolve the issue.

We do not recommend using Thonny to run the example code. Thonny does not have superuser privileges, and our code needs to be executed with sudo.

Thonny cannot add sudo to execute the code.

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.


Yes. One side of R6 is 8.05 V and the other side of R6 is 2.69 V

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.

Yes correct.

I once did reinstall the libraries to be sure but I will do it again. It could be something in software level. Thank you