1. Introduction
Electric bicycles are a convenient means of transportation for short distances, and their low operating costs have contributed to their rapid growth in China. According to the latest data from the Chinese State Council’s website, as of May 2024, the number of electric bicycles in China had exceeded 350 million. In 2023 alone, China will have manufactured 42.28 million electric bicycles [
1].
As one of the most crucial components of electric bicycles, the safe and stable operation of the battery is fundamental to the reliable use of these vehicles. Consequently, the safety of batteries has garnered increasing attention. Reports indicate that approximately 80% of battery fire incidents occur during the charging process [
2]. Additionally, the combustion of batteries releases a significant amount of toxic gases, posing severe health risks and potentially leading to fatalities.
In response, many local governments in China have implemented regulations regarding the management of electric bicycles. These regulations stipulate that the charging of electric bicycles must take place in designated areas, prohibiting individuals from bringing electric bicycles into residential building hallways or elevators and from charging batteries at home [
3]. Therefore, the intelligent monitoring of residential buildings to identify the charging status of electric bicycle batteries and supervise the process is crucial. This can ensure the safety of residential areas, reduce the likelihood of accidents, and inform the development of appropriate management policies based on battery charging behaviors. Thus, timely and effective identification and supervision of the charging process during the use of electric bicycle batteries are of significant importance for advancing household intelligence and ensuring residential safety.
As an environmentally friendly device that is not subject to climate and geography factors [
4], lithium-ion batteries are the most commonly used power source in the field of electric bicycles. Many scholars have conducted extensive research on the materials of lithium batteries, improving their performance. However, during the charging process, lithium-ion batteries can experience thermal runaway due to short circuits within the small internal cells [
5]. This occurs when the internal structure of the battery, particularly the separator, is damaged, leading to direct contact between the anode and cathode materials, which causes minor short circuits. These short circuits generate localized high temperatures, which, over time, expand the hotspot area and result in an overall increase in the battery’s temperature.
Experimental studies have shown that the bending state of a battery during operation can influence heat generation [
6]. When the bending exceeds a critical point, the heat produced is higher than that of a standard battery. The combination of high temperatures and flammable gases leads to thermal runaway, causing the battery casing to swell and crack, potentially resulting in a fire. Numerical simulations of battery thermal management systems (BTMS) indicate that during overcharging, there is a significant temperature increase before the battery materials undergo phase change [
7]. During charging or discharging, inadequate heat dissipation can cause a continuous rise in the internal temperature of the battery. Overheating may trigger the decomposition of the electrolyte, producing flammable gases, which further promote combustion [
8].
Experts and scholars have employed various methods to study the behavior of charging batteries, achieving notable results. During the charging process, various phenomena of the battery, such as pulse phenomena [
9], capacitive modes [
10], thermal behavior [
11,
12,
13], and thermal residues [
14], have been experimentally studied, revealing the fundamental principles to a certain extent. From other perspectives, researchers have used numerical simulations and modeling methods to study the performance of batteries during the charging process. Significant progress has been made in several areas, including thermal performance [
15,
16], spatial chemical performance [
17], and system performance [
18,
19,
20], providing detailed analyses of battery performance. Additionally, some scholars have utilized theoretical analysis to explore aspects such as electrochemical effects [
21], aging mechanisms [
22], battery safety under mechanical stress [
23], battery health assessment [
24,
25], and heterogeneous damage behaviors of batteries [
26], achieving notable results.
From the perspective of models and algorithms, current research has also achieved notable progress. An improved Dynamic Time Warping (DTW) algorithm, known as LSS-DTW, has been proposed to enhance the safety of electric bicycle charging [
27]. A neural network model has been developed for estimating the state of charge (SoC) of electric bicycles, utilizing inputs such as voltage, current, temperature, and charging cycles to predict battery health and lifespan [
28]. Franzese studied wireless charging systems for electric bicycles and found that a sensorless control strategy can be used to track constant voltage and constant current modes, improving both charging efficiency and safety [
29]. Xie proposed a trickle charge detection algorithm that helps prevent overcharging of electric bicycle batteries. This algorithm increases safety by cutting off the power supply when trickle charging is detected, thereby extending battery life [
30]. An electrochemical model has been developed to identify the degradation state of lithium-ion batteries, providing insights into battery health and longevity for electric vehicles, including bicycles [
31]. Various methods for estimating the SoC of electric vehicle batteries have been examined, highlighting the advantages, challenges, and accuracy of each method [
32]. Battery management systems designed for electric bicycles using lithium-ion 18650 batteries have been explored, discussing their effectiveness in managing the charging and discharging processes to improve battery life and performance [
33]. A virtual sensor method for estimating the SoC of electric vehicle batteries has been introduced, which improves the reliability of SoC estimation using alternative vehicle measurements without direct current measurements [
34].
Some scholars have proposed a hybrid CNN-GRU model for estimating the performance of lithium-ion batteries, which has been applied to the estimation of state of health (SOH) [
35], dynamic charging warning [
36], and the prediction of remaining useful life (RUL) [
37]. Similarly, Xia et al. discussed a model that combines CNN and LSTM with a self-attention mechanism to improve the accuracy of RUL predictions for lithium-ion batteries. This approach is particularly robust against noise in battery measurement data, making it highly effective in practical applications [
38]. Rastegarpanah et al. introduced a hybrid model optimized using Bayesian methods that combines CNN and CNN-LSTM architectures for predicting the RUL of lithium-ion batteries. This model leverages both spatial and temporal features to enhance prediction accuracy [
39].
In recent years, non-intrusive electric behavior analysis methods have been gaining increasing attention. These methods allow for the collection of electrical signal data without altering the existing wiring of the equipment, enabling the detection device to be connected to the system under test without shutting down or powering off the equipment. This approach facilitates a quick and convenient data collection and analysis process. Due to these advantages, many studies in the field of electric behavior testing and analysis have adopted this method.
A recent study employed the Non-Intrusive Load Monitoring (NILM) method and introduced a supervised Fisher classifier-based approach to identify the charging behavior of electric bicycles [
40]. This research aims to address abnormal charging behaviors that could potentially lead to severe fire accidents. Luan et al. employed the NILM method to mitigate fire hazards caused by the thermal runaway of electric bicycle batteries, a situation often exacerbated by residents not adhering to regulations prohibiting charging within residential buildings [
41]. The study aims to enhance public safety by accurately identifying and assessing electric bicycles (EB) charging loads, particularly those with fire risks. Additionally, an unsupervised method for detecting unsafe charging of electric bicycles using NILM was introduced, which employs bilateral filtering to preprocess active and reactive power signals and identifies charging loads through piecewise linear representation [
42]. Liu et al. proposed a non-intrusive method using NILM technology to detect indoor charging of electric bicycles, aiming to improve residential electrical safety by identifying and monitoring charging behaviors [
43].
Current research using NILM technology to study battery charging behavior still lacks comprehensive testing and analysis that compares battery behavior under similar conditions. The generalization capability of battery behavior diagnosis methods could be further improved, especially in distinguishing between similar electrical behaviors. To address these issues, this paper proposes a recognition method combining BiLSTM and CNN neural networks. By integrating segmented fitting with data thresholds and slope values, this method achieves the identification and prediction of the electric behavior of lithium batteries in electric bicycles. This approach ensures the safety of the battery charging process by enabling the timely and effective detection of abnormal behaviors.
2. Methods
Numerous scholars have used Long Short-Term Memory (LSTM) networks for processing current data. LSTM is a special type of recurrent neural network (RNN) that effectively learns and remembers long-term dependencies [
44,
45], addressing the vanishing gradient problem. However, during the charging process of lithium batteries, electrical signals exhibit temporal continuity. For tasks involving sequence labeling of current signals during charging (such as signal segmentation and event detection), LSTM relies solely on forward signal information, which may overlook important backward dependencies.
In recent years, bidirectional long short-term memory (BiLSTM) networks have emerged as a powerful tool for sequence data analysis. BiLSTM extends traditional LSTM networks by incorporating bidirectional processing of data sequences, consisting of two LSTM layers. One layer processes the sequence from start to finish (forward), while the other processes it from end to start (backward) [
46]. This bidirectional approach allows the network to capture dependencies and information from both past and future states [
47]. BiLSTM has found successful applications in various fields, including natural language processing [
48], time series prediction [
49], and speech and image recognition [
50].
In this study, we employ a method that combines BiLSTM networks and convolutional neural networks (CNN) for data analysis. This approach leverages the robust capabilities of BiLSTM in handling sequential data, along with the flexibility and strong function approximation abilities of CNN. The combination of convolutional and bidirectional recurrent neural networks effectively captures complex patterns and features within the data.
BiLSTM networks are particularly adept at processing time series data due to their ability to consider dependencies from both past and future states. This bidirectional processing is essential for accurately identifying and predicting the charging behavior of lithium batteries, ensuring a safe charging process by detecting abnormal behaviors in a timely and effective manner.
CNNs, on the other hand, excel in feature extraction through their convolutional layers, which capture local patterns in the data, and pooling layers, which reduce dimensionality while retaining essential information. The integration of CNN allows for the extraction of high-level features from the input data, which are then fed into the BiLSTM network for further processing and classification.
This hybrid approach not only enhances the model’s ability to identify complex and subtle patterns in the charging data but also improves its generalization capability, making it more effective in real-world applications where distinguishing between similar electric behaviors is critical. The effectiveness of this method is demonstrated in its ability to ensure battery charging safety and extend battery life by preventing overcharging and detecting potential hazards early.
2.1. Convolutional Neural Networks (CNN)
Convolutional neural networks (CNN) are a type of artificial neural network known for their ability to detect information at various positions with high accuracy. CNNs are particularly effective in solving problems related to image processing, sentiment analysis in natural language processing, question answering, and text summarization. The distinctive feature of CNNs is their specialized architecture, which facilitates learning.
CNNs are multilayer networks where the output of one layer serves as the input for the next. They typically consist of an input layer, one or more hidden layers, and an output layer.
CNNs extract features from input data through convolutional and pooling layers. The core idea is to reduce the number of parameters and improve computational efficiency by utilizing local connections and weight sharing, allowing the network to automatically learn local patterns in the data.
The convolutional layer applies a filter (also known as a convolutional kernel) that slides over the input data to compute local features. For time series data, a one-dimensional convolutional layer (1D convolutional layer) is used to extract local features between time steps. Assuming the input sequence is
x and the convolutional kernel is
w, the convolution operation can be represented as follows:
where
k is the size of the convolutional kernel and
b is the bias term.
Batch normalization is used to standardize the output of the convolutional layer, improving training speed and stability by reducing internal covariate shift. The batch normalization layer adjusts and scales the activations of the previous layer.
The activation function introduces non-linearity into the model, enabling it to represent more complex functions. A commonly used activation function is the Rectified Linear Unit (
ReLU):
ReLU activation helps to address the vanishing gradient problem, allowing the network to learn faster and perform better.
By incorporating these layers, the CNN can effectively learn and extract meaningful features from the input data, contributing to improved performance in tasks such as image and time series analysis.
The pooling layer reduces the dimensionality of the data through a downsampling operation, extracting key features and preventing overfitting. A commonly used pooling operation is max pooling, which can be represented by the following formula:
where
p is the size of the pooling window.
Max pooling selects the maximum value within the pooling window, effectively summarizing the most prominent features and making the network more robust to small translations in the input data.
By utilizing convolutional layers, batch normalization, activation functions, and pooling layers, CNNs can efficiently process and learn from complex data, making them highly effective for a variety of tasks, including image processing and time series analysis.
2.2. Basic Unit of LSTM
The core of the LSTM is its memory cell (cell state), which controls the flow of information through three gating units: the input gate, forget gate, and output gate. The calculation process for each time step is as follows:
The forget gate determines how much of the memory cell state from the previous time step should be forgotten in the current time step. The calculation formula is as follows:
where:
is the forget gate’s activation at time step
t,
σ is the sigmoid function,
is the weight matrix for the forget gate,
is the hidden state from the previous time step,
is the input at the current time step, and
is the bias term for the forget gate.
The input gate controls the extent to which new information from the current input should be added to the cell state. The calculation formulas are as follows:
where
is the input gate’s activation at time step
t,
is the candidate cell state,
and
are the weight matrices for the input gate and candidate cell state, respectively, and
and
are the bias terms for the input gate and candidate cell state, respectively.
The cell state is updated using the forget gate and input gate:
where
is the cell state at time step
t, and
is the cell state from the previous time step.
The output gate controls the amount of information from the cell state to be output as the hidden state. The calculation formula is as follows:
The update formula is as follows:
where
is the output gate’s activation at time step
t,
is the hidden state at time step
t,
is the weight matrix for the output gate, and
is the bias term for the output gate.
2.3. Bidirectional Long Short-Term Memory (BiLSTM)
BiLSTM is an extended version of LSTM that processes sequences in both directions (forward and backward), capturing more contextual information. BiLSTM is particularly suitable for tasks that require understanding context from both past and future data, such as time series prediction and natural language processing.
BiLSTM captures the complete context by applying LSTM in both directions within the sequence. It consists of two LSTM layers: a forward LSTM layer (processing from beginning to end) and a backward LSTM layer (processing from end to beginning). At each time step, the outputs of the forward and backward LSTM layers are concatenated to form the output of the BiLSTM.
Let the hidden state of the forward LSTM be
and the hidden state of the backward LSTM be
. The output of the BiLSTM at time step
t is given by the following equation:
where
is the hidden state of the forward LSTM at time step
t,
is the hidden state of the backward LSTM at time step
t,
is the concatenated output of the forward and backward hidden states at time step
t.
By combining information from both directions, BiLSTM provides a richer representation of the input data, making it more effective for capturing dependencies that are important for tasks requiring comprehensive current data process.
2.4. CNN-BiLSTM Model
The combined model built on the CNN and BiLSTM architectures allows for the extraction of a maximum amount of information from the data using CNN convolutional layers. By leveraging the strengths of both CNN and BiLSTM, the model captures features extracted by the CNN and inputs them into the BiLSTM, maintaining the temporal sequence information of the current data in both directions. The process is illustrated in
Figure 1.
The entire lithium battery charging recognition process comprises three stages:
- a.
Data Cleaning and Preprocessing:
The collected charging data are cleaned and preprocessed, then embedded into a matrix in the form of cells to prepare the convolutional data. The generated vectors are passed as input to the next stage.
- b.
Feature Extraction:
Convolutional layers and max-pooling layers are used to extract high-level features. After filtering, a max-pooling layer is applied to update and reduce the data size, and the results of all max-pooling layers are concatenated. The output from this stage serves as the input for the next stage.
- c.
Classification:
BiLSTM and fully connected layers are used to classify the current data. The output from this step serves as the input to the fully connected layer, which links each piece of input information to an output. Finally, we apply the softmax function as the activation function, with the output of this stage being the final classification of the current (i.e., whether it is the charging current of an electric bicycle lithium battery).
Through the above steps, the CNN-BiLSTM combined model effectively extracts local features of current signals and captures temporal dependencies during the charging process of electric bicycle lithium batteries, achieving classification of time series data.
3. Experiments
To validate the effectiveness of the proposed lithium battery charging load recognition algorithm, we utilized electrical signal data from the battery charging process. This study employed two distinct datasets for verification.
The first dataset is the NASA lithium battery charging dataset [
51]. The NASA battery dataset is a significant publicly available dataset for battery health monitoring and life prediction. It is provided by the NASA Ames Prognostics Center of Excellence (PCoE) and contains performance data for various types of batteries under different operational conditions. The dataset includes batteries of different models and chemical compositions, covering various usage scenarios and experimental conditions, including data on lithium-ion batteries. The data were collected under strictly controlled laboratory conditions, recording the performance during battery charging and discharging processes. The data types include voltage and current data, detailing voltage changes and current variations per second during each charge–discharge cycle. For this experiment, we selected the Current_charge data from NASA datasets #5, 6, 7, and 18. The data collection process involved charging the lithium batteries using a constant current (CC) mode at 1.5 A until the battery voltage reached 4.2 V, followed by a constant voltage (CV) mode until the charging current dropped to 20 mA.
In particular, datasets #5, 6, and 7 each contained 169 charging current data entries, while dataset #18 contained 134 entries, resulting in a total of 641 data entries. Due to the varying number of samples in each entry, interpolation was used to fill each entry with 4000 samples, ensuring consistent dimensions during the training process.
The second dataset was collected through experiments conducted in a laboratory setting. The experiments focused on lithium battery charging and were carried out at the Intelligent Electrical Behavior Analysis Laboratory of the Innovation Research Institute of Zhejiang University of Technology in Shengzhou. This laboratory primarily conducts testing and analysis of the electrical behavior of devices under different operating conditions. For this experiment, a test bench for charging electric bicycle lithium batteries was set up, including various experimental devices for analyzing electrical behavior, such as a high-power programmable power supply, a bus power strip, current and voltage sensors, a power quality recorder, and the lithium batteries being tested.
A high-power AC power supply (Model IT7805, product of ITECH Electronic Co., Ltd., Suzhou, China) was used to provide power, and data were collected using a power quality recorder (Model MW-A600, product of Picohood Co., Ltd., Beijing, China). The power quality recorder features high-precision data collection capabilities suitable for real-time recording and analysis of electrical parameters such as current and voltage, and the current clamp was non-invasively placed on the live wire of the power strip. The experimental subjects were two types of lithium-ion batteries specifically used for electric bicycles (Model XH480-12J, product of Xingheng Co., Ltd., Suzhou, China, rated voltage 48 V; Model DZ48N-12ES, product of Tianneng Co., Ltd., Changxing, China, rated voltage 48 V), as shown in
Figure 2.
During the experiment, the programmable power supply delivered 220 V, 50 Hz AC power to the bus power strip, and fully discharged lithium batteries were connected to the bus power strip through model-specific chargers for complete charging. Throughout this process, a non-intrusive method was used to connect the power quality recorder to the bus, recording the electrical signals during the entire charging process. The voltage sensor was connected to the bus power strip to collect voltage signals, while the current sensor sensed and collected current signals from the live wire in the bus. The sensors were connected to the power quality recorder, which saved the collected raw electrical signals. The test bench setup is shown in
Figure 3.
The experiments were conducted in a laboratory environment at 25 °C. The batteries were charged using chargers, and the entire charging process was monitored in real-time by the power quality recorder. The recorder’s sampling frequency was 10 kHz, with one sample per second recorded after averaging, covering the entire charging cycle from start to full charge as indicated by the charger. Data collection was repeated for both brands of electric bicycle batteries. Each data collection session took about 7 h, capturing 24,880 data points per session to include the complete current signal process.
Figure 4 shows a partial lithium battery charging dataset.
After obtaining the charging data for both types of batteries, GAN (Generative Adversarial Network) was used to augment the training data [
52,
53,
54,
55]. The generator in the GAN network employed a classical convolutional neural network structure, as detailed in
Table 1. The discriminator used a multi-layer convolutional neural network structure, as detailed in
Table 2. The GAN was trained using the Adam optimizer, with learning rates for both the generator and discriminator set at 0.0002. An alternating training strategy was adopted, training the generator and discriminator alternately. The data were normalized, and the quality of the generated data was evaluated using mean squared error (MSE) and mean absolute error (MAE).
Table 3 compares the performance of the original and expanded data for two sets.
The augmented current data generated by GAN was used as input for the combined CNN-BiLSTM model, which leverages the strengths of CNN and BiLSTM to effectively capture spatial and temporal features in the data.
Table 4 shows the model parameters.
4. Results and Discussion
In the NASA dataset, the combined model achieved a training accuracy of 96%, a validation accuracy of 93%, a training loss of 0.21, and a validation loss of 0.24. In the dataset collected from the laboratory, the combined model achieved a training accuracy of 97%, a validation accuracy of 94%, a training loss of 0.23, and a validation loss of 0.25, as shown in
Figure 5 and
Figure 6. The use of GAN for data augmentation significantly improved the model’s performance in monitoring data characteristics. The CNN-BiLSTM combined model effectively captured spatial and temporal features, thereby enhancing accuracy and generalization capability.
To further validate the proposed method, two types of validation were conducted:
- 1.
Multi-Device Composite Validation:
A multi-device mixed simulation experiment was conducted in the laboratory, including various household electrical devices along with the electric bicycle batteries. During the battery charging process, other electrical devices were used at different times. The model was used to determine whether the charging event for the electric bicycle battery could be identified from the collected bus electrical signals. The test bench setup is shown in
Figure 7, with device types and their specific operating times listed in
Table 5. The detail of devices is shown in
Table 6. The complete current signal for low battery charging captured by the experimental platform is shown in
Figure 8. The model’s determination indicated consistency with the previously trained data, confirming the inclusion of electric bicycle battery charging signals in the mixed current signal, thus validating the proposed method’s accuracy.
- 2.
Validation Across Different Models:
We conducted a validation analysis using the current data from the lithium battery charging process across different models. During the validation, the same data collected in the laboratory was augmented using GAN, and the augmented data were then validated using traditional methods, specifically with CNN [
56] and LSTM [
57] models as controls. The results, shown in
Figure 9 and
Figure 10, include training accuracy and loss values for the CNN and LSTM models.
The results show that while both models performed relatively well (CNN: training accuracy 92%, validation accuracy 90%, training loss 0.31, validation loss 0.34; LSTM: training accuracy 89%, validation accuracy 85%, training loss 0.36, validation loss 0.39), the CNN-BiLSTM combined model performed better. The analysis indicates that while CNN is adept at extracting spatial features, it may not handle time series data as well as RNN models; conversely, LSTM excels in time series data handling but may be less effective with raw signal data. The BiLSTM model further addresses the issue of sequential data, making the combined CNN-BiLSTM model more effective. Thus, the proposed CNN-BiLSTM model is validated for its effectiveness in recognizing the charging state of electric bicycle lithium batteries.
The increased complexity of this hybrid model results in longer training times and requires more computational resources compared with simpler models. Furthermore, while the dataset used in this study is comprehensive, it may still contain biases. Most of the data were collected under controlled conditions, which may not fully capture the variability encountered in real-world scenarios such as different types of batteries or charging conditions. This could potentially impact the model’s performance when applied to diverse charging environments. In future work, the model can not only improve the accuracy of charging state recognition but also show potential for broader applications in battery management systems.