Forecast future battery temperature trends over upcoming charge/discharge cycles using Machine Learning + Flask + Chart.js.
This project implements an end-to-end ML pipeline and interactive web app to:
✅ Analyze NASA B0005 battery dataset.
✅ Train a Linear Regression model for time series forecasting.
✅ Deploy the model via a Flask REST API.
✅ Build a simple UI Dashboard with Chart.js for visualization.
✅ Allow user to input temperature value and forecast next 50 future cycles.
-
Battery temperature affects capacity fade, thermal degradation, and safety.
-
Accurate forecasting can improve:
- Battery life cycle management
- Thermal control system optimization
- EV reliability & efficiency
Battery_forecast/
│
├── model/
│ ├── battery_temp_model.pkl # Trained Linear Regression model
│ ├── scaler.pkl # Fitted MinMaxScaler
│
├── static/
│ └── index.html # Interactive UI (Chart.js + HTML + JS)
│
├── app.py # Flask REST API
│
├── B0005_discharge.csv # NASA Battery Dataset (discharge cycles)
│
├── requirements.txt # Project dependencies
│
└── README.md # Project documentation
git clone https://github.com/Kshitijasharma/Thermal-Battery-Predictions
cd Thermal-Battery-Predictions
pip install -r requirements.txt
If not already trained, run the model training script (train_model.py
or inside a notebook):
python train_model.py
Or use the provided battery_temp_model.pkl
and scaler.pkl
.
python app.py
Go to:
http://127.0.0.1:5000
- User inputs a starting temperature value in UI.
- The app sends this value to
/predict
endpoint via POST request. - Flask API uses Linear Regression model to forecast next 50 cycle temperatures.
- Forecasted temperatures are returned as JSON.
- UI displays the result as an interactive line chart using Chart.js.
✅ Python ✅ Flask ✅ Scikit-learn ✅ Pandas / Numpy ✅ MinMaxScaler ✅ Chart.js ✅ HTML + JavaScript
- I am working on implementing LSTM / GRU for more advanced time series forecasting
- Adding Voltage and Current multivariate forecasting
- Will deploy on Heroku / AWS / Render
- Improving UI (Bootstrap / React)
- Adding real-time data streaming support
- NASA Ames Prognostics Data Repository https://www.nasa.gov/content/prognostics-center-of-excellence-data-set-repository
Dataset: B0005 Battery aging dataset

If you like this project, give it a ⭐️ on GitHub! 🚀