ArduPilot Open Source Smart Battery

For my aerial photography copter project, I’ve been working with Huibean (from VimDrones) on an open source (software) smart battery. The video above shows the first prototype in action!

It uses the AP_Periph software which is essentially ArduPilot running on peripherals. This software is already very popular and is quietly running on many GPSs, airspeed sensors, etc especially those that support DroneCAN. It allows manufacturers to keep their R&D costs low and focus on making good hardware.

The software side consists of:

  • TIBQ76952 battery monitor driver (.h, .cpp)
  • AP_Periph battery BMS code that handles the button and LEDs (battery_bms.h, .cpp)

.. and it provides all the features you’d expect including main voltage, individual cell voltages, current draw, remaining capacity, state-of-charge %, etc.

The BMS PCB’s hardware definition file can be found here but in short the hardware includes:

The battery connector is 14-pin 2.5mm pitch blade-type battery connector manufactured by Denuowei (深圳市德诺威电子科技有限公司) but there are many similar connectors available on the market it seems. The BMS PCB has female pins and the drone side’s very simple side PCB gets the male pins. The pin mapping is below:

Pin Signal
1 BATT+
2 BATT+
3 BATT+
4 BATT+
5 BATT+
6 5V
7 CAN_H
8 CAN_L
9 GND
10 BATT-
11 BATT-
12 BATT-
13 BATT-
14 BATT-

The case is 3D printed using HP Multi-Jet-Fusion / PA12 HP Nylon and I used JLC3DP printing service. MJF results in really high quality prints that are almost indistinguishable from injection moulding. A company called TezRow designed the case for me using AutoDesk Fusion 360

The battery is a custom semi-solid state 6S 10C 5500mAh battery purchased from FoxTech that I’ve manually soldered to the VimDrones BMS PCB.

For charging I use a simple 25.2V Li-ion battery charger which has been soldered to the same PCB used on the drone side. It provides power to the BMS PCB’s BATT+ and BATT- pins and the BMS takes care of the rest.

The next steps including having a couple of prototypes properly manufactured which should allow the batteries to be properly certified and thus taken on planes, etc. On the software side I plan to add a parameter to allow users to set the maximum charge because the battery will last longer if we don’t charge to 100% every time.

If you’re interested in getting a board it is probably best to first contact Huibean at VimDrones because he spent considerable effort on both on the hardware and software and some aspects were a bit tricky like requiring the button to wake-up the TIBQ device.

In any case, I hope that more manufacturers will take advantage of the work done here and make their own smart batteries using open source software. Let’s move on a bit from traditional “dumb” batteries, let’s standardise the pins and software and stop re-inventing the wheel!

27 Likes

Great Job Randy :slight_smile:

3 Likes

Very nice job from both of you!
Highly curious to give it a try!

For those of us in europe, I higly recommend Weerg in Italy for 3d printing, their pricing and delays are impressive!

2 Likes

great idea! how many cells does it support and what is the purpose of the 5V/GND pins?

Hi @joshm,

Thanks!

The ArduPilot battery monitor driver use the TIBQ76952 BMS chip that supports from 3 to 16 cells. The VimDrones PCB is currently designed to support 6S batteries.

The 5V and GND pins (and the CAN_L and CAN_H) are to provide power and communicate with the STM32F4 and TIBQ chips without drawing power from the battery itself. So this could be used by the drone or a smart charger. Those pins don’t need to be used for the smart battery to work .. but they’re there in case they’re useful.

Hi

Good initiative. I would only have a change / addition to the project.

With all the recent proliferation of reasonable/good and powerful USB-C GaaN chargers, adding a USB-C port to charge the battery would make it much more versatile.

Best

Luis

1 Like

Hi @LuisVale,

Great to hear from you! Yes, I agree, having a USB-C port to allow directly charging without any special charging unit would be very nice.

By the way, @rmackay9, is the PCB open-source?

Hi Randy

I was chatting with one LLM about this solution, and adding USB-PD could be a universal solution. As I use already some UGreen chargers (160W) I gave the LLM its specs, and also added a requirement to charge from 3S to 6S packs and limit the current to 5A and the LLM gave me this


**
Finalist architecture**

  • USB-C EPR sink controller: TPS26750.
  • Battery charger: BQ25756E.
  • Existing battery monitor and MCU: BQ76952 and STM32L431.

Both ICs support the required functions, and TI documents the relevant device capabilities**

Final recommendation: one safety-first design**

Use the TPS26750 + BQ25756E, controlled by the existing STM32L431, with the BQ76952 retained forcell monitoring and battery protection. This is the single architecture I recommend for your requirements.TI confirms that the BQ25756E supports 1–7S LiPo charging, 36 V operating input, programmablecharge limits and temperature monitoring.

Required design rules

  • Negotiate 28 V / 5 A only on the UGREEN’s USB-C1 port, using a suitable 5 A EPR cable.
  • Set charge voltage to 12.60, 16.80, 21.00 or 25.20 V according to the verified 3S–6S configuration.
  • Set charge current from the pack’s approved charge rate, not automatically to 5 A.
  • Keep charging disabled until PD negotiation, cell measurements, temperature and protectionstatus are valid.
  • Use independent hardware protection for battery overvoltage, input faults and excessive current;do not rely on firmware alone.
  • On MCU reset, I²C failure, invalid cell data or a BQ76952 fault, disable charging.
  • Include cell balancing, thermal design, input transient protection and reverse-current protection.
  • Validate the PCB with fault injection, thermal testing and worst-case input conditions beforecharging LiPo packs unattended.

Important limitation: this is a recommended architecture, not a production-ready schematic. TheBQ25756E’s 36 V operating limit gives useful headroom at 28 V, but the input protection and transientdesign still require verification. The actual BQ76952 protection configuration must also be reviewedbefore declaring the finished battery safe.

The next engineering deliverable should be a single complete schematic and BOM based on thesecomponents, followed by PCB layout and safety validation—not another set of alternative designs.

1 Like

Hi @StrikeEagle,

The PCB is not open source I’m afraid. It was designed and built by @Huibean VimDrones so it’s best to talk to them about it. Still, as mentioned above there’s a fair bit of information that can be gleaned from the hardware definition file.

2 Likes

Hi Randy,

Small thing I thought about (and probably you too guys too!) but is there any protection for the battery poweroff if there is some current draw? (like a defective switch in flight for example?)

2 Likes

Hi @ncx94,

I haven’t tested the TI BMS chip to determine if it powers off at high current draw but it certainly has a number of fault detection flags so it’s possible. We shall see I guess!

I don’t recall seeing any “do not disconnect under load” options in the documentation. It would be quite surprising because most BMSes protect the batery first.

I’m not a huge fan of smart batteries on multirotors as there is no backup if it cuts off, rovers wont go anywhere and you can have a backup electronics battery in a plane or helicopter to glide, For the BMS to fail it wouldn’t have to be a faulty switch, if any of the cell monitoring wires come loose it would read out of range and immediately cut off. so every single wire connected to the battery is now a catastrophic point of failure. any moisture in it could cause it to fail, if you look in a dji battery they are totally sealed with conformal coating. i have seen electronic devices pop and let out magic smoke just by being brought in from a cold car to a hot room causing condensation to form on it.

For aircraft I think the best way to have it for charging only. So your BMS monitors flight, charging and balances with the discharge wire connected directly to the battery cell negative terminal so it cannot be cut off. This has risk of destroying a battery if you somehow forgot it was connected, but you won’t lose an aircraft if it has a fault and you still keep all the monitoring and charging protections.

3 Likes

I was more thinking about that protection inside the stm32, as a safety for a switch failure which would cause the stm32 to think “the user wants to shutoff the drone” while it’s flying.

Hi @ncx94,

OK, I hadn’t thought of trying to wire a kill switch into the battery. If we wanted a physical button on the vehicle that might make sense. If it’s not physical though then I think we already have a few ways to do it including the auxiliary switch functions and mavlink commands and it’s probably better to handle the command at this higher level..

Hi @geofrancis,

That was an interesting comment actually on smart batteries.

Another contrarian thing I thought of for my aerial photography copters was making it difficult or impossible to remove the battery at all. Obviously this isn’t good for many use cases (like flying multiple flights in a row) but for some it would be OK.

No, I mean the switch that is already mounted on the bms board that is used to power the battery on and off. Do you have a safety to disable the “poweroff” feature of that button when you’re flying :slight_smile:

A way to get reliability is just use a pair of batteries that way its not going to fall out of the sky if one fails.

I am pretty sure wire disconnection protection can be disabled (by disabling per cell voltage check when armed). Top of stack connection should be such that it can’t be disconnected (that should be easy as it is close to FETs).

1 Like