2. Embedded AI — Battery State of Charge

David Such
13 min readJun 27, 2024

In part one of our series on embedded AI we explained the Machine Learning (ML) process, using linear regression as an example. We will now use the same process to calculate the charge state of a LiPo battery using an Arduino and a lookup table. Linear interpolation will be used to estimate the values between the points in our table. In part three, we will use ML in place of our lookup table.

Image Created using DALL-E

Our embedded projects almost exclusively use LiPo batteries as power sources. These are a good choice in terms of current delivery, size, weight and capacity. However, you don’t want to over discharge them or you can impact battery life.

Battery Voltage Monitoring

Indicative values of battery capacity versus voltage are shown in Figure 1. The top row (1S, 2S, etc.) indicates the number of LiPo cells in series (S). This is how the batteries nominal voltage is specified, and the voltage from each cell is added when they are in series. These values are to demonstrate how to build an ML model which predicts charge state. In practice, you should measure the actual values for the battery you are using or derive them from the discharge curve on the battery data sheet.

--

--

David Such

Reefwing Software · Embedded Systems Engineer · iOS & AI Development · Robotics · Drones · Arduino · Raspberry Pi · Flight Control