Skip to main content
emobility.academy
M.TechBattery & BMSAdvanced About 8 weeksKit only

Lumped Thermal Model and Temperature Prediction for a Li-ion Cell

Build and identify a lumped thermal model of the kit cell, predicting its temperature from heat generated by current and from ambient temperature read by the BMP280, and run the model on the STM32 to forecast temperature ahead of time. Prediction error is compared against measurement.

Uses: ADC · UART

The problem

Cell temperature governs safety, ageing and charge limits, but sensors in a pack are sparse and slow to react. BMS designs often use a thermal model to estimate temperatures between sensors and to predict whether a planned current will cause overheating. This project builds such a model, identifies its parameters on a real cell and tests its predictions.

Objectives

  • Write a lumped thermal model with heat generation and convective cooling.
  • Identify thermal capacity and heat-transfer coefficient from logged experiments.
  • Estimate heat generation from current estimated by load resistance and measured internal resistance.
  • Run the model on the STM32 in fixed point and predict temperature a set time ahead.
  • Quantify prediction error and its sensitivity to parameter errors.

What you need

From the EV Embedded Development Kit

  • STM32F103C8T6 microcontroller unit (Arm Cortex-M3)
  • 1S battery with connector and T-sense input
  • Load section: three switchable resistive loads with LEDs
  • Charge/discharge control relay
  • Battery charging unit with its own switch
  • BMP280 pressure and temperature sensor
  • Serial UART interface
  • 16×2 LCD with contrast control

Software

  • STM32CubeIDE
  • Embedded C with STM32 HAL
  • Python with NumPy, SciPy, pandas and matplotlib
  • MATLAB/Simulink (optional)

Extra parts

None. Everything this project needs is on the kit.

This project uses the kit's lithium cell. Respect polarity, never short the terminals, and don't leave the cell charging unattended.

Key concepts

Lumped thermal model
Treats the cell as one body at uniform temperature: m·c·dT/dt = Q_gen − h·A·(T − T_ambient). It ignores internal gradients, which is reasonable for a small cell.
Heat generation
At low rates the main source is ohmic and polarisation loss, approximately I²·R_internal. Reversible entropic heat is smaller and is neglected here, with the omission stated.
Thermal time constant
τ = m·c / (h·A) sets how fast the cell approaches ambient. It can be found from a cooling curve without knowing m, c, h and A separately.
Discretised model in fixed point
With a 1 s step, T[k+1] = T[k] + (Δt / C_th)(Q_gen − (T[k] − T_amb) / R_th). Scaled integers keep it cheap on a no-FPU MCU.

Step-by-step guide

  1. 1

    Scope the experiment honestly

    Estimate the heat the kit can produce: with the cell's internal resistance and the highest load current, I²R is small, so the temperature rise may only be a few degrees. Decide the resolution you need from the T-sense input and whether the rise will be measurable above noise. Plan to identify the time constant from a cooling curve and the heat-generation scale from the longest, highest-load discharges allowed. Write down these expectations before testing.

    Checkpoint: A calculation of expected heat and temperature rise, with the measurement resolution needed.

  2. 2

    Set up sensing

    Check cell polarity. Enable DIP switches for battery sense, T-sense, loads, relay, I2C (for the BMP280), LCD and UART. Calibrate the T-sense conversion against a reference thermometer, and bring up the BMP280 over I2C to read ambient temperature, placing the board away from drafts and sunlight. Sample cell temperature heavily averaged every second and stream all values over UART. Shield the cell from the board's own warm components if possible, and note where they are.

    Checkpoint: Cell and ambient temperatures agree within ±0.5 °C after a long rest with no load.

  3. 3

    Estimate current and heat

    During discharge, current is cell voltage divided by the calibrated load resistance. Heat generation is the difference between open-circuit voltage and terminal voltage times current, which captures both ohmic and polarisation losses without a separate resistance model. Use an OCV–SOC table for the OCV term. State the uncertainty, which grows when the voltage difference is small. Plot heat generation against time for a long discharge to see how it grows as voltage falls and resistance rises.

    Checkpoint: Heat generation logged every second during a test, with an uncertainty estimate.

  4. 4

    Identify the time constant

    Warm the cell slightly by running the highest allowed load for an extended period, then switch off and record the cooling to ambient. Fit an exponential T(t) = T_amb + ΔT·exp(−t / τ) with SciPy. Repeat to check consistency. If the rise is too small to fit well, say so and use the longest test you can run within the cell's limits.

    Checkpoint: A fitted Ï„ with confidence interval from at least two cooling curves.

  5. 5

    Identify thermal capacity

    Using heating data, fit C_th (with R_th = Ï„ / C_th) so that the model driven by measured heat generation and ambient temperature matches the measured temperature rise. Compare the fitted C_th with an estimate from the cell's mass and a typical specific heat capacity for Li-ion cells found in literature, and comment on the difference. Check that the fitted parameters stay similar when fitted on different heating runs.

    Checkpoint: Fitted C_th and R_th with a model-versus-measurement plot on the identification data.

  6. 6

    Validate offline

    Run a different load profile, such as repeated pulses, on a separate day. Simulate the model in Python from measured heat and ambient, and compare predicted with measured temperature. Report RMS and maximum error and how the error grows over time. Also test the model on a cooling period after the profile, where heat generation is zero and only the cooling term acts. If the error grows steadily, check the ambient reading first, because a small ambient bias causes a slow, steady drift in the prediction.

    Checkpoint: Validation plot and error figures on data not used for fitting.

  7. 7

    Implement on the STM32

    Port the discretised model to firmware with a 1 s step in fixed point: temperature in hundredths of a degree, heat in microwatts, and the constants scaled so intermediate products fit in 32 or 64 bits. Check against the Python model with the same inputs. Measure the cycle cost with the DWT cycle counter; it will be tiny, which is part of the argument for using it.

    Checkpoint: On-board model output matches the Python simulation within 0.05 °C over a full test.

  8. 8

    Add prediction ahead

    Use the model to predict the temperature N seconds ahead assuming the present load continues, by iterating the model faster than real time or using the closed-form solution. Show the present and predicted temperature on the LCD and warn when the prediction crosses a limit you set. Correct the model state with measured temperature using a simple observer gain so errors do not accumulate.

    Checkpoint: Predicted temperature at 5 minutes ahead compared with the actual temperature 5 minutes later, logged over a test.

  9. 9

    Sensitivity analysis

    Vary τ and C_th by ±20 per cent and heat-generation estimates by their uncertainty and show the effect on prediction error. Compare the model with a naive predictor that assumes temperature stays the same. Discuss the conditions in which the model helps and where the small temperature rise of this kit limits the conclusions. Present the results in a table that shows which parameter matters most, guiding where better measurement effort is worth spending.

    Checkpoint: A table of prediction error under each perturbation and against the naive baseline.

  10. 10

    Report

    Present the model, identification procedure, validation, embedded implementation, prediction results and sensitivity analysis, with all data and scripts. Explain what would change in a real pack: higher currents, cell-to-cell conduction and cooling systems. Describe how the model could feed a BMS function such as current derating, and what would need to be identified again for a larger cell. Include the identification scripts, embedded code and all logs so the work can be reproduced, and state the temperature range over which the model was validated.

    Checkpoint: A report with quantified prediction error against a baseline and clear limitations.

Testing & validation

  • T-sense calibration against a reference thermometer.
  • Time constant fitted from repeated cooling curves.
  • Validation error on a different load profile.
  • Embedded model output against the PC model.
  • Prediction error at a fixed horizon against a naive baseline.

Expected results

An identified lumped thermal model of the kit cell running in fixed point on the STM32, with measured prediction accuracy and a sensitivity study, plus an honest account of the small temperature range the kit can produce.

Research angle for your M.Tech thesis

Research questions: how accurately can a lumped thermal model identified on a low-cost bench predict cell temperature, and how much does a measurement-corrected observer improve over an open-loop model? Metrics: prediction RMS error at several horizons, parameter uncertainty, cycles per update. Baselines: naive persistence prediction and open-loop simulation. The small temperature range is a limitation to state openly; combining kit results with thermal data from public datasets that include temperature, such as NASA PCoE, can strengthen the work.

Take it further

  • Add the entropic heat term using measured dOCV/dT and compare.
  • Couple the thermal model with an electrical model for joint estimation.
  • Use the prediction to derate load current before a limit is reached.
  • Estimate an internal core temperature with a two-node model.

Viva and review questions

Why is a lumped model acceptable here?

The cell is small and the currents are low, so internal temperature gradients are small compared with the difference between cell and ambient.

How did you estimate heat without a current sensor?

Current from voltage divided by load resistance, and heat as the difference between open-circuit and terminal voltage multiplied by that current.

How do you find the thermal time constant?

By fitting an exponential to the cooling curve after the load is removed.

Why correct the model with measured temperature?

Model errors accumulate over time; a small observer correction from the sensor keeps the estimated state close to reality while still allowing prediction ahead.

Related EV projects

All 100 EV projects