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.
I’m trying to implement the similar features except that i have an analog-voltage battery which is sending the data through the bms hardware (pcb) and battery data logger (another pcb). There is also a temperature sensor which is sending temperature data to the bms pcb. The battery logger is sending the value at the address 0x0B, i want to read the address from the i2c slave and post whatever the data it’s sending on the mission planner display through a cuav controller.
Im currently trying to write a new battery monitor (backend) driver for integrating the i2c data from the analog-battery which is connected to the bms and battery logger pcb’s and will need some support from the community.