Developing and Embedding AI-Based SOC Estimation for BMS Using MATLAB
Watch a product demonstration for an end-to-end workflow in MATLAB® that can be used to develop and compress an AI model for battery state-of-charge (SOC) estimation, then deploy it to a microcontroller for real-time use in a battery management system (BMS). With a single line of MATLAB code, you can generate standalone, generic C or C++ code for deep learning models created in MATLAB or imported from other frameworks. Begin by constructing and training a long short-term memory (LSTM) deep learning network for battery SOC prediction using the Deep Network Designer app in MATLAB. Then, apply neural network projection to compress the network by over 90%, optimizing it for efficient execution on a resource-constrained microcontroller. Finally, generate generic C code for the compressed LSTM model using the MATLAB Coder™ app. Once code generation is complete, the generated C code can be integrated with the remaining BMS firmware to predict SOC in real time.
The data set used for battery SOC estimation in this example can be found in [1]:
[1] Eleftheriadis, Panagiotis. “PoliMi-TUB Dataset - LG 18650HE4 Li-Ion Battery.” Mendeley Data, V1, 2024. https://doi.org/10.17632/6hyhsjbwkb.1.
Published: 22 Aug 2025