Best method to emulate smart battery and show lowest cell voltage on OSD?

Recently I designed a small lipo-checker to practice PCB design and STM32 programming. The pins on the left side can be either UART or I2C output, which I was thinking would be useful to output the lowest individual cell voltage to Ardupilot while flying, since I’ve been caught out a couple of times by a bad cell that wasn’t apparent by just looking at the total pack voltage until too late.

Seems like this could be done either by emulating one of those FrSky voltage sensors (UART), or by emulating an SMBus smart battery (I2C). I think I could figure out how to emulate SMBus by looking at AP_BattMonitor_SMBus*. For FrSky I looked at AP_Frsky_Telem* but there is no mention of individual cells (even though docs suggest this is supported https://ardupilot.org/copter/docs/common-frsky-telemetry.html).

Alternatively, since it’s not really necessary for Ardupilot to know all cell voltages, my sensor could send only the lowest cell voltage as a single value somehow - not sure if there’s any suitable protocol for that though…

As for displaying on the OSD, I’m thinking to set the overall pack voltage to the lowest cell voltage (by modifying my Arduplane build I mean), and I’m expecting the OSD will show that without any problems, ie. with fully charged lipo the OSD will show around 4.2v regardless of pack size. I know it’s not technically correct, but that’s outcome I will find most practical. Hmm… might be nice if the OSD could display two decimal places, if not I could just multiply the voltage by 10 to have it starting as 42.0v when fully charged.

Anyway, I was wondering if anyone had some useful tips about the best way to do this before I dive in and make something that could have been done much easier a different way.

1 Like

If you are interested, there is an implementation for the SMBus at my github… But I think by now Ardupilot already supports more parameters than my script currently provides, but I have to check that…

The SBS protocol has no intention to send single cell voltages, bit I just used the Maxell Battery Protocol, which relies on SBS

I got this kinda working, haven’t used it in flight yet. Demo here: https://www.youtube.com/watch?v=ewrmEKdtJ-M

1 Like