I am working on a custom ArduPilot firmware and would like to integrate a smart battery that communicates via I2C. My goal is to have the ArduPilot directly receive battery data (voltage, current, capacity, and status) through I2C, bypassing the need for an external power module.
Could anyone provide guidance on the following:
Which part of the ArduPilot codebase should I modify to add support for my I2C smart battery?
Are there any examples or documentation available for integrating custom battery monitors into ArduPilot?
What is the process to test and validate such modifications?
Any resources, tips, or pointers would be greatly appreciated.
Here’s what i want to do.
I have BMS attached to my battery which gives data on I2C. I’ve tested with the Arduino boards.
So, how to do the same in ardupilot?
That depends on the used protocol. If it follows the SBS specification it could already work.
The Maxell one (the protocol I copied for my implantation) uses SBS with some special commands for the single cell voltages.
Is there a way to create a custom library under the Battery Monitor library for a specific module and then deploy this firmware on all drones using this battery? I read the library, but it seems to involve a lot of hard work. However, I have the time, so can anyone explain how to write a library and which files I need to check out for this?
In my experience VSCode works quite well with Ardupilot codebase when using WSL (AFAIK recommend on Windows). AFAIK if your smart battery uses I2C or SMBUS, you will have to implement a simulation for it as a part of SITL.