State of charge information to Pixhawk

Hello,

This project I am working on was inspired by the deficiencies in MP which make it so MP believes that any battery plugged in has a 100% charge state, even if that’s not actually the case. So, if you have a battery that is at 90% and plug it in, MP will report that your battery is at 100% charge.

My solution is I am developing a state-of-charge (SOC) estimator for a battery pack using a current sensor and Arduino. The Arduino will use an EKF to perform accurate state estimation, and then store that SOC value in onboard memory (EEPROM).

My question is, how do I send the SOC information to the Pixhawk such that it will report to Mission Planner the actual state of charge? I know that I2C is the interface I want to use, but once I’ve sent the data to Pixhawk, how do I make sure Pixhawk is indeed updating the battery state of charge info in the Power Module?

Thanks for reading and hopefully replying :smiley:

SOC is not a MP function, this is reported by the autopilot.

Right. So where in the arduplane code is the part that reads the incoming data from slave address 0x0B for SMbus? (like it says here: copter.ardupilot.tridgell.net/wi … t-battery/)

I have the arduino interfaced with Pixhawk in I2C and the arduino acts as a slave…how do I make sure that the SOC value from arduino is being fed into the SOC value in the autopilot?