Monitoring a second battery with the APM

Hi all,

I'm currently setting up the Ardupilot on a Skywalker, and as always I will use a separate battery for camera/OSD/VTx. I am flying with a 4S LiPo and am trying to avoid step down converters and filters.

Are there any plans to add monitoring of a second battery to the APM code? I have seen people mention that it will be implemented, but those posts are over 6 months old. I have also looked at the MinimOSD Extra source code and there are lines with "osd_vbat_B" commented out.

It shouldn't be that hard to implement, but if someone else has already started coding it it would be nice to know.

The obvious way to connect a second battery is through a voltage divider to a free analog input port on the APM.



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

Join diydrones

Email me when people reply –


  • Jonas, it makes a lot of sense to include vbat_B in mavlink and MP if it works OK (not too slow for octo+gimbal+simple, etc...). I didn't see any official request on github; maybe that will help push this through?

    I always carefully plan the power distribution on my projects; so one battery has been fine for me. I figure though, most hybrid autos have a second battery to start the IC... I would expect 2 batteries to work out best for some UAS as well. :D

    • Check the latest beta of APM:Plane. Added support for monitoring voltage on a 2nd battery (BATTERY2
      mavlink message)

      "The 2nd voltage is configured using BATT_VOLT2_PIN and BATT_VOL2_MULT, then you use it by monitoring the BATTERY2 MAVLink message. The message has the voltage in millivolts.

      If BATT_VOLT2_PIN is -1 (the default) then the BATTERY2 message is not sent.

      Cheers, Tridge"

  • I have really nothing to add here other than I would like to see this function be implemented as well. On the hardware side it would be nice to use a separate voltage divider (like the atto pilot) and plug it into one of the analog input pins. I could actually use this function for multiple battery inputs, I require 2 additional voltage inputs but even one extra would be great. I am sort of new to the forms, is there a place where this idea is submitted and people in a way "vote" or suggest for implementation of functions?

  • Videobattery voltage in OSD:

    In Multiwii-code for minimosd from KV-Team (rush-osd) they read the video-battery-voltage onboard on minimosd and show it in OSD as extra position.(main Battery from mav-link, videobattery from osd-board)

    The code reads the Analogin-Pin2 from 328-Chip. The setup with voltage-divider for 12V from the video-out-connector is perfect. All I need. There's no need for implementation via mav-link in Ardupilot.

    It's possible (or done, panned) to implement code in minimosd-extra for APM?

    A big deal?


    • I looked at KV-team mod at first to see if I could use it, but the code is very different. But I guess it will be very simple to implement voltage monitoring for a second battery directly in minim-osd when there is a field for it on the display.

      Hopefully it will be possible to choose where the voltage number comes from in the future. But the minimOSD seems to be quite stuffed right now.

      • Thanx Jonas,

        I think it's the easiest way to help the people to get a fast solution. In mavlink it's a bigger deal to get it work, slower than this solution. I use pixhawk with a lot of ressources. In the field there are a lot of apm 2.6 running with end of life implement the code in ardupilot..??

        Also the wiring of video-battery also to apm-controller is a bigger effort than to solder the 2 resitsors for voltage-divider on osd-board. Not a big deal, I made it for multiwii-code before...

        The extra field for it on the display should be also simple...

        Question: to compile the firmware-hex with arduino is simple (checked the code), but...

        how to compile the exe-file for the GUI (config-Tool) from the Tools-Folder to implement the "Batt B"?

  • I'm also interested in capabilities for monitoring voltages from the ADCs, e.g. the voltage of a secondary battery. However, your implementation in your github repo breaks the MAVlink protocol by changing the SYS_STATUS message. The best way to put battery voltages on the MAVlink bus should be the BATTERY_STATUS message with different IDs, i.e. 0 for the main battery, 1 for the secondary etc. This will also require modifications to the minimOSD firmware - I'll maybe have some time soon to work on a patch

    • That was my initial thought, but it was easier just copy-pasteing code from the main battery voltage monitor. And it feels like a lot have to be changed if you also move the main battery voltage to the BATTERY_STATUS message, like current_battery and battery_remaining. I mean, it is just a simple additional number that needs to be sent.

      Please inform us if you make a working patch!

  • And my monologue continues! :)

    I successfully compiled a new version of the Mission Planner software, which made it possible to set the voltage multiplier for the second battery, and turn monitoring on and off.

    Now I just need to convince some more people to make changes in their code!

    • You got me.

      I've been lurking around diy drones for nearly a year, but its this article that made me sign up so I could participate in what you have going on here.

      I'm very interested in monitoring a second battery with my APM set up [arduplane]

      However I am not very savy with the coding aspect of this. 

      Could anyone assist me with implementing this? I would be very grateful.

This reply was deleted.