Twitter icon
Facebook icon
LinkedIn icon
Google icon
Reddit icon
StumbleUpon icon
Del.icio.us icon

Battery Life Cycle Predictor Powered by Edge Impulse

Added to IoTplaybook or last updated on: 10/08/2021
Battery Life Cycle Predictor Powered by Edge Impulse

Story

Before the detailed documentation, I have attached the demo video of my project in below YouTube link, Kindly watch it

Things used in this project

Hardware components

Nano 33 BLE Sense
Arduino Nano 33 BLE Sense
 
× 1 Arduino CC
 
voltage Detection sensor
 
× 1

Robu.in

Rheostat, Wirewound
Rheostat, Wirewound
 
× 1

Newark

Battery Holder, 18650 x 1
Battery Holder, 18650 x 1
 
× 1

Newark

 
Lithium ion battery
 
× 1

Robu.in

Software apps and online services

Edge Impulse Studio
Edge Impulse Studio
 
 

Edge Impulse

MATLAB
MATLAB
 
 

MathWorks

Arduino IDE
Arduino IDE
 
  Arduino

Hand tools and fabrication machines

Solder Wire, Lead Free
Solder Wire, Lead Free
 
 

Newark

10 Pc. Jumper Wire Kit, 5 cm Long
10 Pc. Jumper Wire Kit, 5 cm Long
 
 

Newark

Project Details

To predict the Life cycle of Lithium Ion battery, there are many methods are available. One of the common method is by linear interpolating the discharge capacity to the life cycle.

In a conventional method, To estimate the life cycle using discharge capacity method, it takes 2 hours 30 mins of time for 2500mAh - single Lithium Ion cell.

Conventional method

Technology contribution:

I developed a TinyML model using Edge impulse based on Linear regression method to predict the life cycle of a battery in 1 hour time period.

This could save 90 mins of time compared to normal conventional method.

TinyML model

TinyML model

Know About Lithium Ion battery 18650 Type:

Before proceeding with technical work, let's go through the basic specification about Lithium Ion battery.

  • The nominal voltage is 3.7v which is the actual voltage of a fully charged battery when it is connected to Load.
  • The capacity of battery is 2500mAh, So If the battery is discharging at constant current 1A, then it takes 1 hour to discharge 1000mAh and for 2500mAh, it takes 2 hours and 30 mins.
  • When the battery discharge voltage reaches 2.75 v, it can be considered as fully discharged.

Architecture:

The Battery Life cycle predictor involves:

1. Battery Voltage reading

2. Simulating different discharge voltage patterns

3. Training the Model

4. Deployment

5. Applications

Architecture

Architecture

1. Battery Voltage reading

To read the discharge battery voltage, the voltage sensor is connect parallel to the rheostat. The Rheostat is adjusted in order to set the discharge current as 1 Amps.

Once the rheostat is connected to consume 1A load current, then the voltage reading had been displayed in serial terminal with 1 minute sample time.

Hardware Setup:

Hardware setup

Hardware setup

Code to read Battery voltage:

// Define analog input
#define ANALOG_IN_PIN A0
 
// Floats for ADC voltage & Input voltage
float adc_voltage = 0.0;
float in_voltage = 0.0;
 float cal_temp=0.33;
// Floats for resistor values in divider (in ohms)
float R1 = 30000.0;
float R2 = 7500.0; 
 
// Float for Reference Voltage
float ref_voltage = 5.0;
 
// Integer for ADC value
int adc_value = 0;
int minute=0;
  
void setup(){
   // Setup Serial Monitor
   Serial.begin(115200);
}
 
void loop(){
   // Read the Analog Input
   adc_value = analogRead(ANALOG_IN_PIN);
   
   // Determine voltage at ADC input
   adc_voltage  = (adc_value * ref_voltage) / 1024.0; 
   
   // Calculate voltage at divider input
   in_voltage = adc_voltage / (R2/(R1+R2)); 
   
   // Print results to Serial Monitor to 2 decimal places
  //Serial.print("Input Voltage = ");
  Serial.print(minute);
  Serial.print(',');
  Serial.println(in_voltage-cal_temp, 2);
  minute++;
  
  // Short delay
  delay(60000);
}

2. Simulating different discharge voltage patterns

2.1 Save the normal battery discharge data in excel

copy and save the serial monitor data into the excel file as below template. The voltage value should be in second column under 'Y'. The first column is time series. it should be incremented as ( 1) 1000ms.

Step2.2: Signal builder in Matlab

Create a new Simulink model in Matlab

Then type 'signal builder' in workspace and select it. Also insert

the 'scope' to connect it to the signal builder. Please refer the below screenshot.


1 / 3

 


2 / 3


3 / 3

Load the battery voltage data in signal builder and edit it according to different life cycle patterns.

Then export the file and copy and save it as csv file.

3. Training the model using Edge Impulse

Once the datasets for different voltage are generated, then upload the csv file in Edge Impulse.

Upload CSV file

Upload CSV file

since we are going to train in regression model, The label of a dataset should be numeric one.

In our case, the battery voltage after one hour as a label.

3.1 Create Impulse

In create impulse section, mention 28000ms as window time.

[ 28 minutes data is manipulated as 28 sec data, since we had taken a data in one minute sample time]

Create Impulse

Create Impulse

Since it is a raw data and regression model, no DSP block is required.

In a generating features, the expected voltage from 2.75 to 2.90 is listed.

2.75v at 2 hour is 2000mAh capacity, where as 2.9v at 2 hour time period is 2500mAh. The linear interpolation can calculate the estimated capacity by predicting the voltage.

Train the model with below settings.

Model Testing

I have tested with two datasets where the 100% accuracy is achieved.

Deployment:

Deploy it as Arduino library.

And include the library in Arduino as library file.

Application Code:

The battery life cycle is predicted by linear interpolating Discharge capacity to the life cycle.

In EI model, the model will predict the estimated battery voltage level after 1 hour. ( at 120th minute). The predicted voltage will be linear interpolated to the discharge capacity as below:

X axis : xo = 2.9, x1=2.75

Y axis : yo= 2500, y1=2000

The predicted discharge capacity can be used to estimate the life cycle.

From specification of 18650 Li ion battery type, the life cycle of battery for discharge capacity is plotted. This will be again linear interpolated to estimate the battery life cycle.

Application

The reuse of Lithium Ion battery will have huge market demand in future. So this kind of ML model to save the time in predicting the life cycle will create a huge impact in industries.

Schematics

Hardware connection

connect as per diagram

 

Code

Battery Life cycle detector

Unzip the file in github and include the library in arduino. The run the application arduino code.

Manivannan-maker / BatteryLifeCyclePredictor

Latest commit to the master branch on 8-22-2021

Download as zip

Credits

Manivannan

Manivannan 

Engineer by profession. Solving Real world problems by Passion.

 

Avnet

This content is provided by our content partner Avnet, a global technology solutions provider with end-to-end ecosystem capabilities. Visit them online for more great content like this.

This article was originally published at Avnet. It was added to IoTplaybook or last modified on 10/08/2021.