0% found this document useful (0 votes)
24 views49 pages

Project Report

The document presents a project report on a web-server-based Battery Management System (BMS) designed for a 4-series lithium-ion battery configuration, focusing on safety, efficiency, and longevity. It includes features for real-time monitoring, SOC estimation, and fault protection, along with a web interface for remote monitoring. The project aims to enhance battery management in electric vehicles and energy storage systems, with potential future enhancements involving AI and wireless diagnostics.

Uploaded by

Swathi K S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views49 pages

Project Report

The document presents a project report on a web-server-based Battery Management System (BMS) designed for a 4-series lithium-ion battery configuration, focusing on safety, efficiency, and longevity. It includes features for real-time monitoring, SOC estimation, and fault protection, along with a web interface for remote monitoring. The project aims to enhance battery management in electric vehicles and energy storage systems, with potential future enhancements involving AI and wireless diagnostics.

Uploaded by

Swathi K S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

A Web Server based Battery Management System

A Project Report
Submitted to the APJ Abdul Kalam Technological University
in partial fulfillment of requirements for the award of degree

in
Electrical and Electronics Engineering
by

K C NEELIMA (PKD21EE033)
RITHIN V(PKD21EE045)
SWATHI K S(PKD21EE051)
BHARATH B(LPKD21EE066)

under the Guidance of

Deepak M
Assistant Professor, Dept of EEE

DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING


GOVERNMENT ENGINEERING COLLEGE PALAKKAD
SREEKRISHNAPURAM
March 2025
DEPARTMENT OF ELECTRICAL ENGINEERING
GOVERNMENT ENGINEERING COLLEGE PALAKKAD

CERTIFICATE
30 March 2025

This is to certify that the report entitled WEB SERVER BASED BATTERY MANAGE-
MENT SYSTEM submitted by K C NEELIMA (PKD21EE033) RITHIN V (PKD21EE045),
SWATHI K S(PKD21EE051), BHARATH B (LPKD21EE066) to the APJ Abdul Kalam Tech-
nological University in partial fulfillment of the B.Tech. degree in Electrical and Electronics
Engineering is a bonafide record of the Project Phase I carried out by them under our guidance
and supervision. This report in any form has not been submitted to any other University or
Institute for any purpose.

Deepak M Abdul Kareem


(Project Guide) (Project Coordinator)
Assistant Professor Assistant Professor
Dr Vinita Chellappan
(Project Coordinator)
Professor

Dr.Lisy E.R
Head of Department
Dept.of EEE
ACKNOWLEDGEMENT

We would like to express our deepest appreciation to all those who provided me the
possibility to complete this report. First and foremost, we express our deepest appreciation
to our esteemed project guide, Asst Prof. Deepak M . His exceptional guidance, unwavering
support, and profound expertise have been invaluable throughout the entire project process.
Their dedication to our academic growth has been a source of inspiration and motivation. We
are also deeply indebted to our project co-ordinator, Asst Prof Abdul Kareem Puthiyaveettil
and Prof Dr Vinita Chellappan for their insightful feedback, constructive criticism, and
valuable suggestions. Their willingness to share their knowledge and expertise has greatly
enhanced the quality of our project work. Their contributions have significantly enriched the
learning experience and have propelled us to a higher level of understanding. We are also
grateful to the HOD, Dr. Lisy E R and all the faculty members of the Electrical Department
for giving us this wonderful opportunity to learn and present the project before the class. We
are immensely indebted to all the people who helped and encouraged us throughout the process
without which the work would not have been possible.

i
ABSTRACT

A Battery Management System (BMS) is a crucial component in modern electric vehicles,


hybrid vehicles, and energy storage systems, ensuring battery safety, efficiency, and longevity.
This project presents the design and implementation of a web-server-based BMS for a 4-series
(4S) lithium-ion battery configuration, integrating real-time monitoring, SOC estimation, and
fault protection mechanisms.
The proposed system features overcharge, over-discharge, overvoltage, undervoltage, and
thermal protection, ensuring safe operation under varying conditions. A combination of passive
balancing and cell bypassing techniques is used to maintain charge uniformity across the battery
cells, improving efficiency and extending battery lifespan. State of Charge (SOC) estimation
is achieved through real-time voltage and current sensing, providing accurate battery health
status.
A web-based interface is integrated into the system, allowing remote monitoring of critical
battery parameters such as voltage, SOC, and temperature. This enables live data visualization,
fault alerts, and proactive battery management, enhancing system reliability. The system also
incorporates a boost converter to regulate voltage levels efficiently, ensuring stable operation
across different load conditions.
The developed BMS offers an intelligent, sustainable, and scalable solution for energy
storage applications, particularly in electric mobility, renewable energy systems, and industrial
power backups. Future enhancements may include AI-based predictive analytics, wireless
diagnostics, and adaptive battery management strategies to further improve efficiency and
sustainability

ii
Contents

Acknowledgement i

Abstract ii

List of Figures vi

List of Tables vii

1 List of Symbols viii

List of Symbols viii

2 Acronyms and Abbreviations ix

Acronyms and Abbreviations ix

3 Introduction 1
3.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3.2 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3.3 Literature Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

4 System Design 4
4.1 System Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.1.1 Block Diagram-Discharging . . . . . . . . . . . . . . . . . . . . . . . 4
4.1.2 Block Diagram-Charging . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.2 Closed Loop Boost Converter Design . . . . . . . . . . . . . . . . . . . . . . . 7
4.2.1 Working Principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.2.2 Closed-Loop Control for Voltage Regulation . . . . . . . . . . . . . . . 8
4.2.3 Tuning of PID Parameters . . . . . . . . . . . . . . . . . . . . . . . . 8

iii
4.2.4 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.3 Battery Bypass Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

5 Simulation Studies 11
5.1 Case 1: Battery Pack Output When Battery 2 and Battery 3 Are Bypassed . . . 11
5.2 Case 2: Boost Converter Output When Battery 2 and Battery 3 Are Bypassed . 12
5.3 Case 3: Battery Pack Output When 3 batteries are Bypassed . . . . . . . . . . . 13
5.4 Case 4: Boost Converter Output When 3 Batteries are Bypassed . . . . . . . . 13

6 State of Charge(SOC) Estimation Technique 16


6.1 OCV-SOC Relationship . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.1.1 Piecewise Modeling of OCV-SOC . . . . . . . . . . . . . . . . . . . . 17

7 Hardware Components 19
7.1 Lithium-ion Battery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
7.2 Temperature Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
7.3 Voltage Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
7.4 Current Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
7.5 4-Channel SPDT Relay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
7.6 Inductor (L) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
7.7 Resistor (R) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7.8 Capacitor (C) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7.9 MOSFET (N-Channel MOSFET - IRF540N) . . . . . . . . . . . . . . . . . . 23
7.10 Diode (Schottky Diode - SS34) . . . . . . . . . . . . . . . . . . . . . . . . . . 24
7.11 Transformer(230/12V) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
7.12 4S LiFePO4 BMS with Passive Balancing . . . . . . . . . . . . . . . . . . . . 24

8 Hardware Implementation 26
8.1 Closed Loop Boost Converter Implementation . . . . . . . . . . . . . . . . . . 26
8.2 Overall Hardware Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
8.3 Web Server Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

9 Appendix 29
9.1 ESP32 Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

iv
9.1.1 Main Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
9.1.2 Sensor Reading and Relay Control . . . . . . . . . . . . . . . . . . . . 32
9.1.3 Web Server Handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

10 Conclusion 37

References 38

v
List of Figures

4.1 Blockdiagram-Discharging . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.2 Block Diagram-Charging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.3 Closed Loop Boost Converter . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.4 Bypassing Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

5.1 Two Battery Bypassed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12


5.2 Boost Converter output when Two batteries bypassed . . . . . . . . . . . . . . 13
5.3 Battery Pack output when three batteries bypassed . . . . . . . . . . . . . . . . 14
5.4 Boost Converter output when 3 batteries bypassed . . . . . . . . . . . . . . . . 15

6.1 OCV-SOC Curve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17


6.2 Piecewise modeling of OCV-SOC Curve . . . . . . . . . . . . . . . . . . . . . 18

7.1 Li-ion Battery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20


7.2 Temperature Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
7.3 Voltage Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
7.4 Current Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
7.5 4 Channel SPDT Relay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7.6 230/12V Transformer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
7.7 4S BMS used for charging . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

8.1 Boost Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26


8.2 Web Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
8.3 Overall Hardware Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

vi
List of Tables

6.1 Voltage Range and Corresponding Equations . . . . . . . . . . . . . . . . . . . 18

7.1 Component Specifications and Quantities . . . . . . . . . . . . . . . . . . . . 19

vii
Chapter 1

List of Symbols

µF Microfarad (Capacitance)
µH Microhenry (Inductance)
Ω Ohm (Resistance)
V Battery pack voltage
SOC State of Charge of battery
T Battery temperature
P Bypass control signals for batteries
S SOC status signals of each battery

viii
Chapter 2

Acronyms and Abbreviations

BMS Battery Management System

MPPT Maximum Power Point Tracking

SOC State of Charge


OCV Open circuit Voltage

MOSFET Metal-Oxide-Semiconductor Field-Effect Transistor

PWM Pulse Width Modulation

ix
Chapter 3

Introduction

A Battery Management System (BMS) is a crucial component in modern energy storage


applications, ensuring the safe and efficient operation of lithium-ion batteries. The BMS is
responsible for monitoring key parameters such as voltage, temperature, and state of charge
(SOC) to prevent potential hazards like overcharging, deep discharging, and overheating. By
continuously analyzing these parameters, the BMS optimizes battery performance, enhances
safety, and extends the overall lifespan of the battery pack.
The significance of a BMS becomes even more apparent in high-power applications such
as electric vehicles (EVs), renewable energy storage systems, and industrial backup power
solutions, where reliability and efficiency are paramount. Without an effective BMS, batteries
are susceptible to degradation, overheating, and even catastrophic failures, leading to financial
and operational losses.
This project aims to implement a web server-based BMS that allows remote real-time
monitoring of battery parameters. The system is designed to bypass faulty batteries whenever
their operational limits are exceeded, thereby improving safety, efficiency, and battery life.
Though the battery is bypassed, we will get a constant output voltage using a closed-loop
boost converter controlled by a PID controller. This ensures that system performance remains
stable even when one or more batteries are bypassed. The web-based interface provides users
with instant access to critical battery data, allowing proactive maintenance and performance
optimization.
Overall, the web server-based BMS provides a comprehensive solution for monitoring
and managing lithium-ion batteries, ensuring maximum performance, safety, and longevity.
Through simulation, hardware implementation, and real-time data analysis, this project
demonstrates the effectiveness of a smart BMS in modern energy applications

1
3.1 Objectives
• Implement a balancing mechanism for the 4S lithium-ion battery pack to prevent voltage
imbalances.

• Develop an accurate state-of-charge (SOC) estimation method using Open Circuit


Voltage (OCV) modeling to monitor battery capacity in real time.

• Integrate overvoltage, overcurrent, and thermal protection strategies to protect the battery
pack from hazardous conditions.

• Establish a web server interface for remote tracking of key battery parameters.

3.2 Problem Statement


• Battery Safety Risks: Overcharging, overheating, and short circuits can cause thermal
runaway, leading to fire hazards and battery damage.

• Efficiency and Lifespan Issues: Cell imbalance causes voltage inconsistencies and
reduced battery lifespan.

• Need for Real-Time Monitoring: Battery performance is affected by environmental


factors, discharge cycles, and load variations. A web-based BMS enables real-time
tracking of voltage, temperature, and SOC for predictive maintenance.

• Scalability Challenges: Managing large battery packs is complex. A BMS provides


modular control, ensuring safe and optimal operation of all cells

3.3 Literature Review


The literature on Battery Management Systems (BMS) in electric vehicles (EVs) em-
phasizes the system’s vital role in ensuring battery safety, reliability, and longevity. Key
functionalities of BMS include State of Charge (SOC), State of Health (SOH), and State of Life
(SOL) monitoring, which are crucial for preventing issues like overcharging, over-discharging,
and overheating [1]. Techniques such as Coulomb counting, Kalman filtering, and data-driven
models are widely used for SOC estimation, with each method having unique advantages

2
[2]. Thermal management is also a critical area, as maintaining optimal temperature prevents
battery degradation and hazards. Recent studies highlight the importance of cell balancing
and explore hybrid models that combine electro-thermal simulations with machine learning to
improve SOC and SOH predictions [3]. While significant advances have been made, challenges
remain in achieving real-time accuracy under varying conditions, pointing to ongoing research
in predictive algorithms and adaptive BMS solutions for sustainable EV deployment [1][3].

3.4 Summary
The project focuses on the development of a Battery Management System (BMS) designed
for lithium-ion batteries.The BMS is essential for ensuring battery safety, reliability, and
performance by managing critical parameters such as voltage, current, temperature, and State of
Charge (SOC). The project objectives include achieving cell balancing for a 4-cell (4s) battery
pack by combination of switched shunt resistor method and bypassing method,implementing
SOC estimation techniques, and providing over-voltage, under-voltage, and over-discharge
protection to extend battery life and prevent hazards. The system design incorporates various
hardware components such as an ESP32 microcontroller for remote monitoring, temperature
sensors, current and voltage sensors, and MATLAB-based simulations to model and control
battery behavior. Core functionalities of the BMS include real-time monitoring, SOC
estimation through Coulomb counting, and temperature regulation. Additionally, the BMS
algorithm balances the battery cells by identifying and compensating for the cell with the lowest
charge. The project ultimately aims to demonstrate the effectiveness of BMS in enhancing
battery safety, supporting energy efficiency, and promoting sustainability in electric vehicle
applications.

3
Chapter 4

System Design

4.1 System Architecture


The system architecture of the Web-Based Battery Management System (BMS) is designed
to ensure safe and efficient operation of a 4S lithium-ion battery pack while maintaining
a constant output voltage using a closed-loop boost converter with a PID controller. The
architecture consists of multiple components working together to achieve real-time monitoring,
protection, and regulation of the battery system. The BMS continuously measures voltage,
temperature, and state of charge (SOC) of each battery cell, ensuring that any cell exceeding its
operational limits is bypassed to prevent overcharging, deep discharging, or thermal runaway.
Despite bypassing a faulty cell, the boost converter dynamically adjusts the output voltage
to maintain a stable supply, using a PID controller for precise regulation. Additionally, the
system features passive balancing and active cell bypassing techniques to ensure uniform
charge distribution and prolong battery lifespan. The web-based interface allows remote
access to critical battery parameters, enabling users to monitor real-time performance, detect
anomalies, and implement predictive maintenance. This architecture integrates MATLAB-
based simulations and hardware implementations to validate its efficiency, making it a reliable
and scalable solution for energy storage applications such as electric vehicles and renewable
energy systems.

4.1.1 Block Diagram-Discharging

The block diagram (Figure 2.1) represents the system architecture during the discharging
phase of the 4-series (4s) lithium-ion battery pack. It highlights the flow of power, data,
and control signals among the key components, ensuring efficient power delivery to the load

4
Figure 4.1: Blockdiagram-Discharging

while maintaining safety and real-time monitoring. Below is a detailed explanation of each
component and its role in the system:
4S Battery Pack:

• Comprises four lithium-ion cells connected in series, providing a higher voltage output.

Microcontroller:

• Serves as the central processing unit, responsible for monitoring battery parameters such
as voltage, SOC, and temperature.

• Controls the relay-based bypass mechanism to remove faulty or discharged cells from
the circuit.

• Adjusts the PWM (Pulse Width Modulation) signals to the boost converter, ensuring a
stable output voltage.

• Sends real-time data to the web server for remote monitoring and predictive maintenance.

Relay (Bypassing Mechanism):

• Used to isolate and bypass any battery cell if it reaches a critical state.

5
• Prevents damage to the entire battery pack while ensuring that power delivery to the load
remains unaffected.

Closed-Loop Boost Converter :

• The PID (Proportional-Integral-Derivative) controller ensures that the output voltage


remains constant, regardless of fluctuations in the battery pack voltage.

Load:

• Represents the device or system consuming power from the battery pack.

Web Server:

• Enables remote monitoring of battery parameters, such as voltage, SOC, and temperature,
ensuring users are always aware of battery health.

4.1.2 Block Diagram-Charging

The given block diagram represents the charging system for a lithium-ion battery pack,
ensuring controlled and efficient power conversion from an AC supply to a regulated DC output
suitable for charging. The system incorporates various power conversion stages to provide the
required voltage and current for safe and efficient battery charging.
AC Supply:

• The system operates from a standard 230V AC supply, which is converted to a lower
voltage suitable for charging the battery pack.

230V/12V, 1.5A Transformer:

• Steps down the high-voltage AC supply (230V) to 12V AC at 1.5A current.

Rectifier:

• Converts the 12V AC output of the transformer into pulsating DC voltage using a bridge
rectifier.

Filter:

• Smoothens the pulsating DC from the rectifier using capacitors or inductors, reducing
ripples and providing a steady DC voltage.

6
Figure 4.2: Block Diagram-Charging

Boost Converter (12V - 16.8V):

• Steps up the filtered 12V DC voltage to a range of 12V - 16.8V to match the required
charging voltage for the 4S lithium-ion battery pack.

Charger Module:

• Regulates the charging process by controlling the voltage and current delivered to the
battery pack.

Battery Pack:

• Stores the electrical energy for later use in discharging operations.

4.2 Closed Loop Boost Converter Design


A boost converter is a DC-DC power converter that steps up a lower input voltage to a
higher, regulated output voltage. In this project, a closed-loop boost converter is designed
to maintain a constant output voltage of 18V, even when the input voltage varies between
3.6V to 14.4V. To achieve this, a PID (Proportional-Integral-Derivative) controller dynamically
adjusts the PWM (Pulse Width Modulation) duty cycle from 10-90% to regulate the operation
of the IRFZ44N MOSFET, which serves as the high-speed switch. A Schottky diode (SS34),
rated for 40V and 3A, is used as a freewheeling diode to allow continuous current flow when
the MOSFET switches off.The circuit operates at a switching frequency of 30kHz, balancing
efficiency and component size. The PID controller continuously monitors the output voltage
and adjusts the PWM signal to maintain stability, ensuring optimal power delivery to the load.

7
Figure 4.3: Closed Loop Boost Converter

4.2.1 Working Principle

The boost converter operates based on energy storage in an inductor (249µH). When the
MOSFET (S) is turned ON, current flows through the inductor, storing energy in the form of
a magnetic field. When the MOSFET is turned OFF, the inductor releases this stored energy,
which, in combination with the input voltage, results in a higher voltage at the output. A diode
ensures unidirectional current flow, while a capacitor (220µF) smooths the output voltage by
reducing ripples.

4.2.2 Closed-Loop Control for Voltage Regulation

To maintain a constant 18V output, a feedback mechanism is implemented. The output


voltage (Vo) is continuously measured and compared with the reference voltage. The PID
controller calculates the error (ve), which is the difference between the actual and desired
output voltage. Based on this error, the controller adjusts the PWM duty cycle to regulate
the MOSFET switching, ensuring that the output voltage remains stable despite variations in
the input voltage.

4.2.3 Tuning of PID Parameters

The efficiency and performance of the closed-loop system depend on the appropriate tuning
of the PID controller parameters: Proportional gain (Kp), Integral gain (Ki), and Derivative gain
(Kd). These parameters are optimized using a trial-and-error method to minimize overshoot,
enhance stability, and reduce response time. Proper tuning ensures a smooth and accurate
voltage regulation process.

8
4.2.4 Design

Frequency, f = 30KHz (4.1)

InputVoltage, V s = 3.6V (4.2)

OutputVoltage, Vo = 18V (4.3)

Vs
DutyCycle, D = 1 − (4.4)
Vo

RippleCurrent, ∆IL = 0.1 × Io (4.5)

RippleVoltage, ∆Vc = 0.01 × Vo (4.6)

Vo
Outputcurrent, Io = = 0.125 (4.7)
R

Resistance, R = 145ohm (4.8)

Vs · D
Inductor, L = = 249 µH (4.9)
f · ∆IL

Io · D
Capacitor, C = = 220 µF (4.10)
f · ∆Vc

4.3 Battery Bypass Circuit


The bypassing circuit is designed to monitor and manage the operation of four lithium-
ion batteries by real-time monitoring of voltage, temperature, and state of charge (SOC). This
circuit ensures that whenever a battery exceeds its set parameter limits, it is bypassed using
relays to prevent system failure and enhance safety. The circuit is controlled using an ESP32

9
Figure 4.4: Bypassing Circuit

microcontroller and Arduino Uno, which process the sensor data and activate bypassing relays
accordingly.

10
Chapter 5

Simulation Studies

In this section, the simulation results of the proposed Battery Management System (BMS)
for a four-cell lithium-ion battery pack are presented. The simulation was conducted using
MATLAB/Simulink to analyze battery behavior, boost converter performance, and bypass
operation under various conditions

5.1 Case 1: Battery Pack Output When Battery 2 and


Battery 3 Are Bypassed
Figure 5.1: Battery Pack Output When Battery 2 and Battery 3 Are Bypassed

• In this scenario, Battery 2 and Battery 3 are bypassed due to either a low state of charge
(SOC), overtemperature, or another fault condition.

• The system detects that these batteries are below the safe operating threshold and
activates the corresponding bypass switches (SPDT switches).

• As a result, only Battery 1 and Battery 4 remain in operation, forming a reduced series
connection.

• The total pack voltage decreases since only two batteries are contributing to the output.

• The current distribution shifts accordingly, ensuring that the load still receives power
from the available batteries.

• This demonstrates the functionality of the Battery Management System (BMS) in


dynamically managing battery availability based on real-time conditions

11
Figure 5.1: Two Battery Bypassed

5.2 Case 2: Boost Converter Output When Battery 2 and


Battery 3 Are Bypassed
Figure 5.2: Boost Converter Output for the Same Condition

• With two batteries bypassed, the input voltage to the boost converter is lower than the
nominal full-pack voltage.

• The boost converter compensates for this reduction by increasing its duty cycle to
maintain a stable output voltage for the load.

• The waveform in the figure shows how the converter adjusts to the new input voltage and
stabilizes the output.

• The steady output voltage confirms that the power management strategy effectively
maintains system performance despite bypassing two batteries.

12
Figure 5.2: Boost Converter output when Two batteries bypassed

5.3 Case 3: Battery Pack Output When 3 batteries are


Bypassed
Figure 5.3: Battery Pack Output When three batteries are Bypassed

• In this case, only Battery 3 is removed from the circuit due to a fault condition.

• The remaining batteries (Battery 1, Battery 2, and Battery 4) continue to supply power to
the system.

• The total pack voltage reduces slightly, but not as much as when two batteries are
bypassed.

• The dynamic switching mechanism in the BMS ensures a smooth transition without
affecting system performance.

5.4 Case 4: Boost Converter Output When 3 Batteries are


Bypassed
Figure 5.4: Boost Converter Output for the Same Condition

13
Figure 5.3: Battery Pack output when three batteries bypassed

• The boost converter receives a slightly reduced input voltage compared to the full pack
scenario.

• It adjusts its duty cycle accordingly to maintain a steady and regulated output voltage.

• The waveform indicates minimal fluctuations, proving that the converter effectively
compensates for the loss of one battery.

• If 3 batteries was removed due to overheating, the system prevents excessive load on the
remaining batteries by balancing the current distribution.

14
Figure 5.4: Boost Converter output when 3 batteries bypassed

15
Chapter 6

State of Charge(SOC) Estimation


Technique

State of Charge (SOC) is a critical parameter in a Battery Management System (BMS),


representing the remaining capacity of a battery as a percentage of its total capacity. Accurate
SOC estimation is essential for ensuring battery safety, optimizing performance, and extending
lifespan, particularly in lithium-ion batteries used in energy storage and electric vehicle
applications. SOC estimation helps prevent overcharging or deep discharging, both of which
can degrade battery health or lead to hazardous conditions like thermal runaway.
In this project, SOC estimation is a key objective, enabling real-time monitoring of the
battery’s charge level during discharging. The approach adopted here relies on the relationship
between Open Circuit Voltage (OCV) and SOC, a widely used method due to its simplicity
and effectiveness when combined with appropriate modeling techniques. This chapter details
the methodology, mathematical modeling, and validation of the SOC estimation technique
developed for the 4S lithium-ion battery configuration.

6.1 OCV-SOC Relationship


The Open Circuit Voltage (OCV) of a battery is the voltage measured across its terminals
when no current is flowing (i.e., at rest). OCV is a function of SOC, meaning that as the SOC
increases, the OCV also increases, though this relationship is non-linear and influenced by
factors such as battery chemistry, temperature, and aging. For lithium-ion batteries, the OCV-
SOC curve typically exhibits a steep rise at low and high SOC levels, with a flatter region in
the middle, making precise estimation challenging without proper modeling.
In this project, the OCV-SOC relationship serves as the foundation for SOC estimation.

16
Figure 6.1: OCV-SOC Curve

By measuring the OCV of the battery at various states of charge, we can infer the SOC
using a pre-established model. OCV-SOC Relationship illustrates this dependency, showing
a characteristic curve derived from experimental or reference data for the 18650 lithium-ion
cells used (2000 mAh capacity). The curve highlights how OCV varies from approximately
3.0 V at low SOC to over 4.1 V at full charge, with distinct regions of behavior that require
careful analysis.

6.1.1 Piecewise Modeling of OCV-SOC

To improve the accuracy of SOC estimation across the full range of battery operation,
a piecewise linear modeling approach was developed. The non-linear OCV-SOC curve was
segmented into five distinct voltage ranges, each approximated by a linear equation of the form
y = mx + C, where y is the OCV (in volts), x is the SOC (in percentage), m is the slope, and c
is the intercept. This method simplifies computation while maintaining sufficient precision for
real-time applications.
Figure 6.2 visually represents this segmentation, showing how the curve is divided into
linear sections. The specific equations for each range are derived from experimental data.
The piecewise model was implemented in the BMS to calculate SOC based on real-time OCV
measurements from the voltage sensors (0–25 V range). For a given OCV value, the system

17
Figure 6.2: Piecewise modeling of OCV-SOC Curve

identifies the corresponding voltage range and applies the appropriate equation to estimate
SOC. This approach balances computational simplicity with accuracy.

Table 6.1: Voltage Range and Corresponding Equations

Voltage Range (V) Equation Description


3.0747 - 3.4712 y = 0.0199x + 2.9623 Low SOC (0% - 20%), steep OCV increase
3.4712 - 3.6396 y = 0.0113x + 3.1830 Mid-low SOC (20% - 40%), moderate slope
3.6396 - 4.0606 y = 0.00941x + 3.2591 Flat region (40% - 80%), minimal OCV change
4.0606 - 4.0913 y = 0.00309x + 3.79765 Narrow range (80% - 90%), slight slope
4.0913 - 4.1617 y = 0.01416x + 2.7453 Final segment (90% - 100%), sharp OCV rise

18
Chapter 7

Hardware Components

COMPONENT SPECIFICATIONS QUANTITY


Lithium-ion Battery 18650, 2000mAh 4
Temperature Sensor Temperature range 0-50°C 4
Voltage Sensor Operating Voltage 0-25V 4
Current Sensor Operating Current 0-20A 1
4 Channel SPDT Relay Operating Voltage 5V 1
Inductor 249µH 1
Capacitor 220µF 1
Resistor 145 ohm 1

Table 7.1: Component Specifications and Quantities

7.1 Lithium-ion Battery


• Specifications: 18650, 2000 mAh

• Quantity: 4

• Description: The lithium-ion battery used is an 18650 cylindrical cell with a capacity
of 2000 mAh (milliampere-hours). These batteries are widely adopted due to their
high energy density (150–250 Wh/kg), fast charge/discharge rates (1C–5C for charging
and 5C–20C for discharging), and long cycle life (1000–3000 cycles). In this project,
four such batteries are configured in a 4-series (4S) arrangement to achieve the required
voltage level for the system. The BMS monitors these batteries for voltage, temperature,
and State of Charge (SOC) to ensure safety and optimal performance during discharging.

• Role: Serves as the primary energy storage unit, providing power to the load while being
monitored and managed by the BMS.

19
Figure 7.1: Li-ion Battery

Figure 7.2: Temperature Sensor

7.2 Temperature Sensor


• Specifications: Temperature range 0–50°C

• Quantity: 4

• Description: The temperature sensor is designed to measure the temperature of each


lithium-ion battery within a range of 0 to 50°C. This range is suitable for typical operating
conditions of lithium-ion batteries, where overheating (beyond 45–60°C) can lead to
thermal runaway or degradation. One sensor is dedicated to each of the four batteries
in the 4S configuration, enabling individual monitoring to detect anomalies such as
overheating due to overcharging or short circuits.

• Role: Ensures battery safety by providing real-time temperature data to the BMS,
triggering protective actions (e.g., bypassing a faulty battery) if thresholds are exceeded.

7.3 Voltage Sensor


• Specifications: Operating Voltage 0–25 V

• Quantity: 4

20
Figure 7.3: Voltage Sensor

• Description: The voltage sensor is capable of measuring voltages in the range of 0 to 25


V, which accommodates the combined voltage of the 4S battery pack (nominal voltage
14.8 V, fully charged 16.8 V). Each sensor is assigned to one of the four batteries to
monitor individual cell voltages. This allows the BMS to detect overcharging (voltage
¿ 4.2 V per cell) or deep discharge (voltage ¡ 3.12 V per cell), both of which can
compromise battery lifespan and safety.

• Role: Provides precise voltage data for cell balancing, SOC estimation, and fault
detection, ensuring uniform performance across the battery pack.

7.4 Current Sensor


• Specifications: Operating Current 0–20 A

• Quantity: 1

• Description: The current sensor measures the total current flowing through the battery
pack during charging and discharging, with a capacity of up to 20 A. This range
supports high-power applications where lithium-ion batteries may deliver discharge rates
of 5C–20C (e.g., 10–40 A for a 2000 mAh battery at higher C-rates). A single sensor is
sufficient to monitor the cumulative current of the 4S configuration, providing data for
SOC estimation and power management.

21
Figure 7.4: Current Sensor

• Role: Tracks current to calculate power delivery, detect short circuits.

7.5 4-Channel SPDT Relay


• Specifications: Operating Voltage 5 V

• Quantity: 1

• Description: The 4-channel Single Pole Double Throw (SPDT) relay operates at 5 V and
is used to control the connection or bypassing of individual batteries in the 4S pack. Each
channel corresponds to one battery, allowing the BMS to isolate faulty cells (e.g., due to
overvoltage, undervoltage, or overheating) while maintaining system operation with the
remaining cells. The relay’s 5 V operation is compatible with standard microcontroller
outputs used in the BMS.

• Role: Facilitates battery protection and cell balancing by enabling dynamic bypassing of
faulty batteries, ensuring uninterrupted operation and enhanced safety.

7.6 Inductor (L)


The 249 µH inductor is a key component of the closed-loop boost converter, designed to
step up the input voltage from 3.6 V to 18 V. It stores energy during the ON phase and releases

22
Figure 7.5: 4 Channel SPDT Relay

it during the OFF phase, ensuring efficient power transfer. Its value was calculated based on a
30 kHz switching frequency and a ripple current of 0.1 times the output current.

7.7 Resistor (R)


The 145-ohm resistor serves as the load in the boost converter circuit, drawing an output
current of approximately 0.124 A at 18 V. It was selected to simulate a practical load for testing
the system’s power delivery and efficiency. This component helps validate the boost converter’s
performance under realistic conditions.

7.8 Capacitor (C)


The 220 µF capacitor smooths the output voltage of the boost converter, reducing ripple to
1% of the 18 V output. It was calculated based on the duty cycle, output current, and 30 kHz
switching frequency. This component ensures a stable power supply to the load, enhancing
system reliability.

7.9 MOSFET (N-Channel MOSFET - IRF540N)


The IRF540N is an N-channel MOSFET used for high-speed switching applications. It
operates by allowing current to flow between the Drain and Source when a positive voltage
is applied to the Gate. In this project, it is used in the Boost Converter for efficient
voltage regulation and in the Battery Management System (BMS) to enable battery bypassing

23
Figure 7.6: 230/12V Transformer

when needed. Its low on-resistance and high efficiency make it ideal for power electronics
applications.

7.10 Diode (Schottky Diode - SS34)


The SS34 is a Schottky diode known for its low forward voltage drop and fast recovery
time, making it suitable for high-frequency power applications. In this project, it is used in
the Boost Converter to prevent reverse current flow, ensuring efficient power conversion. Its
high-speed switching reduces energy losses, improving overall system efficiency

7.11 Transformer(230/12V)
The transformer in the battery charging system is a 230V/12V, 1.5A step-down unit that
converts the 230V AC mains supply to a safer 12V AC output. With a power rating of 18W, it
feeds the rectifier stage, which then processes the voltage for charging the battery pack. Likely
a linear transformer operating at 50/60 Hz, it features a turns ratio of approximately 19.17:1
and is constructed with primary and secondary windings on a laminated iron core to minimize
losses.

7.12 4S LiFePO4 BMS with Passive Balancing


The 4S LiFePO4 BMS is an essential component for the safe and efficient charging of
the 4-cell lithium iron phosphate (LiFePO4) battery pack. It regulates voltage and current,

24
Figure 7.7: 4S BMS used for charging

ensuring overcharge protection, over-discharge prevention, and short-circuit safety. The passive
balancing feature helps equalize voltage levels across all cells by dissipating excess energy from
higher-charged cells, enhancing battery performance and lifespan.

25
Chapter 8

Hardware Implementation

8.1 Closed Loop Boost Converter Implementation


A closed-loop boost converter was implemented to step up the 3.6V output from a lithium-
ion battery to a stable 18V, powering the Battery Management System (BMS) efficiently.
Designed with a 30 kHz switching frequency, 249 µH inductor, and 220 µF capacitor,
it maintains a ripple voltage below 0.18V for a 0.124A load (145 ). An N-channel
MOSFET, Schottky diode, and PID-controlled microcontroller ensure stable operation, with
the inductor storing energy during the ON phase and releasing it to the output during the
OFF phase. Assembled on a PCB and tested against an open-loop setup, the closed-loop
configuration delivered consistent 18V output , with transient response validated across duty
cycles ,enhancing the BMS’s reliability for real-time monitoring and battery protection.

Figure 8.1: Boost Circuit

26
Figure 8.2: Web Server

8.2 Overall Hardware Setup


The overall hardware setup of the web server-based BMS integrates a 4S lithium-ion battery
pack (18650, 2000 mAh), a closed-loop boost converter, sensors, relays, and a microcontroller
on a custom PCB. The boost converter steps up 3.6V to 18V (0.124A, 145 ) using a 249 µH
inductor, 220 µF capacitor, MOSFET, and Schottky diode, controlled by a 30 kHz PID signal.
Voltage (0–25V) and temperature (0–50°C) sensors monitor cells, a current sensor (0–20A)
tracks load, and a 5V relay bypasses faulty cells. The microcontroller processes data, drives
the converter, and hosts a web server for real-time voltage, temperature, and SOC display.
Validated by stable output and bypass tests it ensures efficiency, safety, and remote monitoring.

8.3 Web Server Integration


The web server integration enhances the Battery Management System (BMS) by enabling
remote access to real-time battery parameters. Hosted on a microcontroller, the web server
interfaces with the hardware via GPIO pins, collecting data from four voltage sensors, four
temperature sensors, and a 0–20A current sensor. Powered by the boost converter’s stable 18V
output, the microcontroller processes this data and determines the State of Charge (SOC) using
a piecewise OCV-SOC model. The server, accessible over Wi-Fi, presents voltage, temperature,
and SOC on a user-friendly HTML interface with real-time updates. In addition, it monitors the
status of the relay the relay for battery bypass, allowing users to remote the health and safety
of the system.safety of the system.

27
Figure 8.3: Overall Hardware Setup

28
Chapter 9

Appendix

9.1 ESP32 Source Code


This appendix contains the complete source code for the ESP32-based web server and
battery monitoring system. The code integrates sensor readings, relay control, and a web
interface for real-time monitoring of the 4S lithium-ion battery pack.

9.1.1 Main Program

The main program initializes the Wi-Fi connection, sensors, and web server, then continu-
ously monitors and updates the system state.

Listing 9.1: ESP32 Main Program

# i n c l u d e <WiFi . h>
# i n c l u d e <WebServer . h>
# i n c l u d e ”DHT . h ”

/ / WiFi c r e d e n t i a l s
const char * s s i d = ” Virus I n f e c t e d ”;
c o n s t c h a r * p a s s w o r d = ” Th1ad2ag3at4ha5n@ ” ;

/ / C r e a t e a web s e r v e r on p o r t 80
WebServer s e r v e r ( 8 0 ) ;

/ / DHT11 t e m p e r a t u r e s e n s o r p i n s and s e t u p
# d e f i n e DHTPIN1 4 // F i r s t s e n s o r on GPIO4

29
# d e f i n e DHTPIN2 5 / / Second s e n s o r on GPIO5
# d e f i n e DHTPIN3 12 / / T h i r d s e n s o r on GPIO12
# d e f i n e DHTPIN4 13 / / F o u r t h s e n s o r on GPIO13
# d e f i n e DHTTYPE DHT11 / / DHT11 t y p e f o r a l l s e n s o r s

// Initialize a l l f o u r DHT s e n s o r s
DHT d h t 1 ( DHTPIN1 , DHTTYPE ) ;
DHT d h t 2 ( DHTPIN2 , DHTTYPE ) ;
DHT d h t 3 ( DHTPIN3 , DHTTYPE ) ;
DHT d h t 4 ( DHTPIN4 , DHTTYPE ) ;

/ / Voltage sensor analog inputs


# d e f i n e V1 32
# d e f i n e V2 33
# d e f i n e V3 25
# d e f i n e V4 26

/ / Relay d i g i t a l o u t p u t s
# d e f i n e RELAY1 23
# d e f i n e RELAY2 22
# d e f i n e RELAY3 19
# d e f i n e RELAY4 18

/ / Temperature t h r e s h o l d for s a f e t y c u t o f f
# d e f i n e MAX SAFE TEMP 4 5 . 0

/ / ADC and v o l t a g e c a l c u l a t i o n p a r a m e t e r s
f l o a t R1 = 3 0 0 0 0 . 0 , R2 = 7 5 0 0 . 0 ;
float ref voltage = 3.3; / / ESP32 r e f e r e n c e v o l t a g e
f l o a t BV1 , BV2 , BV3 , BV4 , SOC1 , SOC2 , SOC3 , SOC4 ;
f l o a t temp1 , temp2 , temp3 , temp4 ;

30
void setup ( ) {
S e r i a l . begin (115200);
S e r i a l . p r i n t l n ( ” \ n \ n==== ESP32 B a t t e r y M o n i t o r i n g System ====”);
Serial . p r i n t l n (” I n i t i a l i z i n g . . . ” ) ;

// I n i t i a l i z e DHT s e n s o r s
dht1 . begin ( ) ;
dht2 . begin ( ) ;
dht3 . begin ( ) ;
dht4 . begin ( ) ;

pinMode ( RELAY1 , OUTPUT ) ;


pinMode ( RELAY2 , OUTPUT ) ;
pinMode ( RELAY3 , OUTPUT ) ;
pinMode ( RELAY4 , OUTPUT ) ;

d i g i t a l W r i t e ( RELAY1 , LOW) ;
d i g i t a l W r i t e ( RELAY2 , LOW) ;
d i g i t a l W r i t e ( RELAY3 , LOW) ;
d i g i t a l W r i t e ( RELAY4 , LOW) ;

/ / C o n n e c t t o Wi− F i
S e r i a l . p r i n t ( ” C o n n e c t i n g t o Wi− F i n e t w o r k : ” ) ;
Serial . println ( ssid );
WiFi . b e g i n ( s s i d , p a s s w o r d ) ;
w h i l e ( WiFi . s t a t u s ( ) != WL CONNECTED) {
delay (500);
Serial . print (”.”);
}
S e r i a l . p r i n t l n ( ” \ nWiFi C o n n e c t e d S u c c e s s f u l l y ! ” ) ;
S e r i a l . p r i n t ( ” IP Address : ” ) ;
S e r i a l . p r i n t l n ( WiFi . l o c a l I P ( ) ) ; / / P r i n t ESP32 I P a d d r e s s

31
/ / D e f i n e Web S e r v e r R o u t e
s e r v e r . on ( ” / ” , h a n d l e R o o t ) ;
server . begin ( ) ;
S e r i a l . p r i n t l n ( ” Web S e r v e r S t a r t e d ! ” ) ;
S e r i a l . p r i n t l n ( ” System Ready ! ” ) ;
printSerialHeader ();
}

void loop ( ) {
readSensors ( ) ;
controlRelays ( ) ;
printSerialData ();
server . handleClient ( ) ;
delay (2000); / / DHT11 n e e d s a t l e a s t 1 s b e t w e e n r e a d i n g s
}

9.1.2 Sensor Reading and Relay Control

This section reads sensor data and controls the relays based on voltage and temperature
thresholds.

Listing 9.2: Sensor Reading and Relay Control Functions

void readSensors ( ) {
/ / Read t e m p e r a t u r e s from DHT11 s e n s o r s
temp1 = d h t 1 . r e a d T e m p e r a t u r e ( ) ;
temp2 = d h t 2 . r e a d T e m p e r a t u r e ( ) ;
temp3 = d h t 3 . r e a d T e m p e r a t u r e ( ) ;
temp4 = d h t 4 . r e a d T e m p e r a t u r e ( ) ;

/ / H a n d l e NaN v a l u e s i f s e n s o r s f a i l t o r e a d
i f ( i s n a n ( temp1 ) ) temp1 = 0 . 0 ;
i f ( i s n a n ( temp2 ) ) temp2 = 0 . 0 ;

32
i f ( i s n a n ( temp3 ) ) temp3 = 0 . 0 ;
i f ( i s n a n ( temp4 ) ) temp4 = 0 . 0 ;

/ / Read v o l t a g e s
f l o a t a d c 1 = ( a n a l o g R e a d ( V1 ) * r e f v o l t a g e ) / 4 0 9 5 . 0 ;
f l o a t a d c 2 = ( a n a l o g R e a d ( V2 ) * r e f v o l t a g e ) / 4 0 9 5 . 0 ;
f l o a t a d c 3 = ( a n a l o g R e a d ( V3 ) * r e f v o l t a g e ) / 4 0 9 5 . 0 ;
f l o a t a d c 4 = ( a n a l o g R e a d ( V4 ) * r e f v o l t a g e ) / 4 0 9 5 . 0 ;

BV1 = a d c 1 * ( R1 + R2 ) / R2 ;
BV2 = a d c 2 * ( R1 + R2 ) / R2 − BV1 ;
BV3 = a d c 3 * ( R1 + R2 ) / R2 − ( BV1 + BV2 ) ;
BV4 = a d c 4 * ( R1 + R2 ) / R2 − ( BV1 + BV2 + BV3 ) ;

/ / E s t i m a t e SOC
SOC1 = ( ( BV1 − 3 . 0 ) / ( 4 . 2 − 3 . 0 ) ) * 1 0 0 . 0 ;
SOC2 = ( ( BV2 − 3 . 0 ) / ( 4 . 2 − 3 . 0 ) ) * 1 0 0 . 0 ;
SOC3 = ( ( BV3 − 3 . 0 ) / ( 4 . 2 − 3 . 0 ) ) * 1 0 0 . 0 ;
SOC4 = ( ( BV4 − 3 . 0 ) / ( 4 . 2 − 3 . 0 ) ) * 1 0 0 . 0 ;

SOC1 = c o n s t r a i n ( SOC1 , 0 , 1 0 0 ) ;
SOC2 = c o n s t r a i n ( SOC2 , 0 , 1 0 0 ) ;
SOC3 = c o n s t r a i n ( SOC3 , 0 , 1 0 0 ) ;
SOC4 = c o n s t r a i n ( SOC4 , 0 , 1 0 0 ) ;
}

void controlRelays ( ) {
/ / Store previous relay s t a t e s
b o o l prevR1 = d i g i t a l R e a d (RELAY1 ) ;
b o o l prevR2 = d i g i t a l R e a d (RELAY2 ) ;
b o o l prevR3 = d i g i t a l R e a d (RELAY3 ) ;
b o o l prevR4 = d i g i t a l R e a d (RELAY4 ) ;

33
/ / Battery 1 control
i f ( temp1 > MAX SAFE TEMP ) {
d i g i t a l W r i t e ( RELAY1 , HIGH ) ;
} else {
d i g i t a l W r i t e ( RELAY1 , ( BV1 > 3 . 1 && BV1 <= 4 . 2 ) ? LOW : HIGH ) ;
}

/ / Battery 2 control
i f ( temp2 > MAX SAFE TEMP ) {
d i g i t a l W r i t e ( RELAY2 , HIGH ) ;
} else {
d i g i t a l W r i t e ( RELAY2 , ( BV2 > 3 . 1 && BV2 <= 4 . 2 ) ? LOW : HIGH ) ;
}

/ / Battery 3 control
i f ( temp3 > MAX SAFE TEMP ) {
d i g i t a l W r i t e ( RELAY3 , HIGH ) ;
} else {
d i g i t a l W r i t e ( RELAY3 , ( BV3 > 3 . 1 && BV3 <= 4 . 2 ) ? LOW : HIGH ) ;
}

/ / Battery 4 control
i f ( temp4 > MAX SAFE TEMP ) {
d i g i t a l W r i t e ( RELAY4 , HIGH ) ;
} else {
d i g i t a l W r i t e ( RELAY4 , ( BV4 > 3 . 1 && BV4 <= 4 . 2 ) ? LOW : HIGH ) ;
}
}

9.1.3 Web Server Handler

This section defines the HTML interface for remote monitoring.

34
Listing 9.3: Web Server Handler Function

void handleRoot ( ) {
S t r i n g h t m l = ”< html ><head ><meta h t t p − e q u i v = ’ r e f r e s h ’ c o n t e n t = ’ 2 ’ / > ” ;
h t m l += ”< t i t l e > B a t t e r y M o n i t o r i n g </ t i t l e > ” ;
h t m l += ”< s t y l e > ” ;
h t m l += ” body { f o n t − f a m i l y : A r i a l , s a n s − s e r i f ; m a r g i n : 20 px ; } ” ;
h t m l += ” t a b l e { b o r d e r − c o l l a p s e : c o l l a p s e ; w i d t h : 100%; } ” ;
h t m l += ” t h , t d { b o r d e r : 1 px s o l i d # ddd ; p a d d i n g : 8 px ; t e x t − a l i g n : l
h t m l += ” t h { b a c k g r o u n d − c o l o r : #4CAF50 ; c o l o r : w h i t e ; } ” ;
h t m l += ” . c r i t i c a l { b a c k g r o u n d − c o l o r : # f f c c c c ; } ” ;
h t m l += ” . w a r n i n g { b a c k g r o u n d − c o l o r : # f f f 2 c c ; } ” ;
h t m l += ” . good { b a c k g r o u n d − c o l o r : # c c f f c c ; } ” ;
h t m l += ” </ s t y l e > </ head > ” ;
h t m l += ”<body > ” ;
h t m l += ”<h2> B a t t e r y M o n i t o r i n g System </ h2 > ” ;

h t m l += ”< t a b l e > ” ;
h t m l += ”< t r ><t h > P a r a m e t e r </ t h ><t h > B a t t e r y 1 </ t h ><t h > B a t t e r y 2 </ t h ><t h

/ / B a t t e r y V o l t a g e Row
h t m l += ”< t r ><t d >V o l t a g e </ t d > ” ;
h t m l += ”< t d c l a s s = ’” + g e t V o l t a g e C l a s s ( BV1 ) + ” ’ >” + S t r i n g ( BV1 , 2 )
h t m l += ”< t d c l a s s = ’” + g e t V o l t a g e C l a s s ( BV2 ) + ” ’ >” + S t r i n g ( BV2 , 2 )
h t m l += ”< t d c l a s s = ’” + g e t V o l t a g e C l a s s ( BV3 ) + ” ’ >” + S t r i n g ( BV3 , 2 )
h t m l += ”< t d c l a s s = ’” + g e t V o l t a g e C l a s s ( BV4 ) + ” ’ >” + S t r i n g ( BV4 , 2 )

/ / SOC Row
h t m l += ”< t r ><t d > S t a t e o f Charge </ t d > ” ;
h t m l += ”< t d c l a s s = ’” + g e t S O C C l a s s ( SOC1 ) + ” ’ >” + S t r i n g ( SOC1 , 1 ) +
h t m l += ”< t d c l a s s = ’” + g e t S O C C l a s s ( SOC2 ) + ” ’ >” + S t r i n g ( SOC2 , 1 ) +
h t m l += ”< t d c l a s s = ’” + g e t S O C C l a s s ( SOC3 ) + ” ’ >” + S t r i n g ( SOC3 , 1 ) +
h t m l += ”< t d c l a s s = ’” + g e t S O C C l a s s ( SOC4 ) + ” ’ >” + S t r i n g ( SOC4 , 1 ) +

35
/ / T e m p e r a t u r e Row
h t m l += ”< t r ><t d >T e m p e r a t u r e </ t d > ” ;
h t m l += ”< t d c l a s s = ’” + g e t T e m p C l a s s ( temp1 ) + ” ’ >” + S t r i n g ( temp1 , 1 )
h t m l += ”< t d c l a s s = ’” + g e t T e m p C l a s s ( temp2 ) + ” ’ >” + S t r i n g ( temp2 , 1 )
h t m l += ”< t d c l a s s = ’” + g e t T e m p C l a s s ( temp3 ) + ” ’ >” + S t r i n g ( temp3 , 1 )
h t m l += ”< t d c l a s s = ’” + g e t T e m p C l a s s ( temp4 ) + ” ’ >” + S t r i n g ( temp4 , 1 )

h t m l += ” </ t a b l e > ” ;
h t m l += ”<p> L a s t u p d a t e d : ” + g e t T i m e S t r i n g ( ) + ” </ p > ” ;
h t m l += ” </ body > </ html > ” ;

s e r v e r . send (200 , ” t e x t / html ” , html ) ;


}

36
Chapter 10

Conclusion

• Successfully designed and implemented a real-time web-based Battery Management


System (BMS).

• Monitors voltage, SOC, temperature, sensor status, relay status, and shutdown reasons
for a four-series lithium-ion battery pack.

• Bypasses faulty or critically discharged batteries using SPDT switches, ensuring uninter-
rupted operation.

• Enhances battery safety and lifespan by preventing overcharging, deep discharge, and
overheating.

• Web-based interface enables remote monitoring, improving convenience and real-time


decision-making.

• Suitable for Electric Vehicles (EVs) and renewable energy storage systems, optimizing
performance and reliability.

37
References

[1] K. Liu, K. Li, Q. Peng, and C. Zhang, ”A brief review on key technologies in the battery
management system of electric vehicles,” Frontiers Mech. Eng., vol. 14, no. 1, pp. 47–64,
Mar. 2019.

[2] B. Balasingam, M. Ahmed, and K. Pattipati, ”Battery management systems—Challenges


and some solutions,” Energies, vol. 13, no. 11, p. 2825, Jun. 2020.

[3] J. Meng, G. Luo, M. Ricco, M. Swierczynski, D.-I. Stroe, and R. Teodorescu, ”Overview of
lithium-ion battery modeling methods for state-of-charge estimation in electrical vehicles,”
Appl. Sci., vol. 8, no. 5, p. 659, Apr. 2018.

38

You might also like