Servers by jDrones

Interfacing smart battery over UAVCAN

I’m planning how to interface a custom smart battery controller with ArduPilot. My initial though was sending 1092.BatteryInfo message over CAN.

However looking at AP_BattMonitor_UAVCAN::handle_battery_info [1], it seems that the state_of_charge_pct field is ignored. So no smart battery support over CAN ?

[1] https://github.com/ArduPilot/ardupilot/blob/0708b65c2d69008635808eafb43275ea0ba9af68/libraries/AP_BattMonitor/AP_BattMonitor_UAVCAN.cpp#L82

I believe it uses just the voltage and current messages to integrate milliamp hours and evaluate watt hours.

In essence, just using it as a power module over UAVCAN, so to speak.

Seems the most foolproof way to do things without modifying much upstream when it comes to capacity reporting, but unfortunately sacrifices the feature of knowing a battery-dependent capacity anywhere within the discharge curve - it can only assume full charge at the beginning. This, of course, is merely my observation and I welcome correction if mistaken.

My other issue, having to do with the BatteryInfo message itself, is the lack of support for cell voltages. But that’s just a niche thing that very few use cases need - I do believe it to be helpful for smart batteries, where balancing leads are generally not exposed.

Yes, from what I see in the code all of the battery monitor modules are integrating current and not providing state of charge directly from the battery controller.

I could try implementing the functionality myself, but would be nice to get some guidance from somebody experienced in this area of code.

Yesterday I tried the Smart Battery Message via Mavlink, but I couldn’t get it to work, there you could also send the single cell voltage…
https://mavlink.io/en/messages/common.html#SMART_BATTERY_INFO
https://mavlink.io/en/messages/common.html#SMART_BATTERY_STATUS

I just did a quick search in the source code (ArduPilot master) - those messages are indeed not supported.

Servers by jDrones