Introduction

EVs have gained significant reach in recent years due to emerging issues about greenhouse gas emission, global warming, and the fossil fuel depletion. This is mostly because EVs provide superior performance and efficiency. EVs have gained significant acceptance in the automotive industry as a very promising alternative for decreasing emissions of carbon dioxide and addressing worldwide environmental concerns. Lithium-ion (Li-ion) batteries have attracted significant interest in the field of electric vehicles because to its advantageous characteristics, including their lightweight nature, rapid charging capabilities, high energy density, minimal self-discharge, and extended lifespan1.

Fig. 1
figure 1

Categories of BMS components.

The battery has become the primary energy storage device due to the rapid advancements in smart grid technologies and EVs, gaining considerable attention2. As battery technology advances rapidly, with the development of cells that have greater energy and power densities, it is equally crucial to enhance the performances of the BMS to ensure that the battery remains a safe, dependable, and cost-effective option3. Figure 1 categorizes BMS components by hardware and software structure. The degradation of the EV’s battery leads to significant investments and a restricted operational distance. Li-ion, ultracapacitors, metal/nickel-hydride, and lead-acid batteries, are suitable for use in hybrid EVs, plug-in hybrid EVs, and EVs4. Lithium-ion batteries are commonly utilized in EVs due to their low self-discharge rate during energy storage5. A substantial power storage capacity and an extremely high energy density to weight ratio are two of the distinguishing characteristics of a lithium-ion battery6. To minimize physical damage, aging, and thermal runaways, lithium-ion batteries must be operated carefully due to their extended lifespan and efficiency. Thus, an effective BMS that measures, estimates, and regulates battery’s State of Charge (SOC) is critically required. BMSs have equipped with sensors, controllers, actuators, and controlled by models, algorithms, and signals as displayed in Fig. 2.

Fig. 2
figure 2

Block view of BMS model.

Many researchers have suggested the BMS model in numerous manners. Typically, the EV use battery cells with very modest capacity and voltage. Initially, the individual battery cells must be assembled and incorporated into a battery module. The EV’s battery system typically consists of one or more modules, depending on the specific needs. The battery system typically has several individual cells, numbering in the hundreds or thousands. The BMS plays a crucial role in effectively handling many cells. The BMS has the capability to regulate the battery’s operations through activities such as monitoring its performance, estimating its current condition, safeguarding its integrity, reporting relevant data, and ensuring its balance7. The BMS in EV consists of a variety of sensors, actuators, and controllers, which are equipped with different algorithms and signal wires. The BMS in EVs has three primary functions8.

  • To safeguard the cells and battery packs from potential damage.

  • To ensure the batteries function within the appropriate voltage and temperature range, it is important to prioritize safety and maximize their longevity.

  • To ensure that the batteries remain in a condition where they can meet the vehicle’s operational needs.

BMS methods encompass several estimations, such as the state of health (SOH), SOC, state of power (SOP), state of energy (SOE), and state of life (SOL). The BMS is a software and hardware system designed to regulate batteries and enhance their efficiency9. The deployment of BMS plays a crucial role in regulating the cooling and heating of batteries in electric vehicles, thus enhancing the durability and dependability of the battery performance. To manage the BMS efficiently and correctly in EVs, it is essential to precisely predict the SOC, Remaining Useful Life (RUL), and SOH of a lithium-ion battery. An erroneous prediction of SOC might result in issues such as excessive heat generation, excessive charging, and excessive discharging10. Furthermore, if the estimates of the RUL and SOH of the battery are not correct, it might lead to either replacing the battery early or waiting until it fails completely, which would increase the overall cost11. IoT is currently having an immense effect on industry, society, and everyday life12. Improving energy efficiency is currently a strategy employed to tackle significant global challenges such as air pollution, energy security, climate change, and economic instability, among others13. An intelligent BMS that makes use of modern technologies like the IoT, artificial intelligence (AI), cloud computing, and data science is utilized in the design and development process to address concerns regarding the battery’s safety14.

Problem statement

Over the years, automotive engineers and researchers have developed advanced simulation and analytical methodologies for the components and complete systems of electric vehicles. These methodologies have progressively improved in sophistication and accuracy. The progress in sensor technology, IoT devices, and network technologies has allowed offline physical resources to be transformed into digital models. This transformation enables the implementation of smart systems for monitoring, prediction, and rescheduling of maintenance events, identification of failure locations, determination of failure endurance, and estimation of remaining essential lifetime15. The utilization of AI methods has the capacity to greatly improve the functionality and efficiency of BMS in EVs. The use of AI-powered BMS in EVs provides a multitude of advantages, such as enhanced energy efficiency, safety, performance, and user satisfaction, while simultaneously contributing to the longevity of the battery. AI systems possess many beneficial characteristics in contrast to conventional methodologies. AI approaches, in comparison to conventional model-based frameworks, necessitate less expertise and demand less development time for the creation of intricate battery systems. Moreover, they exhibit high efficacy when enough data is available and have outstanding efficiency in handling uncertainties like as noise, temperature variations, and aging impacts. Additionally, they possess autonomous learning capabilities to carry out parameterization tasks efficiently and perform rapid online execution16. This research integrates IoT, ML, and Blockchain in a unified BMS framework. The proposed work aims to develop a complete architecture that leverages IoT-enabled data collection, charging prediction using XGBoost, power scheduling using GWO, and secure communication through a permissioned blockchain employing homomorphic encryption.

Research objectives

The integration of EVs with the smart grid takes place within a wireless network. Nevertheless, this form of wireless connection brings up certain security apprehensions, including the possibility of manipulating power use, power accessibility, and the utilization of EVs. Hence, the integration of a security solution is vital for effectively managing EV energy. Ensuring data integrity is crucial for maintaining uninterrupted power availability at a power station. As a result, the study methodology has used blockchain technology to guarantee the authenticity and reliability of the data. Contrary to the present data integrity approach, the blockchain method offers decentralized data integrity and instantly informs users of any alterations. Consequently, it is unfeasible for anybody to alter the current information utilizing blockchain technology. Similarly, the procedure of data verification is carried out in an easy way. Furthermore, it has the capacity to manage a huge volume of users. Thus, the utilization of blockchain technology for data transfer has been considered beneficial in this research.

The research work’s major objectives are stated as follows:

  • To employ the IoT, ML, and BC to cooperatively develop an energy efficient BMS model for EVs. The present intelligent transportation systems get advantages from this synchronized energy management.

  • To enhance EV services, a charging station identification technique based on XGBoost is utilized to forecast EV power consumption and demand.

  • To utilize the power scheduling technique with GWO to efficiently allocate EV power and minimize waiting time. The model’s optimal scheduling approach equitably allocates EV charging time, hence minimizing EV delay and congestion.

  • To apply homomorphic encryption to ensure the security of communication in the EV-smart grid system in the research model. This approach reduces communication overhead.

Novelty & contributions

This section discusses the novelty and contributions of the present research that varies from the previous works carried out for EV BMS:

  • Accurate cost-aware charging station detection - XGBoost attained a better accuracy for predicting the nearest charging station based on vehicle SOC, travel distance, and preferences of the user, thereby outperforming ANN, SVM, RF, DRL, and LightGBM models.

  • Power scheduling optimization through GWO - The GWO algorithm is implemented to reduce EV waiting and congestion at charging stations, ensuring fair energy allocation. This is a more efficient approach than the existing scheduling techniques such as FCFS, equal sharing, or power-balancing.

  • Enhancing security on the Blockchain with homomorphic encryption - While there has been a study of blockchain-based BMS solution, this work makes a unique integration of a permissioned blockchain with HE, minimizing communication latency when compared to other models but still retaining strong force resistances against intrusion from unauthorized users or third parties.

  • Holistic Performance Evaluation - The proposed model is evaluated not just with charging station detection accuracy but also with scheduling efficiency, charging cost analysis, and communication overhead, offering a multi-dimensional improvement over existing studies.

These contributions together will establish an innovation for the smart BMS proposed that can act as a scalable, secure, and energy-efficient solution in the vehicular ecosystem in real time.

The following sections of this work are organized as follows: The second section of the paper examines previous studies on EV-BMS models, the use of ML methods, and the estimate of SOC and SOH. The paper discusses the implementation of a BMS for EVs utilizing IoT, XGBoost, and BC with homomorphic encryption. The details of this implementation can be found in Sect. 3 of the paper. Section 4 provides a comprehensive examination and interpretation of the research model’s results. The research is concluded in Sect. 5, which also discusses potential future enhancements.

Literature review

This section provides a comprehensive overview of existing works in EV-BMS employing ML techniques. It explores various dimensions such as SOC and SOH estimation, fault tolerance mechanisms, and energy management strategies. Additionally, the integration of IoT and deep learning technologies for secure data transactions is examined. This synthesis aims to offer insights into the current landscape of EV BMS research, emphasizing methodologies, innovations, and identify research gaps that pave the way for proposed model.

A machine learning technique was used in17 to construct an enhanced SOC estimator for dependable BMS in EVs. The training samples obtained in driving cycles-based testing of the Li-ion battery was initially partitioned utilizing a fuzzy C-means (FCM) based on genetic algorithm clustering approach. The approach outcome was utilized to get knowledge about the structure and initial conditions of the model. The recursive least-square method was subsequently utilized for extracting the subsequent parameters. The backpropagation learning model was ultimately chosen to maximize both the prior and subsequent parameters, ensuring high accuracy and robustness. The experiments revealed that this estimator has adequate precision.

It was demonstrated in18 that the advanced fault tolerance techniques can improve EV battery performance. Examining BMS and integrating creative fault tolerance mechanisms has shown that EV batteries could be made more reliable, safe, and long-lasting. This study’s technical demonstrations, numerical data, and test results demonstrated the efficiency. Redundancy-based fault tolerance approaches like dual-channel temperature monitoring and cell balancing reduced thermal runaway incidents, improving EV battery safety. The trials also increased battery cycle life, exceeding industry requirements. ML algorithms for maintenance prediction reduced unexpected maintenance occurrences. Advanced fault tolerance systems extend driving range by 10% because of more efficient energy use and management of battery health.

Accurately measuring and calculating the various conditions of the battery’s cells like the SOC and SOH, was the challenging process due to the inability to physically monitor them. The study19 investigated several ML methodologies for evaluating the SOH and SOC of the batteries. The applied methodologies include of linear regression, support vector machines (SVM), random forest (RF), gradient boosting, extreme gradient boosting (XGBoost), light gradient boosting (light-GBM). Compared to every model used in the work, the prediction of discharge performed utilizing RF demonstrated superior performance with minimal loss of accuracy. This study demonstrated that ML techniques can accurately forecast the estimation state of batteries. This prediction capability could be integrated with a BMS to enhance the performance of EVs.

A reinforcement learning (RL) -based method and a deep RL-based method was developed in20 for effectively managing the energy consumption of a series hybrid electric tracked vehicle. A novel variant of the RL technique Dyna, referred to as Dyna-H, was created by integrating the heuristic phase of planning with the Dyna agent. This approach was employed in the domain of controlling energy management for hybrid EV. To address the “curse of dimensionality” problem in RL, an algorithm called deep Q-learning (DQL) was developed for control of energy management. This approach utilized an optimization technique called Adaptive Moment Estimation with a Guaranteed Improvement (AMSGrad) to update the neural network’s weights. Subsequently, this deep RL control system was trained and validated under various driving conditions with exceptional accuracy.

An energy management technique based on deep RL was proposed in21 for EV hybrid battery systems with high-power and high-energy battery packs. The thermal and electrical evaluation of the battery cells was used to build the hybrid battery system’s energy management approach to minimize energy loss and increase thermal and electrical safety. A unique reward term was designed to explore the high-power pack’s optimal working range without a charge state limitation. To minimize overfitting, the DQL model was trained with unpredictable load profiles. The results demonstrated that this technique reduced loss and improved safety.

The utilization of a Wireless BMS (WBMS) model was discussed in22 to effectively manage battery cells in EVs. As a factor in the experiment configuration, IoT devices equipped with voltage sensors were deployed onto the battery cells. The sensors performed constant monitoring of the voltage levels and relay the data wirelessly to a central monitoring station. The results demonstrated that this WBMS system was highly effective and precise in determining the SOC based on voltage readings.

An ML-based energy management technique was proposed in23 for fuel cell hybrid EVs. To maximize vehicle efficiency, this model optimized energy flow and used between the fuel cell system, battery pack, and other energy storage devices. This research used SVM, K-Nearest Neighbors (KNN), and Naive Bayes to improve energy management. Combining classifier methods improved energy management strategy (EMS) performance. Based on vehicle speed, battery SOC, and other characteristics, the algorithms estimated the ideal power flow. The study found that all the algorithms performed well in energy management.

The study24 presented a RL model for the EMS of hybrid EVs. The DQL utilized a hierarchical, Deep Q-Learning with Hierarchical Action Spaces (DQL-H) framework to provide the ideal solution for energy management. By employing this new RL technique, the issue of limited reward signals during the training phase was addressed, while also attaining the optimal allocation of power. Furthermore, DQL-H, functioning as a hierarchical algorithm modified the vehicle environment exploration process, hence enhanced its effectiveness. The findings demonstrated that this approach achieved better training efficiency and reduced fuel usage.

A battery pack model and advanced BMS were presented in25. Thus, this work built a battery pack using the battery cell model and parameters. The single-cell concept increased capacity and voltage by connecting cells in series and parallel. For SOC estimate, the Extended Kalman Filter (EKF) and a cooling plate at the battery pack’s bottom were recommended for safety. Controlling coolant liquid flow lowered battery temperature. The BMS’s filter-based SOC estimate, accurate coolant-flow-control system, and passive cell balance approach were the model’s main factors. This combination of factors ensured the battery pack’s safety and excellent performance in difficult real-world settings.

A control framework that utilized Model-based Q-learning was proposed in26 to address the optimum control issue of hybrid EVs. As an online EMS technique, this model could acquire knowledge about the specific driving conditions and dynamically adjust the policy of control with learning. In particular, the model distinguished between the external driving and internal powertrain environment, allowing them to be learned separately using the RL framework. This approach led to a control strategy that was simpler and more intuitive and could be defined using the vehicle state approximation model. The simulation findings show a near optimal outcome.

The research in27 developed a system, which consisted of solar photovoltaics, energy storage devices, and EVs. While demand response (DR) strategies were examined in several research works, the assessment of the influence of active DR on operational expense was overlooked. This work explored the combination of renewable energy with storage systems, considering demand responses mechanism like time of use (ToU), critical peak pricing (CPP), and real-time pricing (RTP). The model was represented by the linear approach and simulated utilizing linear programming (LP). Results obtained from real-time pricing demonstrated a higher level of savings correlated to the ToU and CPP systems. The achieved outcomes decreased the operational expenses and discharges of greenhouse gas, demonstrating the effectiveness of the system.

A Subtractive Clustering-based Adaptive Neuro-Fuzzy Inference System (SC-ANFIS) was developed in28 as a SOC estimate technique. Temperature, current, requested and available power, real power loss, battery thermal, and cooling air temperature factor were input parameters for SC-ANFIS SOC estimate. The SOC estimate model was trained and tested using data from 10 driving cycles. The findings showed that the model outperformed Elman neural network and neural network-based approaches in accuracy. Better SOC estimate results and lower absolute estimation error than 0.1% were achieved with the SC-ANFIS technique.

The study29 predicted the battery SOC using six ML algorithms: SVM, Artificial Neural Network (ANN), Gaussian Process Regression (GPR), Linear Regression (LR), and ensemble boosting and bagging. The ML methods investigated the non-linear translation of voltage and current input characteristics to SOC estimate. The battery SOC was estimated using ML methods since they handle non-linear data better. After tweaking GPR-linear model hyperparameters, the technique could estimate SOCs in real time. It was concluded that the ANN and GPR-based technique improved SOC estimates more due to probability distribution than point estimation.

An improved deep neural network (DNN) was implemented to propose a SOC estimate model for Li-ion batteries for EVs in30. It was observed that a DNN with enough hidden layers could predict unseen drive cycle SOC during training. To test their performance on different driving cycles, the DNN models were created with varied numbers of hidden layers and training algorithms. It was found that DNN with 4 hidden layers reduced inaccuracy and improved SOC estimate. Additional hidden layers increased error rate. This work showed that a four-hidden layer model trained on dynamic stress tests driving cycles predicts SOC values well.

Research gap analysis

The reviewed existing works show substantial development in EV-BMS using ML technique. Currently, research focuses on SOC estimates, fault tolerance, energy management, and IoT integration. However, a research gap analysis suggests certain topics for future study. First, while ML methods like SVM, RF, KNN, and deep RL have been successful in SOC estimation and energy management, comparative studies are needed to evaluate their performance across different driving conditions and battery types. Some studies acknowledge the integration of BC with IoT for safe and transparent transactions and data monitoring, but they do not examine their risks and security measures. The suggested systems’ scalability and adaptation to real-world settings with different driving circumstances and user behaviors need additional study. Finally, safety-critical applications like EV battery management infrequently address ML model explainability and interpretability issues. There are research gaps that require comparison studies on ML models, complete analysis of integrated systems’ vulnerabilities and security measures, and scalability and adaptation to varied real-world settings.

Proposed research model

System modelling

An IoT sensors-based gathering of EV data, an XGBoost-based classifier algorithm and EV requirements prediction, a power scheduling algorithm based on GWO according to these requirements, and a secure transmission between EVs and charging stations are all components of the research model. The most important aspect of EVs is the management of their batteries effectively. Therefore, the blockchain might theoretically be used to construct BMS, which would be driven by homomorphic encryption to ensure its security. In addition to continuously monitoring the condition of the EV’s electrical system, the system also sends warning signals to the user depending on a few different parameters. Quantification of the SOC of the EV was the major goal of the BMS. The SOC provides extensive data on the BMS, which includes accurate measurements of power consumption and equilibrium. It is essential to evaluate the SOH to determine the current condition of the battery and any problems that may be related with it. It is possible to get the most effective utilization of electricity with the least amount of effort when the SOH is good. Consequently, the SOH and SOC have a major influence on the rate at which EVs are adopted.

As represented in Fig. 3, for EV data collection, IoT sensors capture information such as SOC, SOH, charge requests, and EV location data. The information that was gathered is then processed and saved in a database so that it can be analyzed further. To do predictive analysis, the data is sent into the XGBoost classifier. This allows for the evaluation of EV power consumption and demand. The predictions indicate that the power scheduling algorithm that is based on the GWO algorithm optimally distributes energy to EVs, hence decreasing delays and congestion. The generation of blocks in the blockchain is the method that is used to record transactions in a safe manner, which guarantees the accurate representation of data. Blockchain technology with homomorphic encryption makes it possible for EVs to communicate securely with charging stations. This secure connection helps to avoid tampering and ensures that data integrity is maintained.

Fig. 3
figure 3

Workflow of the proposed research model.

Hardware setup

To test the feasibility of the smart BMS framework, a hardware prototype was designed using smart sensors interfaced with the microcontroller. The setup essentially had three layers:

  • IoT Sensors Layer – Swindon Silicon System (SSS) sensors were interfaced with the EV battery pack for monitoring SOC, SOH, voltage, and current parameters.

  • Processing Layer – The processing was done using a Raspberry Pi 4 Model acting as the microcontroller, which received sensor data through its General-Purpose Input/Output (GPIO) pins. The data were then preprocessed by a Python program and uploaded to a cloud database for analysis.

  • Communication and Control Layer – Data packets were transmitted over Wi-Fi to the cloud, where charging requirement prediction would be carried out by the XGBoost classifier. After this, data processed would be used for optimal charging station allocation via the GWO scheduler and finally secured using permissioned blockchain with HE.

Fig. 4
figure 4

Pin diagram of raspberry Pi with IoT sensors.

Figure 4 depicts the pin diagram of Raspberry Pi 4 with detailed IoT sensor connections. The voltage and current sensors are interfaced via I²C using pins 3 (SDA) and 5 (SCL). The temperature sensor (DS18B20) is connected to pin 7 (GPIO4, One-Wire). SOC/SOH estimation modules are mapped via either I²C (pins 3 and 5) or SPI (pins 19, 21, 23, 24). Communication with the Wi-Fi gateway is handled through UART pins 8 (TX) and 10 (RX). Power and ground connections are provided using pins 2 (5 V), 1 (3.3 V), and 6/9 (GND). A 5 V Power and ground (GND) pin setup helps supply voltage and offer reference potential to all sensors connected to the bus. The I²C Serial Data (SDA) and Serial Clock (SCL) pins are used for setting up an I²C communication bus wherein more than one sensor such as SOC and SOH monitors communicate to send data at a time. Universal Asynchronous Receiver (UART RX) and Transmitter (UART TX) pins are used for serial communication, which involves serial data transmission and reception between the Raspberry Pi and external modules, and are often useful in debugging or logging data in real time. Furthermore, the Serial Peripheral Interface (SPI) Bus is supported with three main connections: Master Out Slave-In (MOSI) features data out from the Pi to sensors, Master-In Slave Out (MISO) acts as data input for sensors, and Serial Clock (SCLK) provides the clock to synchronize with the data. Hence, the GPIO ports of Raspberry Pi are configured for receiving SOC, SOH, voltage, current, and temperature data from the SSS and IoT modules, pre-processing them locally, and then passing them to the Cloud for XGBoost-based classification and GWO scheduling. As a result, this ensures very efficient low-latency communication linkage between the EV battery pack and the smart BMS framework.

Fig. 5
figure 5

Hardware setup of developed BMS model.

The actual hardware setup of the proposed Smart BMS is shown in Fig. 5, depicting the entire flow of data and control from the EV battery to a secure blockchain network. The actual hardware setup of the proposed research consists of an integrated battery management prototype built on an Arduino IoT module interfaced with multiple sensors and peripheral components. The system receives 230 V, 50 Hz input supply, which is regulated through a voltage regulator to provide safe operating voltage levels. A voltage sensor and a current sensor continuously monitor battery charging and discharging parameters, while a temperature sensor tracks thermal conditions to ensure battery safety. A relay module and switches control the charging process, and a 3.7 V Li-ion battery pack acts as the primary energy storage unit, connected to a load for testing power delivery. The collected sensor data is processed by the Arduino IoT module, enabling real-time monitoring and control, while also forming the foundation for integration with the proposed IoT–machine learning–blockchain framework for intelligent battery management. Processed data are transmitted wirelessly through a Wi-Fi router or gateway to external systems for in-depth analysis. In the backend, the incoming data are stored in the Cloud Database, and the machine learning operation is carried out, with the XGBoost classifying charging requirements and the GWO scheduling charging slots to avoid long waiting times and congestion. Then, charging stations with optimized data and scheduling results are recorded into a permissioned blockchain with HE, assuring tamper-proof storage, trusted authentication, and fair price transactions between the EV users and the charging stations, thereby building a layered hardware–software platform on the practicality and durability of the smart BMS prototype into the actual EV ecosystem.

Data collected from IoT sensors

In the research model, the SSS was a main sensor tool of the Internet of Things that measured the SOH and SOC of EVs. The SSS, which serves as the power pack for EVs, gathers important information on the health and energy levels of the vehicles. A database for storing and managing essential data, the XGBoost classifier for predictive analysis, a power scheduling based on GWO for optimal energy allocation, and a block generation mechanism for secure transaction recording are all components of the system that has been presented. Additional components include a block generation mechanism. SOC, charge request, and the position of the EV are the inputs. To determine the charging condition, the research model makes use of EVs that are equipped with SSS31. The first step in determining the threshold value (\(\:ThV\)) involves considering the charging routine of the user (\(\:ChRo\)) as well as the distance travelled (\(\:DST\)) by EVs. For determining the value of \(\:ThV\), the Eq. (1) is employed.

$$\:ThV=ChRo\cup\:DST$$
(1)

The \(\:DST\) and \(\:ChRo\) values are utilized in the calculation of the \(\:ThV\) value done by the SSS. There is a wide range of variation in the \(\:ChRo\) value across users. For this reason, the value of \(\:ChRo\) is determined by the user in accordance with their own individualized needs. Depending on the distance travelled, the amount of charge that is required is likewise changed. Based on these variables, the user is responsible for determining the fixed value of the \(\:ThV\). It is possible to do the calculation of an estimate for the charge request (\(\:ChRq\)) in the following manner:

$$\:ChRq=\left\{\begin{array}{c}1,\:\:SOC<ThV\\\:0,\:\:SOC>ThV\end{array}\right.$$
(2)

To determine the number of the charging station for the EVs that is connected to the SSS, a SOC was utilized. To have an estimate of the SOC of the EV, the following equation is applied.

$$\:SOC\left(I\right)=SOC\left({I}_{o}\right)+\frac{1}{{C}_{nom}}{\int\:}_{{I}_{o}}^{I}\left({I}_{bat}\left(\tau\:\right)-{I}_{loss}\left(\tau\:\right)\right)d\tau\:\times\:100\%$$
(3)

The initial state of charge was represented by the term \(\:SOC\left({I}_{o}\right)\), the nominal capacity was designated by the term \(\:{C}_{nom}\), the discharging/charging current of the battery was provided by the term \(\:{I}_{bat}\), and the current that was utilized by loss processes was represented by the term \(\:{I}_{loss}\). \(\:{I}_{loss}\) accounts for the aggregate loss current due to auxiliary loads, balancing circuits, and leakage. The SOC is obtained by integrating the net current over time and normalizing by the nominal capacity, expressed as a percentage. A comparison was made between the measured SOC and the threshold value to ascertain the charge that was still present.

In addition to SOC, the proposed framework considers the SOH, which reflects the long-term degradation and remaining usable capacity of the battery. SOH is commonly defined as the ratio between the present effective capacity and the rated nominal capacity at beginning of life:

$$\:SOH\left(t\right)=\frac{{C}_{eff}\left(t\right)}{{C}_{nom}}\times\:100\%$$
(4)

Here, \(\:{C}_{eff}\left(t\right)\) is the effective capacity measured or estimated at time \(\:t\). SOH estimation is performed by tracking capacity fade and internal resistance growth across charge–discharge cycles. Practically, \(\:{C}_{eff}\left(t\right)\) can be obtained from periodic full charge–discharge tests, coulomb counting over known depth-of-discharge cycles, or empirical aging models calibrated with experimental data. A decreasing SOH indicates loss of usable capacity, which is critical for reliable RUL prediction and scheduling decisions. In the workflow (Fig. 2), SOH is used alongside SOC and temperature as an input to the battery capacity estimation block, thereby ensuring that aging effects are reflected in charging and scheduling strategies.

Therefore, the coefficient of reliability (\(\:ChRe\)) was increased if the value of SOC was either lower than or comparable to the threshold values that were set (\(\:ChRe=1\)); otherwise, the \(\:ChRe\) remained the same. The state of this SOC was monitored continuously by the SSS, and a notification alarm was triggered if the SOC’s condition achieved a threshold that was either lower than or comparable to the threshold amount. Following the production of the alert, the SOC value, the location of the EV, and the \(\:ChRe\) are all sent to the database. An analysis of the input value collected from Internet of Things sensors will be performed by the database, which will then supply the information to both the charging station and the XGBoost classification system. The database analyzed the geographical location of EVs as well as the amount of charge capacity that was still available – required mileage (\(\:ReCh\)). The following approach might be utilized to determine the mileage of the EV.

$$\:Mil\left(ReCh\right)=\frac{SOC}{Mil}$$
(5)

Using the following equation, it can be determined how long it takes for the EV to charge.

$$\:{Ch}_{time}=\frac{{Bat}_{cp}\:\bullet\:\:\left(1-SOC\right)\:\bullet\:\:ADC}{{Eff}_{c}\:\bullet\:\:{Ch}_{t}}$$
(6)

The capacity of the battery was denoted by \(\:{Bat}_{cp}\), the quantity of discharge was denoted by \(\:ADC\), the efficiency was denoted by \(\:{Eff}_{c}\), and the type of charger was denoted by \(\:{Ch}_{t}\). If the EV’s mileage was either lower than or equal to the required mileage (\(\:ReCh\)), the database will note that the EV needs to be charged promptly. In any other case, the EV can look for an appropriate charging station if it has sufficient time. If a vehicle needed charging immediately, the request was forwarded to the charging stations that were located nearest to the vehicle, without taking into consideration the cost of charging. XGBoost was used to do classification on the input if it was not otherwise used32.

This research model is based on well-established concepts, which contribute to its increased efficiency. EVs that are equipped with SSS deliver real-time SOH and SOC statistics. This information is processed and then preserved in a centralized database so that it can be retrieved and analyzed with ease. To optimize charging schedules and estimate charging charges, the predictive modelling-XGBoost classifier makes predictions regarding charging parameters. An equitable allocation of power to EVs is ensured by power scheduling, which also helps to reduce time delays and congestion. Based on the predictions made by the XGBoost classifier, this scheduling strategy was developed. To safeguard communication between EVs and smart grids, the research model employs generation of block and blockchain technology. According to the findings of the research, this enables the protection of transactional data and solves security problems. With the aid of the SSS and XGBoost predictive modelling, the proposed research offers a comprehensive system that assists EVs in effectively managing their energy use. The use of blockchain technology with homomorphic encryption-based power scheduling enhances the reliability and security of the system, providing a firm platform for intelligent and energy-efficient mobility.

XGBoost classifier

An ensemble of classification and regression trees (CART) serves as the foundation for XGBoost, a classification method that is a revolutionary approach. The gradient boosting algorithm is utilized in XGBoost to optimize the trees. XGBoost has gained significant popularity in several research domains due to its successful performance in multiple ML approaches. The gradient boosted decision trees technique initially employs an initial-order Taylor expansion, however the XGBoost model enhances the loss function by using the second-order Taylor expansion. Additionally, normalization was employed by the objective functions to mitigate overfitting and decrease the complexity of the procedure. Furthermore, XGBoost exhibited a high degree of flexibility, allowing users to specify their optimization objectives and evaluation criteria. However, the XGBoost classifier is capable of effectively handling imbalanced training data by assigning weights to different classes. XGBoost was an adaptable and adaptive optimization technique that uses tree structures. It can improve algorithm performance, efficiently handling sparse data, minimizing processing time and memory use for large-scale data33. The XGBoost model can be expressed as follows. Let the following to be the equation of the output of a tree.

$$\:f\left(x\right)={w}_{q}\left({x}_{i}\right)$$
(7)

Here, \(\:x\) represents the input vectors and \(\:{w}_{q}\) was the leaf score \(\:q\) that corresponds to it. Following was an expression that will be used to express the group of K tree’s output.

$$\:{y}_{i}=\sum\:_{k=1}^{K}{f}_{k}\left({x}_{i}\right)$$
(8)

When the XGBoost algorithm was executed at step t, it attempts to minimize the associated objective function. When considering a training data set \(\:T=\left\{\left({x}_{1},{y}_{1}\right),\:\left({x}_{2},{y}_{2}\right),\dots\:,({x}_{n},{y}_{n})\right\},\:{x}_{i}\in\:{R}^{m},\:{y}_{i}\in\:R\), which contains n samples, the objective function may be defined in the following equation, which is a representation of the function.

$$\:obj\left(\theta\:\right)=\sum\:_{i}^{n}l\left({y}_{i},{\widehat{y}}_{i}\right)+\sum\:_{t=1}^{T}\varOmega\:\left({f}_{t}\right)$$
(9)

Here, the initial term is the function of training loss \(\:l\) (for example, the mean square error) among the input \(\:{y}_{i}\) and output class \(\:{\widehat{y}}_{i}\) for the n data, and the next term was the regularization that regulates the model’s difficulty and allows for the prevention of overfitting. An equation of how the complexity is defined in XGBoost is expressed as follows.

$$\:\varOmega\:\left({f}_{t}\right)=\varUpsilon\:T+\frac{1}{2}\lambda\:\sum\:_{j=1}^{T}{w}_{j}^{2}$$
(10)

In the above equation, T represents the total number of leaves, γ represents the pseudo-regularization hyperparameter that varies based on the data, and λ represents the L2 norm for leaf weights. Through the utilization of gradients for the second order approximation of the loss function and the identification of the optimum weights w, the optimal value of the objective function may be represented as follows.

$$\:obj\left(\theta\:\right)=-\frac{1}{2}\sum\:_{j=1}^{T}\frac{{\left({\sum\:}_{i\in\:I}{g}_{i}\right)}^{2}}{{\sum\:}_{i\in\:I}{h}_{i}+{\uplambda\:}}+{\upgamma\:}\text{T}$$
(11)

The loss function estimated can be determined by utilizing the Taylor expansions of the objective function.

$$\:{L}^{\left(t\right)}\simeq\:\sum\:_{i=1}^{k}\left[l\left({y}_{i},{\widehat{y}}^{\left(t-1\right)}\right)+{g}_{i}{f}_{t}\left({x}_{i}\right)+\frac{1}{2}{h}_{i}{f}_{t}^{2}\left({x}_{i}\right)\right]+\varOmega\:\left({f}_{t}\right)$$
(12)

Here, \(\:{g}_{i}={\partial\:}_{{\widehat{y}}^{\left(t-1\right)}}l\left({y}_{i},{\widehat{y}}^{\left(t-1\right)}\right)\) indicates all the samples first derivative and \(\:{h}_{i}={{\partial\:}^{2}}_{{\widehat{y}}^{\left(t-1\right)}}l\left({y}_{i},{\widehat{y}}^{\left(t-1\right)}\right)\) indicates all the samples next derivative, and the loss function just required the first and second derivatives of all elements of data34.

For n number of times

Construct a tree by iteratively adding nodes that reflect individual features until the tree reaches its maximum depth.

i. Determine the optimal point of division

ii. Determine the weight for the two newly created leaves

The tree undergoes pruning to remove nodes with negative gain in an ascending order

End for

To generate predictions using a model, the XGBoost algorithm is widely employed. XGBoost is a methodology employed in classification and regression methods to enhance prediction results and minimize errors by reducing bias. As a result of the research model, the charging station zone is restricted to a radius of 50 km, and any distance that is greater than 50 km is not taken into consideration for the assessment. If the value of \(\:ChRe\) is equal to or lower than the value of charge available (\(\:ChAv\)), and the price of the charge is lower than or equal to the user’s anticipated price in accordance with this limitation, then the classifier will choose the charging station as the conclusion. The classifier also takes into consideration the data from the succeeding charging stations; nonetheless, the most effective charging station is identified. The purpose of this research is to investigate the route that results in the lowest distance between the EV and the charging station. In the end, the power scheduling is given input that includes information on charging stations as well as customer preferences.

Power scheduling using GWO

The behavior of grey wolves and their hunting strategy, which is expressed as an optimization technique, served as inspiration for the mechanism that underpins grey-wolf optimization. Alpha (\(\:\alpha\:\)), beta (\(\:\beta\:\)), delta (\(\:\delta\:\)), and omega (\(\:\omega\:\)) are the four levels that make up the social hierarchy with which grey wolves are organized. The member of the grey wolf pack who holds the position of \(\:\alpha\:\) was the most senior member of the social order. \(\:\alpha\:\) wolves were primarily responsible for providing advice to \(\:\beta\:\) wolves. In the hierarchy of wolves, the level that was located among \(\:\beta\:\) and \(\:\omega\:\) wolves were the one that the \(\:\delta\:\) wolf belongs to. The \(\:\omega\:\) wolves were contained within the final level of the hierarchy35. To solve the Power Scheduling Problem, the GWO method has been implemented. During the process of developing GWO, it is necessary to mathematically represent the social behavior of wolves. This can be accomplished by treating the fittest solution as \(\:\alpha\:\), the second fittest solution as \(\:\beta\:\), and the third fittest solution as \(\:\delta\:\), correspondingly (\(\:\theta\:\)). The remaining candidate was presumed to be \(\:\omega\:\).

$$\:{\overrightarrow{A}}_{k}=2\bullet\:{\overrightarrow{a}}_{gwo}\bullet\:\overrightarrow{rd}-{\overrightarrow{a}}_{gwo}$$
(13)
$$\:{\overrightarrow{C}}_{k}=2\bullet\:\overrightarrow{rd}$$
(14)

\(\:{\overrightarrow{A}}_{k}\) and \(\:{\overrightarrow{C}}_{k}\) were coefficient vectors, and in this case, encircling and hunting were accomplished through \(\:{\overrightarrow{D}}_{k}\) and \(\:{\overrightarrow{X}}_{new}\). Additionally, new population was computed, where \(\:rd\) was a random integer that was generated, and \(\:{\overrightarrow{a}}_{gwo}\) changes gradually from 2 to 0 with all iterations.

$$\:{\overrightarrow{X}{\prime\:}}_{k}={\overrightarrow{X}}_{k}-{\overrightarrow{A}}_{k}\bullet\:{\overrightarrow{D}}_{k}$$
(15)
$$\:{\overrightarrow{X}}_{new}=\frac{\sum\:_{k=1}^{3}{\overrightarrow{X}{\prime\:}}_{k}}{3}$$
(16)

It is possible to calculate the most effective charging time for a particular EV by utilizing the GWO-based power scheduling. This allows for the reduction of any potential delays or congestion that may occur at the charging station. To effectively manage power in a charging station that has a restricted number of charging stations and insufficient power availability, the GWO-based power scheduling module is essential36. Figure 6 displays the GWO’s flowchart.

Fig. 6
figure 6

Flowchart of the GWO process.

Table 1 Hyperparameter values.

Table 1 summarizes the hyperparameters employed for both the XGBoost classifier and the GWO used in this study. For XGBoost, the learning rate was set to 0.1 with a maximum tree depth of 6, 200 boosting estimators, subsample, and column sampling ratios of 0.8, minimum child weight of 1, and gamma value of 0, with the objective function defined as softmax for multi-class classification. These settings balance model complexity with generalization capability while ensuring fast convergence. For GWO, the optimizer was configured with a population size of 30 and a maximum of 50 iterations, where the control coefficient a was linearly decreased from 2 to 0 across iterations, and the convergence criterion was set to a fitness tolerance of 0.00001. This configuration allowed the optimizer to effectively balance exploration and exploitation while ensuring computational efficiency in the scheduling task.

Within the scope of this module, the total number of EVs that are included into the schedule is discussed. It is the responsibility of the module to determine whether a charging station has a charge and whether a charging request (\(\:ChRe\)) is present. If the \(\:ChAv\) is lower than the \(\:ChRe\) or if the existing \(\:ChRe\) is operating at its full capacity, then the current EV \(\:ChRe\) is not considered; otherwise, the kind of \(\:ChRe\) is confirmed according to the evidence. If the \(\:ChRe\) is determined to be the emergency, it is necessary to check both the \(\:ChAv\) and the threshold values concerning emergencies. After determining that the values of \(\:ChAv\) and the emergency thresholds had not been exceeded, the current value of \(\:ChRe\) was examined for the purpose of rescheduling. Unless otherwise specified, \(\:ChRe\) was incorporated into the standard scheduling procedure. The importance of the EV and the distance that the vehicle is traveling are the two most important considerations that are made throughout the process of power scheduling. If the EV is situated at a considerable distance from the charging station, the nearest EV charging point will be handled throughout the duration of the trip for the EV that is very far away. Current and potential customers are already being informed of the updated timeline, which is now being conveyed to them. On the other hand, the \(\:ChRe\) is added to a standard scheduled termination, and it sends the scheduling time, charging fee, and location of the charging station to the generation of blocks.

Block generation

The validation of data integrity is essential in every field because it guarantees that the data maintained by all the parties involved in a transaction are consistent with one another. The procedure of charging an EV required the verification of the data’s integrity as a crucial component. The location of the charging station, the cost of charging, and the charging schedules are all components that are the result of the BMS approach. The processing of EVs will be rendered totally ineffective if any of the information included in this BMS is changed. If an unauthorized individual alters the location of the charging station, for instance, this will lead to an increase in the distance traveled. For EVs, extended travel lengths frequently lead to the depletion of the battery, which in turn causes the vehicle to malfunction. Additionally, the charging station or owner suffers a financial loss because of the lack of consistency in charging fees, and the additional waiting time that arises from changes in scheduling times is a consequence of the adjustments. For avoiding these issues, it is essential to guarantee the integrity of the data in a BMS for an EV.

Without the requirement for a third-party auditor, the blockchain technology makes it possible to verify the integrity of data in an effectively efficient manner. The BMS combines the exploitation of blockchain technology. One of the primary reasons that the blockchain network was built within permissioned networks was to ensure that users could safely transmit data to one another. In a permissioned blockchain, participation in communication is limited to the only those users who were granted permission to utilize the blockchain. Adding new users and charging stations, integrating blocks into the blockchain, and verifying user permissions are all responsibilities that fall within the scope of the master node operating in a permissioned network. An individual identification (ID) was given to every owner of an EV as well as each charging station for the purpose of user identification. The identification number is saved on the master nodes for the intent of verification and authentication, and it was generated during the process of user registration.

To ensure the safety of data and to facilitate the generation of blockchains, HE is utilized. All nodes inside the blockchain network retains a similar blockchain. The blockchain consists of several blocks. The generation block consists of the block body and head. The header block contains the input data, including the version number, difficulty value, characteristic value, and timestamp. The body of block preserves the input data. The subsequent blocks in the blockchain were referred to as the parent block. It consists of the block body and head, ensuring that all blocks are part of the blockchain. The block data saved within a block was linked to the block data saved in its parent blocks, hence guaranteeing the input data security contained within the blocks. The procedure of this approach was outlined below37.

Step 1: Generation of the key. Generate random prime numbers \(\:p\) and \(\:q\) that satisfy the given Eq. 

$$\:gcd\left(pq,\left(p-1\right)\left(q-1\right)\right)=1$$
(17)

Compute the modulus

$$\:n=pq.\:\:\:\:\:\:\:\:\lambda\:=lcm\left(p-1,q-1\right)$$
(18)

Here, \(\:lcm\) was used to find the least common multiple of \(\:p-1\) and \(\:q-1\). Choose a random number \(\:g\left(g\in\:{Z}_{n2}^{*}\right)\) and satisfy the following Eq. 

$$\:\mu\:={\left(L\left({g}^{\lambda\:}\:mod\:{n}^{2}\right)\right)}^{-1}\:mod\:n$$
(19)

Determine the highest common factor of \(\:L\left({g}^{\lambda\:}\:mod\:{n}^{2}\right)\) and \(\:n\). The set \(\:{Z}_{n2}^{*}\) denotes the integers that are relatively prime to \(\:{n}^{2}\) inside the set \(\:{Z}_{n2}\). The encrypted public key for the function \(\:L\left(x\right)=x-1/n\) was \(\:\left(n,g\right)\), whereas the private key was denoted as \(\:\left(\lambda\:,\omega\:\right)\). For the encryption and decryption process, choose an integer \(\:r\left(r\in\:{Z}_{n2}^{*}\right)\). The plaintext, denoted as \(\:m\left(m\in\:{Z}_{n}\right)\), and \(\:m<n\).

Step 2: Encrypting the data using the encryption algorithm \(\:\left(encryption\to\:Enc\left(m,pk\right)\right)\). Let \(\:m\) represent the data to be encrypted and \(\:m\in\:{Z}_{n}\). Calculate the ciphertext \(\:c=m\:mod\:n\). The encryption method was articulated in the following manner.

$$\:c=E\left(m\right)={g}^{m}\bullet\:{r}^{n}\:mod\:{n}^{2}$$
(20)

Here, \(\:c\) represents the ciphertext data that corresponds to the plaintext \(\:m\), and \(\:c\in\:{Z}_{n2}^{*}\). Designate the encryption scheme as \(\:c=E\left(m,r\right)\). It was evident that the value of \(\:r\), which was selected at random throughout the encryption process, could vary for the similar ciphertext \(\:m\). Consequently, the resulting ciphertext data will also differ, ensuring the ciphertext data security.

Step 3: Process of proxy re-encryption. Calculate the private and public key (\(\:{R}_{sk},{R}_{pk}\)). The RSA technique was used to construct the re-encryption ciphertext, and the \(\:{R}_{pk}\) was transmitted to the server.

Step 4: The process of decryption \(\:\left(decryption\to\:Dec\left(c,sk\right)\right)\). The ciphertext \(\:c\in\:{Z}_{n}\).

$$\:m=D\left(c\right)=L\left({c}^{\lambda\:}\:mod\:{n}^{2}\right)\bullet\:\left(\omega\:\:mod\:n\right)$$
(21)

Upon receiving \(\:E\left({d}_{i}\right)\left(i\in\:{p}_{\tau\:}\right)\), decode it to obtain \(\:\left({d}_{i}\right)\left(i\in\:{p}_{\tau\:}\right)\), proceed to sign it, acquire \(\:{Sign}_{q}\left({d}_{i}\right)\left(i\in\:{p}_{\tau\:}\right)\) to \(\:{EN}_{q}\).

Step 5: Divide dispersion degree into two types after \(\:{EN}_{q}\) receiving \(\:\left({d}_{i}\right)\left(i\in\:{p}_{\tau\:}\right)\). Use Q for a type with additional components and G for the degree of dispersion. Due to the small number of malevolent users, Q largely contains regular users whose target value grows once tasks are completed, whereas G’s declines. Two parameters, \(\:\mu\:\) and \(\:v\), are used for controlling the growth and reduction of the targeted value after updating it. The target value varies based to the equation that follows:

$$\:{r}_{i}^{new}=\left\{\begin{array}{c}{r}_{i}+\left(1-{r}_{i}\right)\bullet\:\mu\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:if\in\:Q\\\:{r}_{i}\bullet\:\left(1-v\right)\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:if\:i\in\:Q\end{array}\right.$$
(22)

Here, \(\:\mu\:\) and \(\:v\) both are positive and \(\:v<1\). Rivest-Shamir-Adleman (RSA) algorithm is the asymmetric encryption method that is utilized whenever the execution side is in the process of communicating the address of storage and data file key itself. The only person who can decode the material that has been encrypted using an RSA public key is the individual who possesses the associated RSA private key. As a result, the safe communication of the address of data storage and the decryption key has been assured by this approach.

In the proposed permissioned blockchain, each block was composed of a block header and a block body to securely and verifiably store the transactions related to EV charging. The block header holds metadata, which includes the version of the block, timestamp, the hash of the previous block, the Merkle root of the current transactions, and a difficulty value for maintaining consistency and traceability across the chain. The block body then holds the transaction-specific data, which in this study consisted of: (i) EV ID and location, (ii) battery parameters including SOC, SOH, and requested charge, (iii) predicted charging station information by the XGBoost classifier, (iv) GWO optimized scheduling results (time slot and energy allocation), and (v) cost and price of the charging session. Before being committed to the block, all this data is encrypted using HE to keep the information confidential yet allow computation on encrypted values. The block then gets linked cryptographically to its predecessor through its hash, creating a tamper-proof ledger recording EV-charging station interactions in real time.

Fig. 7
figure 7

(a) Block creation flowchart; (b) Transaction validation & verification workflow.

To further clarify the BC implementation, Fig. 7a presents a flowchart of the block creation process in the Ethereum Testnet environment. The process begins with IoT sensor data collection, followed by HE and storage in a pending transaction pool. The smart contract deployed in Remix initiates block formation, after which the Ganache-based permissioned nodes validate and append the block to the local BC. Figure 7b illustrates the transaction validation and verification workflow. Each transaction undergoes integrity checks (digital signature verification), consensus confirmation among validator nodes, and final commitment to the BC ledger. This ensures immutability, traceability, and secure accessibility of EV battery and charging data.

Combining permissioned blockchain technology with HE ensures secure and private energy transaction between EV users and charging infrastructure in the proposed BMS. Permissioned blockchains limit participation to only authenticated entities, such as verified EV owners, charging stations, and utility providers, to avoid unauthorized access and to reduce the risk of malicious nodes entering the network. Those transactions, which include charging requests, station allocations, and charging prices are then registered onto immutable blocks for tamper-proof auditability. From an encryption perspective, HE is critical to privacy because it allows computations (e.g., calculating charging price or evaluating scheduling options) to be done directly on encrypted data without needing to decrypt it. This guarantees that sensitive information such as the user’s identity, location, and preferences relating to price remain private throughout the entire process, even towards the blockchain validators. The decrypted result will only be disclosed to legitimate parties, while the raw data remains hidden. By combining blockchain immutability and transparency with HE computed on encrypted data, the framework can keep the energy transactions all at once secure, verifiable, and private, thus fulfilling all cybersecurity compliance reviews and adequacy regulations regarding data protection.

Experiments & findings

Simulation setup

The proposed Smart BMS model was experimentally analyzed in a hybrid setting combining the Python and MATLAB environments. All the ML tasks, including data preprocessing and the deployment of the XGBoost classifier, were carried out in Python 3.10 on the Spyder IDE (Anaconda distribution), whereas smart contract development and blockchain implementation were performed in the Remix IDE using Solidity 0.8. The GWO scheduling algorithm was implemented in MATLAB R2023a. Simulations performed on a workstation equipped with an Intel Core i7 11th Gen CPU (2.8 GHz), with 16 GB of RAM, and Windows 11 (64-bit) as the OS, with GPU acceleration (NVIDIA GeForce RTX 3060, 6 GB) for expedited training and testing of models. Dataset parameters were extracted from the https://ev-database.org/ repository, whereas the permissioned blockchain network was simulated using Ganache (Ethereum Testnet) for validating secure transactions. This hybrid setup ensured efficient execution of ML classification, optimization-based scheduling, and blockchain transaction validation within a single integrated test environment. To enhance clarity, Fig. 8 illustrates the workflow of the hybrid simulation environment. It highlights the hardware (Intel i7 system with 16 GB RAM and NVIDIA RTX 3060 GPU, Raspberry Pi 4 for IoT interface) and software configurations (Python 3.10 with Anaconda, MATLAB R2023a, Remix IDE with Solidity 0.8, Ganache testnet). The diagram demonstrates the data flow from IoT sensors through ML modules and scheduling optimization to BC validation.

Fig. 8
figure 8

Simulation setup framework.

The parameters of the simulation and the values that correspond to them are presented in Table 2.

Table 2 Simulation parameters.

Regulatory and ethical considerations

In setting up blockchain-based energy transaction platforms for charging EVs, several ethical and regulatory considerations arise alongside technical performances. Ensuring that permissioned blockchains provide gateways only to entities recognized and authentic-an EV owner and a charging station duly licensed-helps to uphold privacy, accountability, and fairness. Being consistent with data-protection laws (such as GDPR with respect to user data privacy) and energy-market regulations, the proposed architecture limits blockchain use for transaction integrity without recording any personal identifiers in plaintext. HE ensures that even information like location or charging price remains confidential while being computed upon. In addition to that, energy transactions across the blockchain must comply by regulations for the national grid and policies for electricity pricing, each differing from various regions. The framework proposed in this research is adaptable to varying regulatory standards so that transparent and tamper-proof energy transaction would not contradict any legal framework but encourage the ethical adoption of the secure EV charging ecosystem.

In addition, Fig. 9 presents a schematic overview of how BC integration aligns with ethical and regulatory frameworks. It shows how GDPR-compliant data flow is enforced through HE, secure smart contract execution, and permissioned BC access. This ensures confidentiality, accountability, and compliance with data protection regulations throughout energy transaction processing.

Fig. 9
figure 9

BC ethical & regulatory framework.

Performance metrics

The cost analysis of the research model incorporates three aspects: the cost of the distance travelled, the cost of waiting, and the cost of charging. The expenses that are related with the charging station (\(\:ChSt\)), electric vehicle, and the BMS are included in the charging charges. The total cost was comprised of the expenditures that are related with the manufacturing and selling of electric vehicles, charging stations, and BMS. A calculation using the following equation was carried out to ascertain the total cost.

$$\:{Charge}_{price}=\sum\:_{i=1}^{n}Gen\left(ChSt,EV,BMS\right)+\sum\:_{i=1}^{n}Sell\left(ChSt,EV,BMS\right)$$
(23)

Consequently, the cost of the electric vehicle’s cost of the distance travelled was calculated by considering the distance travelled during the charging and discharging processes. The fundamental objective of the strategy that has been recommended is to charge the electric vehicle in the most effective manner possible, hence reducing the amount of distance that was travelled. The following equation can be utilized to calculate the cost of distance.

$$\:{Dist}_{price}=Dist\left(ChSt,EV\right)$$
(24)

To determine the waiting cost of an electric vehicle, it is required to compute it. There is a line of electric vehicles waiting to be charged at each charging station, and the queue is typically rather long. When an electric vehicle arrives to be charged, it is added to a waiting list until the electric vehicle that is now being charged has completed its charging. The waiting time considers both the distances that need to be travelled and the maximum number of EVs that are available. The following equation was utilized to determine the amount of time that an electric vehicle would be required to wait.

$$\:{Wait}_{price}=\left(dist\left(ChSt,EV\right)\bullet\:\sum\:_{i=1}^{n}{Charge}_{time\left(EVs\right)}\right)$$
(25)

Additionally, some electric vehicles have the capability to sell their extra energy to other electric vehicles, which was traditionally considered to be a kind of compensation for the electric vehicle. To determine the cost associated with the reward, the following equation can be utilized.

$$\:{Reward}_{price}=\left(TUS\bullet\:PPU\right)$$
(26)

PPU is an abbreviation for “price per unit,” whereas TUS is an abbreviation for “total units stored and sold to other electric vehicles.” Consequently, the total costs were determined using the following Eq. 

$$\:{Total}_{price}={Charge}_{price}+{Dist}_{price}+{Wait}_{price}+{Reward}_{price}$$
(27)

Additionally, the cost of charging is determined by various other parameters, including the length of the charging cable, the duration of the charging period, the infrastructure of the charging station, and the inefficiency of the inverter. It is because of these factors that the cost of charging differs from one charging station to another.

Results & discussion

Assessing the capacity of the battery is an important step to take from the initial phase. Both the capacity and frequency of the battery with which it must be charged are high. In the same way, the battery has a diminished capacity and must be charged frequently. Therefore, the BMS model requires that the capacity of the battery be evaluated, which is a significant task. There is a predetermined starting capacity of 30 kW/h for the electric vehicle, and the capacity barrier for the battery was established at 12 kW/h. When the capacity reaches or falls below 12 kW/h, a notice alert is sent to the driver of the electric vehicle, and a \(\:ChRe\) is generated for the purpose of charging the electric vehicles. The following Table 3 presents the comparative table summarizing the performance analysis with comparison.

Table 3 Comparison of performance Analysis.
Fig. 10
figure 10

Comparison of charging station detection accuracy.

The research model, XGBoost classifier was utilized for the purpose of charging station identification in this research. These findings are compared to other methods of identification, such as ANN, SVM, RF, DRL, and LightGBM techniques. The proposed research model based on XGBoost obtains a better result with an accuracy rate of 97.36%, which is effective than the other models compared in this work. Comparing the research model to other models such as ANN, SVM, RF, DRL, and LightGBM, the accuracy of the research model is much higher. To be more specific, it has improved accuracy by 15%, 10%, 8%, 6%, and 2% accordingly among the other models. It is possible to recognize the successful utilization of the distance approach and the price charging strategy to the effective outcomes that were achieved by the research model. These strategies are used by the XGBoost algorithm to choose which charging station to use. This allows for a more accurate determination of the charging station that is nearest to the user and offers the lowest price, in comparison to the approaches that were previously used. Nevertheless, the models that were examined did not include the optimal solution and distance analysis, which led to a lower level of accuracy in comparison to the research model. Figure 10 represents the accuracy results comparison on the charging station detection.

Fig. 11
figure 11

Performance comparison of power schedule models.

The proposed power scheduling utilizing GWO approach results in a lower waiting time for electric vehicles when compared to the other models. Based on this approach, the research model necessitates a waiting time of less than thirty minutes on average. For a period of thirty minutes or more, there are no electric vehicles that are allowed to remain at the charging station. In a similar manner, the quantity of power that is available at the charging station is the factor that determines the amount of time that electric vehicles are required to wait. When the power availability of the charging station is greater than 50%, electric vehicles experience shorter waiting times. Similarly, the amount of time that electric vehicles are required to wait is greatly affected by the rate at which they arrive. If there is a greater demand for electric vehicles during peak hours, the waiting period would be extended. A comparison was made between the proposed power scheduling utilizing GWO and other models such as first come first serve, equal sharing, power-minimization, and power-balanced, as well as the previous model, LightGBM. Figure 11 represents the power schedule comparison plot.

The combination of XGBoost and GWO provides for enhanced decision-making procedures to determine the best charging stations and scheduling under real-time scenarios. XGBoost was selected due to its ability to efficiently handle large-scale, heterogeneous input data from IoT sensors while being robust against missing or noisy values. Its gradient boosting nature further allows a very fast, accurate classification of the nearest charging station by jointly considering SOC, SOH, travel distance, and cost preferences that were defined by the user to outperform benchmarks such as ANN, SVM, and RF. If the charging requirement is identified, GWO dynamically allocates charging slots by mimicking cooperative hunting behavior and finding an optimum solution under criteria of efficiency. GWO dynamically responds to changing charging demand and availability of stations and hence avoids unnecessary waiting and congestion. Thus, XGBoost speeds up the prediction process with a high level of accuracy, with GWO fine-tuning the scheduling decision to achieve a balanced usage of resource and user income, exhibiting synergy in smart BMS in real-time functions.

Fig. 12
figure 12

Cost of charging comparison.

The research model’s cost analysis has been compared to the cost analyses of other models. The research model investigated the significance of requests and the time of those requests to schedule the cost of charge. The cost of the charge varies since it is dependent on the schedule. This comparison of cost looks at 3 different scenarios: Case one: All electric vehicles were charged in accordance with the allocated period; Case two: 75% of electric vehicles were charged in accordance with the defined schedule; and Case three: 50% of electric vehicles were charged inside the designated duration. It is possible for the charge cost to change based on the length of time that has been expired. The research model for arranging the charging time is largely centered on the idea of reducing the distance in direct contrast to the approach that is currently being employed. Consequently, the research model has a smaller percentage of mismatching than other models. Figure 12 represents the charging cost comparison plot.

Fig. 13
figure 13

Communication time comparison.

The communication overhead involves many processes, including creating requests, locating charging stations, scheduling power, generation of blocks, and distributing them. The research model has substantially reduced the communication overhead when compared to the other blockchain models like proof of stake (PoS), proof of work (PoW), Smart Contract, and proof online duration (PoD). More precisely, the research model accomplishes a communication overhead of just 35 ms as shown in Fig. 13, making it efficient in this comparison. The main reason for this drop is the use of a blockchain methodology with HE in the research model. The blockchain technology is employed to safeguard against three various types of attacks: intrusion from energy providers, intrusion from energy consumers, and intrusion from third-party members. The research model employs a permissioned blockchain to grant access to authorized individuals. As a result, the invaders are unable to obtain entry in any way. In addition, the HE was employed to guarantee data security and produce blockchains. The utilization of this encryption approach improves the research model’s capacity to attain higher levels of data integrity and security. In contrast, the existing methods are unable to effectively execute an appropriate encryption technique, leading to inadequate data security when compared to the research model.

The improvement in communication overhead is crucial, as EV battery management systems have near real-time response requirements to manage dynamic charging requests at the time level and satisfy the end user. Though response times generally allow up to 100 ms for real-time monitoring and scheduling scenarios in the smart EV charging industry guidelines, load balancing, and transaction verification would essentially be acceptable, provided the systems respond within this time. At 35 ms, the system is not just well within and simply surpassing the limit but provides an extra latency margin to allow operations to run smoothly even in cases of high network loads. Secondly, with reduction in communication overhead, an improvement in scalability is a direct consequence of it, which results in greater numbers of EVs and charging stations being supported without any performance degradation. These factors highlight that the proposed BMS based on a permissioned blockchain integrated with lightweight HE hence effectively strikes a balance between security, responsiveness, and scalability, thereby making it appropriate for real world deployment.

The efficiency of the proposed BMS model lies in the integration of IoT, ML, and blockchain technologies to improve the battery monitoring, scheduling, and security aspects. Continuous and robust consumer acquisition of real-time parameters such as SOC, SOH, or an EV location provided by the IoT sensor network yields relatively accurate data as inputs for an analysis. In the domain of ML, the XGBoost classifier would analyze this data to predict the charging requirements; the GWO-based scheduler then takes those predictions and strategically assigns charging stations and manages the time slots, thus alleviating congestion and reducing waiting times. Finally, the blockchain layer integrated with HE protects charging transactions, scheduling outputs, and cost information against tampering in a decentralized ledger with concurrent exclusion from threats of manipulation or unauthorized access. Hence, these three layers form a complimentary triad: IoT for trusted data, ML for intelligent decision-making, and blockchain for secure, transparent, and efficient execution. This integrated design represents holistic enhancement of EV battery management in contrast to those that adopt the use of these technologies in isolation.

Advantages & limitations

Using IoT, blockchain and ML technologies, this research proposed a potentially effective model for improving the electric vehicle’s battery management system. The utilization of these technologies in integration with one another leads to an increase in energy efficiency, an accurate predictive analysis of electric vehicle power consumption, and an optimization of charging infrastructure. Because the model relies on IoT sensors, the data collecting process was more reliable. The XGBoost classifier was effective in detecting the charging stations. Further refinement of power scheduling was achieved using the Grey Wolf Optimization algorithm, which guarantees optimal energy allocation and reduces congestion conditions. To ensure the safety of data and to facilitate the generation of blockchains, homomorphic encryption was utilized. While the model does have certain advantages, it also has some drawbacks, such as the fact that it is dependent on the accuracy of the sensors, and the initial high cost that relates to more advanced technology. Furthermore, the efficiency may fluctuate depending on the setting, and ongoing adaptation is required to stay up with the rapid advancement of technology. Despite these constraints, the model offers potential for enhancing the efficiency and sustainability of electric transportation systems even if it has certain shortcomings. Further refining and testing are essential to overcome these problems and guarantee that the solution can be practically used in situations that occur in the real world.

Conclusion

In this research, a battery management system for electric vehicles using multiple technologies was proposed and developed. The multiple technologies include IoT, blockchain and machine learning, which are integrated to provide an effective BMS model for electric vehicles. The IoT sensors have been equipped to the electric vehicles to gather data such as the level of charging, the travelled distance, and the EVs location. For determining the cost of charging, this information was first recorded and processed by a database, and then it was given as input to the XGBoost classifier. After that, the power scheduling that was based on the GWO technique processed it to determine the position of the charging station, as well as the time and space of charging that was going to be closest to a particular electric vehicle. Finally, this information was stored in blocks to prevent intruders from gaining access to electric vehicles and to ensure that pricing transactions between users and charging stations are carried out in a secure manner. For these secure transactions, a permissioned blockchain with homomorphic encryption was implemented. The results show that the research work produced an enhanced BMS model with an accuracy rate of 97.36% and that it maintains a communication overhead with 35 ms, which was 14% lower than the current models. There exist some potential limitations, however, the research attained better results. Firstly, the model is highly dependent on IoT sensors’ accuracy, and malfunctioning of these sensors could affect the prediction quality. Secondly, a blockchain implementation was validated in a simulated permissioned environment, and in practical large-scale deployments, it could face challenges of scalability, transaction latency, and interoperability with the current EV infrastructure. Thirdly, while it serves to secure the protocol, the HE introduced in this work means that further computational complexity will be there, which may or may not be helpful for constrained devices. Finally, the model is currently more focused on single-region case studies. It also does not consider heterogeneous charging networks across multiple regions with different pricing regulations.

In future, these challenges can be addressed by implementing lightweight encryption protocols developed for IoTs, by optimizing blockchain consensus algorithms for ultra-low latency energy transaction, and by extending their framework to support bidirectional Vehicle-to-Grid energy exchanges. Moreover, having both edge computing and federated learning systems will lessen the dependence on cloud servers at the center and build their scalability and privacy. Through large-scale pilot studies with industrial partners and the integration of renewable energy forecast models into the scheduling model, a further step concerning real-world applicability of the developed Smart BMS will be undertaken.