2.7.1 BATTERY_EVENT code problem?

I've obtained the proper millivolts from my regulator and GCS is reporting a full battery (even when plugging in a drained one).  When I connect everything up my battery always reports full regardless of it's real value.  I tried adding a divisor of 10000 into the code in the GCS_Standard_Text (Serial.print(battery_voltage/100000,DEC);  //added the divide symbol and numbers after it) and that decreased my reported battery level.  But it was still not reporting the level properly.  Any ideas or suggestions?

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

Join diydrones

Email me when people reply –


  • This is the rational on the calculation:

    12v = 10 in scale (full charged)
    9v = 0 in scale (minimum voltage)


    The range of 0 to 3 volts variation in the battery should be a range of 1 to 10 in the scale...we should need a conversion factor.

    3volts units ---- 10scale
    1volt unit ---- x

    x = 10/3 = 0.33 (this is the voltage to scale conversion factor)

    the formula then is : (battery_voltage - minimal_voltage) / factor

    Hope that clears the calculation and does not bring more confusion.

  • Hi BriFly,

    I think I have a solution for you that I did and worked for me.
    The GCS displays values from 1 to 10 and not the voltage of the battery, so I've changed the way Ardupilot sends the voltage information to the GCS, calculating a proportion of the voltage (milivolts) resulting in 1 to 10.
    Note the code below:


    This is for 11.1v Lipo batery - 3cells (considering that the minimum voltage is 3v per cel), but you can change the calculation to match your battery voltage if it's different.

    It will output a range from 1 to 10 showing the percentage of remaining battery in the batery gauge bar of GCS...

    This domain may be for sale!
  • 3D Robotics
    Sounds like a bug. We'll be releasing a new GCS with the public beta of APM in a week or so, so let's see if it's in there and we can fix then if so.
This reply was deleted.


Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21