DEV Community

Docy
Docy

Posted on

Battery Modeling for Embedded Systems: From Simple C-R Models to Thevenin Models

A battery is often treated as a simple voltage source in an embedded system. In practice, however, its terminal voltage changes continuously with load current, state of charge (SOC), temperature, and aging.

For example, a 3.8 V LiPo battery may show 3.8 V under no load but drop significantly when a wireless module, processor, or motor suddenly demands several amps. If an embedded system assumes that the battery voltage is constant, its power and runtime calculations can be far from reality.

Battery models provide a practical way to approximate this behavior without simulating every electrochemical process inside the cell. This article explains how to move from a simple C-R model to a first-order Thevenin model and how these models can be implemented and validated in embedded systems.

What Does A Battery Model Actually Represent?

A real LiPo battery involves complex electrochemical processes, including ion transport, electrode reactions, polarization, and diffusion. Modeling all of these processes requires sophisticated electrochemical models and significant computational resources.

For many embedded applications, that level of detail is unnecessary.

Instead, an equivalent-circuit model can approximate the relationship between:

SOC → OCV → Current → Terminal Voltage

The objective is to build a model that is accurate enough for the engineering problem while remaining simple enough to run efficiently on a microcontroller.

Typical applications include:

  • Battery voltage prediction
  • Runtime estimation
  • Power management
  • SOC estimation
  • Load transient analysis
  • Battery-powered system simulation

Start With The Simplest Battery Model

The simplest model treats the battery as an ideal voltage source:

Vterminal = VOCV

Here, VOCV represents the open-circuit voltage.

This model is useful during early system design when the goal is simply to estimate available energy or define the nominal operating voltage. However, it assumes that battery voltage does not change when current flows.

That assumption quickly becomes inaccurate under dynamic loads.

Add Internal Resistance: The C-R Model

A more practical model adds a series resistance to the ideal voltage source:

Vterminal = VOCV − I × R0

Suppose a battery has an open-circuit voltage of 3.8 V, an internal resistance of 100 mΩ, and the load suddenly draws 2 A.

The estimated voltage drop is:

ΔV = I × R0 = 2 × 0.1 = 0.2 V

Therefore:

Vterminal ≈ 3.8 − 0.2 = 3.6 V

The battery has not suddenly lost 0.2 V of stored energy. Instead, part of the voltage is temporarily lost across its internal resistance.

This simple model is already useful for estimating voltage sag and checking whether a battery can maintain the minimum voltage required by an embedded system.

Why A Single Resistor Is Not Enough

Real batteries do not respond to a current change with an instantaneous voltage drop followed by a constant value.

After a current step, the voltage typically shows two behaviors:

  1. An immediate voltage change.
  2. A slower voltage transition toward a new operating point.

The simple C-R model can represent the first behavior, but not the second.

This slower response is related to electrochemical polarization, charge redistribution, and other dynamic processes inside the cell.

To represent these effects, an RC branch can be added to the model.

The Thevenin Battery Model

A commonly used first-order Thevenin model consists of an open-circuit voltage source, a series resistance, and an RC network.

The terminal voltage can be expressed as:

Vterminal = VOCV − I × R0 − VRC

The three main parameters have different roles.

VOCV represents the battery's open-circuit voltage and generally varies with SOC.

R0 represents the immediate ohmic resistance responsible for the fast voltage drop after a current change.

R1-C1 represents slower dynamic behavior and polarization.

Importantly, the capacitor in this model is not a physical capacitor inside the LiPo cell. It is a mathematical equivalent used to approximate the battery's dynamic response.

Modeling A Battery Response To A Current Step

Consider a battery operating at 0.2 A. The load suddenly increases to 2 A for one second.

Immediately after the current step, the voltage drops because of R0:

ΔVinstantaneous ≈ ΔI × R0

After that, the RC branch changes gradually.

For a first-order RC network, the transient component can be approximated by:

VRC(t) = I × R1 × (1 − e−t/τ)

where:

τ = R1 × C1

is the time constant.

This allows a Thevenin model to reproduce both the rapid voltage drop and the slower voltage response that cannot be represented by a single resistor.

SOC And Temperature Change The Model

A fixed set of battery parameters is rarely sufficient for accurate modeling.

The open-circuit voltage is generally a function of SOC:

VOCV = f(SOC)

Internal resistance also changes with operating conditions:

R0 = f(SOC, T)

where T represents temperature.

At low temperatures, LiPo battery impedance typically increases, resulting in greater voltage sag under the same load. Battery behavior also changes as SOC decreases and as the cell ages.

For embedded applications requiring higher accuracy, parameters such as OCV, R0, R1, and C1 can therefore be stored as lookup tables indexed by SOC and temperature.

How To Extract Model Parameters From Real Battery Data

A useful battery model should be based on measured data rather than assumptions.

One practical process is to first characterize the battery's OCV-SOC relationship. The cell is charged or discharged to different SOC levels and allowed to rest before measuring its open-circuit voltage.

Next, apply controlled current pulses and record the voltage response.

The instantaneous voltage change can provide an initial estimate of R0:

R0 ≈ ΔVinstantaneous / ΔI

The slower voltage response can then be fitted to determine R1 and C1.

For example, a pulse test might look like:

0.5 A → 2 A → 0.5 A

The measured voltage curve can then be compared with the predicted Thevenin response.

This approach transforms battery modeling from a theoretical exercise into a data-driven engineering process.

Implementing A Thevenin Model On A Microcontroller

A simplified embedded implementation can follow this process:

Measure battery voltage and current → Estimate SOC → Obtain OCV and model parameters → Update the RC state → Calculate predicted terminal voltage

For resource-constrained microcontrollers, lookup tables are often more practical than complex mathematical functions.

The implementation also needs to consider ADC resolution, current-sensing accuracy, sampling frequency, memory usage, and computational cost.

A more complex model is not automatically a better embedded model. The model should provide enough accuracy for the application without consuming unnecessary processing resources.

Simple C-R Model vs. Thevenin Model

The appropriate model depends on the engineering requirement.

An ideal voltage-source model is useful for basic energy calculations.

A simple C-R model is useful when the primary concern is voltage sag under load.

A first-order Thevenin model is more appropriate when load transients, SOC-dependent behavior, or voltage prediction are important.

More complex two-RC or electrochemical models can provide higher accuracy, but they also require more parameters, measurements, and computational resources.

The goal is not to build the most complicated model possible. It is to build the simplest model that accurately represents the behavior relevant to the application.

Validate The Model Against Real Battery Data

No matter how well a model looks mathematically, it should be validated against real battery measurements.

Useful validation tests include:

  • Constant-current discharge
  • Current-step response
  • Different SOC levels
  • Different temperatures
  • Different discharge rates

The predicted voltage can then be compared with measured voltage using metrics such as root mean square error (RMSE):

RMSE = √[Σ(Vmeasured − Vmodel)² / n]

If the error becomes large under certain SOC, temperature, or load conditions, the model parameters may need to be recalibrated.

Final Takeaway

Battery modeling provides embedded developers with a practical way to predict battery behavior without simulating every electrochemical process inside a cell.

The progression is straightforward:

Ideal voltage source → C-R model → Thevenin model → SOC/temperature-dependent model

The simple C-R model can explain basic voltage sag, while a first-order Thevenin model can capture both instantaneous and slower transient behavior.

For many battery-powered consumer electronics, IoT devices, wearables, and robotics applications, a properly calibrated 1-RC Thevenin model can provide a useful balance between accuracy and computational complexity.

The key is not choosing the most sophisticated model. It is collecting reliable battery data, identifying the parameters that actually matter, and selecting a model whose complexity matches the requirements of the embedded system.

Top comments (0)