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.

Thanks,

Jonas

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

Join diydrones

Email me when people reply –

Replies

      • Nice to see other people in this thread! :)

        I have made all the changes needed in the ArduPlane and ArduCopter parts of ArduPilot. What has stopped me is MinimOSD, because I have not succeeded in making it understand the new MavLink message that includes battery_voltage_aux. I haven't managed to get any help either, as everyone else seems more interested in advanced functions than a basic one like this!

        I have thought of letting this go and just buy a step-down converter and a filter to run the 12V stuff of the main battery, but a separate battery gives you some added redundancy (if you can monitor it) and minimizes the chance of noise in the video.

  • I have now successfully tested the aux battery monitoring by looking at the SYS_STATUS message. I can set the parameters in the all config parameters tab in Mission Planner, which means I can enable monitoring and set voltage multiplier value.

    However, I cannot see the voltage received via MavLink in the Mission Planner. This almost certainly is due to me changing the SYS_STATUS message in MavLink, which means the original Mission Planner cannot decode it.

    Is this the correct way to do it? I mean, changing the look of the SYS_STATUS message will make the original versions of Mission Planner, APM Planner 2 and MinimOSD unusable. Unless everyone agrees on the new message definition...

    Of course I could create an entirely new MavLink message, but I really think the aux battery voltage belongs in the same place as the flight battery votage/current info.

    Input please!

    • Surprised you have not gotten more input, I am interested and I know a lot of people are, but I lack any programming knowledge.  

      If your "update" gets put as an official update, then I am sure other programs such as a MinimOSD will also have to update. Or some sort of if statement making sure the incoming is accepting the new message otherwise send legacy code. I hope you figure it out :)

      • Yes, I'm also surprised this thread is so quiet!

        I reckon more than half the FPV-planes around uses a second battery for the video TX and camera, and of course everyone should want to monitor that battery. My current OSD has two voltage monitors, which saved me once when a bad video battery went from full to empty in about 30 seconds.

  • I got a tip from Robert Lefebvre who told me to use the gcc 4.7.2-version of the Arduino IDE to compile the code, and now the sketch is small enough! (238 012 bytes of 258 048)

    Now I just need a voltage divider to connect a 3S battery to an analog port. Hopefully I can find a way to look at the MavLink messages to see if the correct voltage is sent.

  • Developer

    I haven't reviewed the code but great that you're looking at it.

    I think to get the size down we are going to need to remove the CLI.  We're already started on this but not there yet.

    • Thanks. The code compiles and the aux battery voltage should be sent via an extended MavLink status message, and a low aux battery voltage should trigger an alarm. But of course I cannot test it until I can merge a smaller ArduPlane sketch with my fork.

      I will also try to make the code smaller by making the voltage monitoring code reusable. Right now I just copy-pasted the code for the main battery and made small changes. Using pointers/references I should hopefully get the sketch size down a couple of kB, but i doubt it will be enough...

  • I have now started implementing monitoring of a second battery in ArduPlane.

    If someone is interested you can look at my repository here:

    https://github.com/Xtreamer/ardupilot

    At the moment the sketch is too big for the Ardupilot, but I (or someone smarter than me) can hopefully soon fix this problem!

    Xtreamer/ardupilot
    APM Plane, APM Copter, APM Rover source. Contribute to Xtreamer/ardupilot development by creating an account on GitHub.
  • Developer

    Jonas,

         As you say, we've talked about it but nobody's done it yet.  Rob Lefebvre was the volunteer for that.

         By the way, we think it's a common enough function that it should be added into the AP_BattMonitor library.

This reply was deleted.

Activity

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