Need to scale down measured battery voltage?

I just set up my voltage divider and things are working ok, except the values reported are too high.


For example:

A fresh 3S pack gives me 14.2v instead of 12.6.


To compensate, I made the following edit to the code in sensors.h. My change is in red.

if(g.battery_monitoring == 1)
        battery_voltage = battery_voltage3 *.89 ; // set total battery voltage, for telemetry stream


Each input measured to ground shows 13.8K, 13.82K and 13.85K, which seems about right given the 10K+3.9K voltage divider.


Should I need to do this or have I borked something in my voltage divider?

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –


  • The problem you're experiencing stems from the fact that the reference for the A/D converter is Vcc. The calculation of battery_voltage assumes that Vcc = 5.0 volts. But it is not. On my board, when powered from the ESC/BEC, Vcc is actually 4.58 volts.

    You can fix this by adding the line...

    #define INPUT_VOLTAGE 4.58 // Vcc as measured during ESC/BEC power (not USB)

    in APM_config.h

    You can conveniently measure Vcc at the magnetometer port on the IMU shield.

    Note that Vcc will be about 4.79 when powered from the USB port, so you will get different readings when you use APM Terminal.

    The reason why Vcc does not equal 5.0 volts is the presence of a PTC fuse in the USB supply line and a PTC fuse plus a schottky diode in the supply line from the ESC/BEC input.
This reply was deleted.


Shivchand Jaysaval liked Shivchand Jaysaval's profile
Aug 25