Partial Discharge Pattern-Recognition Method Based on Embedded Artiﬁcial Intelligence

: This paper proposes a method for detecting and recognizing partial discharges in high-voltage (HV) equipment. The aim is to address issues commonly found in traditional systems, including complex operations, high computational demands, signiﬁcant power consumption, and elevated costs. Various types of discharges were investigated in an HV laboratory environment. Discharge data were collected using a high-frequency current sensor and a microcontroller. Subsequently, this data underwent processing and transformation into feature sets using the phase-resolved partial discharge analysis technique. These features were then converted into grayscale map samples in PNG format. To achieve partial discharge classiﬁcation, a convolutional neural network (CNN) was trained on these samples. After successful training, the network model was adapted for deployment on a microcontroller, facilitated by the STM32Cube.AI ecosystem, enabling real-time partial discharge recognition. The study also examined storage requirements across different CNN layers and their impact on recognition efﬁcacy. To assess the algorithm’s robustness, recognition accuracy was tested under varying discharge voltages, insulation media thicknesses, and noise levels. The test results demonstrated that the algorithm could be effectively implemented on a microcontroller, achieving a recognition accuracy exceeding 98%.


Introduction
With the continuous development of the electric power industry, cables occupy an increasingly important role in the construction and transformation of power grids [1], and the reliability of cables has a significant impact on the operation of the entire power system.The main insulating material of power cables is cross-linked polyethylene, which is widely used in the power grid system [2,3].There are many main factors that cause cable insulation failures, such as the following: the deterioration of the insulation layer due to the residue from the tips and burrs in the cut that are caused by the exploitation of the insulation-shielding layer during the construction; the insulation material being exposed to the radiation of a strong electric field for a long time; or the impact caused by the on-site installation.The deterioration of the performance of power cables is a slow and gradual process, and these different faults can lead to the failure of the insulation layer after a long period of cable usage [4,5], resulting in the partial discharge (PD) phenomenon, which may even lead to an explosion or burnout [6][7][8][9].The ability to recognize discharge patterns can serve as a diagnostic basis for cable maintenance and repair, reducing downtime and enhancing overhaul efficiency.
PD is a discharge phenomenon that occurs within a localized area of an insulator and is mainly found in HV electrical equipment.Typically, such discharges are triggered by an excessive concentration of localized electric fields within or on the surface of the insulator.These discharges are characterized by being brief and transient, usually manifesting as pulses with a duration of less than 1 µs [10].According to different cable fault mechanisms, PD can be divided into different types.Different PDs have different characteristics in frequency, amplitude, and discharge phase [11].In response to these characteristics, while the occurrence of PD does not immediately lead to complete failure of the insulation, its long-term presence will gradually erode the insulation medium, resulting in irreversible deterioration of the insulation performance.This process eventually leads to the destruction of the equipment's insulation layer [12,13].
Currently, cable PD-detection methods can be mainly categorized into electrical and non-electrical detection methods [14].Electrical detection methods primarily encompass the ultrasonic method [15], the pulsed current method [16], and the UHF method [17,18].The pulsed current method operates by generating a high-frequency pulse current within the cable when a PD occurs.This pulse current propagates along the wire and ultimately grounds through the equipment's grounding wire into the earth.A high-frequency current transformer (HFCT) is commonly employed to sense local discharge signals.Its operation is based on electromagnetic induction, with the HFCT being typically placed on the grounding cable or accessory metal shielding wire to induce local discharge signals [19].For local discharge feature extraction, two main methods are employed: the characteristic parameter method and the distribution mapping method.The characteristic parameter method includes various aspects such as discharge amount, mean values, average phase, or skewness of discharge, among others [20][21][22].Meanwhile, the distribution mapping method encompasses a pulse sequence phase distribution map (PRPS), a discharge phase profile (PRPD), W-N mapping, and others.Currently, most detection equipment outputs detect PD signals in the form of phase-resolved partial discharge (PRPD) mapping [23][24][25].When making practical judgments about the type of discharge, professional technicians are required to further analyze the PRPD mapping's characteristics.However, this method necessitates extensive training, and skilled professionals may incur high costs while its accuracy can be influenced by subjective factors [26,27].
In recent years, deep learning theory has demonstrated significant advantages in data feature extraction and the acquisition of sample feature information, pushing to the forefront of artificial intelligence.CNNs belong to a class of deep feed-forward networks capable of capturing high-dimensional nonlinear features within data.Their outstanding performance in image recognition has garnered significant attention in the realm of local discharge pattern-recognition [28,29].For instance, Hongbo Li and Fan Yang employed the feature parameter method to extract discharge features and utilized CNNs for local discharge pattern-recognition, achieving a high recognition accuracy.In the literature [22], a PD feature dataset was initially constructed by extracting feature information such as peak voltage, pulse width, and phase angle, which were subsequently classified using CNNs.The literature [30] converted marginal spectrograms of PD into grayscale matrices, which served as input for a deep residual network.This approach facilitated the classification and recognition of feature parameters associated with PD.Both of these methods primarily extracted characteristic information of local discharges using the feature parameter method, resulting in the recognition accuracy levels reaching 90%.PRPD spectra were visually represented as images.The literature [23] extracted moment features and grayscale covariance matrix features from PRPD spectra, utilizing them as input for a support vector machine (SVM) for classification.The literature [28] employed time-domain waveform images as input and utilized CNNs for direct pattern-recognition.The literature [31] used CNNs to automatically extract image features from PRPD, enabling the classification and recognition of PRPD patterns.However, in cases where individual data profiles were closely similar, the method suffered from a lack of useful discharge features, impacting the accuracy of localized discharge pattern-recognition.The literature [32] developed an HV equipment monitoring system based on embedded technology, designed specifically to monitor the occurrence of PD phenomena in the insulation layer.Nevertheless, it could not accurately classify specific discharge types using deep-learning techniques.Similarly, the literature [27] utilized low-cost microcontrollers to capture acoustic emission pulses and detect anomalies like turn-to-turn discharges, creeping discharges, or surface discharges.However, it could not accurately classify specific discharge types.Recognizing the specific discharge type remains a challenge, as deep learning technology demands substantial computing power and memory space.Consequently, in the aforementioned literature, CNN identification was conducted on the PC side, allowing for the determination of the occurrence of PD on the embedded side.However, this did not enable the precise identification of specific discharge types.
In summary, this paper proposes a PD pattern-recognition method for HV equipment that is based on a microcontroller and a CNN, where both data acquisition and algorithm implementation are handled by the microcontroller, significantly reducing system costs and power consumption.This technique captures the discharge signal through an HFCT [33,34], and the signal, after conditioning by a hardware circuit, is sampled using the built-in ADC of the STM32F769I microcontroller.The acquired data is analyzed by PRPD to generate an n-q-ϕ plot, where "n" denotes the number of discharges, "q" denotes the amount of discharges, and "ϕ" denotes the phase of discharges.Then, the PRPD spectrograms of multiple data are superimposed in the same phase, and the distribution of discharge pulses in the spectrograms is counted based on the superimposed spectrograms, and the distribution of discharge point positions in the PRPD diagrams is constructed based on the characteristic information of the discharge pulse.This is then converted into a grayscale map in PNG format.Finally, the discharge type recognition is accomplished using a CNN in the STM32H743 microcontroller (Makers: STMicroelectronics; Source City: Guangdong, China).Laboratory test results show that the accuracy of the discharge type recognition of this system can reach more than 98%, and the system as a whole is completed on the microcontroller, greatly reducing the cost and power consumption of the system, while simultaneously improving the portability of the system, making it more convenient to identify the pattern of PD.

Materials and Methods
PD data from various insulation defect types and different severity levels are acquired through discharge simulation experiments using HV equipment (Makers: Wuhan Sanxin Power Equipment Manufacturing Co; Source City: Wuhan, China).The collected data is then transformed into n-q-ϕ maps using the PRPD map analysis method for feature extraction.Subsequently, these maps are converted into grayscale representations.

Dielectric Defects and PD Types
Given the diverse array of defects present in the dielectric of HV electrical equipment, resulting in varying levels of uniformity in electric field distribution, an analysis of three discharge types was conducted based on statistical data pertaining to PD faults observed during the operation of HV electrical equipment [35][36][37].To simulate these discharges induced by different electric field distributions, three discharge types were modeled, as depicted in Figure 1.These simulations encompassed tip discharge, plate discharge, and ball-plate discharge [38].This was executed within the context of HV electrical equipment, with polyvinyl chloride serving as the inter-electrode insulation material and an insulation layer thickness of 4.5 mm.

PD Data Acquisition
A custom-made HFCT was employed to gauge the high-frequency current signal generated by the cable's PD [39].The sensor's frequency range extended from 1 MHz to 25 MHz, and it exhibited a transmission impedance of up to 16.4 mV/mA.Figure 2 illustrates the physical HFCT along with its transmission characteristics.

PD Data Acquisition
A custom-made HFCT was employed to gauge the high-frequency current signal generated by the cable's PD [39].The sensor's frequency range extended from 1 MHz to 25 MHz, and it exhibited a transmission impedance of up to 16.4 mV/mA.Figure 2 illustrates the physical HFCT along with its transmission characteristics.Considering that the sampling rate of the STM32F7 MCU with its own ADC that was used in this paper was up to 2.4 MHz, a signal-conditioning circuit was designed to detect and amplify the high-frequency signal output from the HFCT, so that the sampling rate requirement could be greatly reduced while basically maintaining the signal peak and phase characteristics.As shown in Figure 3, a calibrated pulse generator conforming to the IEC60270 standard [40] and modeled as a JZF-9 calibrator(Makers: Shanghai Songbao Technology Development Co; Source City: Shanghai, China) was used to output a charge of 500 pC; the raw waveform is shown in Figure 4a.After the signal-conditioning circuit,

PD Data Acquisition
A custom-made HFCT was employed to gauge the high-frequency current signal generated by the cable's PD [39].The sensor's frequency range extended from 1 MHz to 25 MHz, and it exhibited a transmission impedance of up to 16.4 mV/mA.Figure 2 illustrates the physical HFCT along with its transmission characteristics.Considering that the sampling rate of the STM32F7 MCU with its own ADC that was used in this paper was up to 2.4 MHz, a signal-conditioning circuit was designed to detect and amplify the high-frequency signal output from the HFCT, so that the sampling rate requirement could be greatly reduced while basically maintaining the signal peak and phase characteristics.As shown in Figure 3, a calibrated pulse generator conforming to the IEC60270 standard [40] and modeled as a JZF-9 calibrator(Makers: Shanghai Songbao Technology Development Co; Source City: Shanghai, China) was used to output a charge of 500 pC; the raw waveform is shown in Figure 4a.After the signal-conditioning circuit, the discharge pulse signal could be broadened to the µs level and the microcontroller could use its own ADC to sample it; the conditioned waveform is shown in Figure 4b.
To ascertain distinct characteristics of various PD types, a 0-10 KV high voltage was applied to both terminals of the discharge model, inducing PD by breaching the insulating medium.The resulting PD pulse current signal along the ground wire was then captured using the HFCT.Subsequent to signal conditioning, the signal was sampled using the STM32F769 microcontroller's integrated ADC.Considering that the sampling rate of the STM32F7 MCU with its own ADC that was used in this paper was up to 2.4 MHz, a signal-conditioning circuit was designed to detect and amplify the high-frequency signal output from the HFCT, so that the sampling rate requirement could be greatly reduced while basically maintaining the signal peak and phase characteristics.As shown in Figure 3, a calibrated pulse generator conforming to the IEC60270 standard [40] and modeled as a JZF-9 calibrator(Makers: Shanghai Songbao Technology Development Co; Source City: Shanghai, China) was used to output a charge of 500 pC; the raw waveform is shown in Figure 4a.After the signal-conditioning circuit, the discharge pulse signal could be broadened to the µs level and the microcontroller could use its own ADC to sample it; the conditioned waveform is shown in Figure 4b.
The microcontroller was equipped with three ADCs, each with a single pling rate set at 1.8 MHz.In a three-fold ADC mode cyclic-sampling configu cumulative sampling rate reached 5.4 MHz, enabling the collection of 108,000 within a single cycle.The schematic for data acquisition is depicted in Figure

Feature Extraction Based on PRPD Data
The PD phase map and discharge amount distribution map contain impo mation about the type of discharge caused by insulation defects.In this stu tracted the discharge phase, discharge amount, and number of discharges fr lected PD sampling data to map the PRPD characteristics.The microcontroller was equipped with three ADCs, each with a single ADC sampling rate set at 1.8 MHz.In a three-fold ADC mode cyclic-sampling configuration, the cumulative sampling rate reached 5.4 MHz, enabling the collection of 108,000 data points within a single cycle.The schematic for data acquisition is depicted in Figure 5.

Feature Extraction Based on PRPD Data
The PD phase map and discharge amount distribution map contain important information about the type of discharge caused by insulation defects.In this study, we extracted the discharge phase, discharge amount, and number of discharges from the collected PD sampling data to map the PRPD characteristics.

Implementation of PRPD Feature Extraction
According to the three discharge models shown in Figure 1 and the measurement device shown in Figure 5, PD data of 4000 IF cycles were collected in this paper.In order to improve the recognition-generalization ability of the neural network, we collected the To ascertain distinct characteristics of various PD types, a 0-10 KV high voltage was applied to both terminals of the discharge model, inducing PD by breaching the insulating medium.The resulting PD pulse current signal along the ground wire was then captured using the HFCT.Subsequent to signal conditioning, the signal was sampled using the STM32F769 microcontroller's integrated ADC.
The microcontroller was equipped with three ADCs, each with a single ADC sampling rate set at 1.8 MHz.In a three-fold ADC mode cyclic-sampling configuration, the cumulative sampling rate reached 5.4 MHz, enabling the collection of 108,000 data points within a single cycle.The schematic for data acquisition is depicted in Figure 5.The microcontroller was equipped with three ADCs, each with a single ADC sampling rate set at 1.8 MHz.In a three-fold ADC mode cyclic-sampling configuration, the cumulative sampling rate reached 5.4 MHz, enabling the collection of 108,000 data points within a single cycle.The schematic for data acquisition is depicted in Figure 5.

Feature Extraction Based on PRPD Data
The PD phase map and discharge amount distribution map contain important information about the type of discharge caused by insulation defects.In this study, we extracted the discharge phase, discharge amount, and number of discharges from the collected PD sampling data to map the PRPD characteristics.

Feature Extraction Based on PRPD Data
The PD phase map and discharge amount distribution map contain important information about the type of discharge caused by insulation defects.In this study, we extracted the discharge phase, discharge amount, and number of discharges from the collected PD sampling data to map the PRPD characteristics.

Implementation of PRPD Feature Extraction
According to the three discharge models shown in Figure 1 and the measurement device shown in Figure 5, PD data of 4000 IF cycles were collected in this paper.In order to improve the recognition-generalization ability of the neural network, we collected the discharge patterns of different discharge models at voltage levels from 4.5 kV to 6.5 kV, with a voltage interval of 0.5 kV.
Since a single dataset contains less useful feature information, most of the data were concentrated around 0 V; this situation arose due to the use of the ADC to collect data, as, when no discharge data was present, the amplitude of the data collected by the ADC was around 0.1 V, as shown in Figure 6a,c,e.The features extracted from these datasets for pattern-recognition were limited, so we needed to filter out the useless data first.In order to filter out the data around the zero value, we chose the downsampling method to retain the useful information regarding the PD, achieved by uniformly dividing the 108,000 sampled data points into 360 • phase intervals, with each phase interval containing 300 data points.We then extracted the maximum value from each phase interval using the fast-sorting algorithm and used the maximum value from each phase interval as the discharge amplitude through downsampling.The pre-processed PRPD maps have limited signal features and are easily interfered with by noise signals, making it difficult to recognize the PD patterns.To enhance the recognition of discharge characteristics, we chose to superimpose the continuously obtained PRPD maps.Through testing, we found that, for the type of tip discharge, the recognition effect achieved by superimposing 15 times and 20 times was nearly identical.Considering the running time and program complexity on the embedded side, in this paper, we continuously collected the signals for 15 cycles and then performed the same-phase superposition.The superposition of the PRPD map is shown in Figure 6b,d,f.

Conversion of PRPD into Grayscale Feature Maps
The PRPD plots obtained in the previous section were converted to PNG-format images for training and recognition.Firstly, the horizontal axis was divided into 60 equal intervals and the vertical axis was divided into 50 equal intervals, crossing the intervals in the horizontal and vertical axes to create cells on the map.The 360 • phase of the horizontal axis was divided into 60 equal parts, with each cell occupying 6 • of phase, and the voltage range of 2 V on the vertical axis was divided into 50 equal parts, with each cell representing an amplitude range of 0.04 V, resulting in a total of 3000 cells.The value of each cell was determined based on the number of discharge points within each respective cell; the conversion process is illustrated in Figure 7. Finally, the pixel values of the grayscale map are normalized to a range of 0 to 255, based on the number of discharge points, resulting in the characteristic grayscale map for the final input model.
The number of discharge points contained within each array represents the grayscale value per pixel of the PNG image, and the generated image and parameters are shown in Figure 8 and Table 1.
PD patterns.To enhance the recognition of discharge characteristics, we chose to superimpose the continuously obtained PRPD maps.Through testing, we found that, for the type of tip discharge, the recognition effect achieved by superimposing 15 times and 20 times was nearly identical.Considering the running time and program complexity on the embedded side, in this paper, we continuously collected the signals for 15 cycles and then performed the same-phase superposition.The superposition of the PRPD map is shown in Figure 6b,d,f.

Conversion of PRPD into Grayscale Feature Maps
The PRPD plots obtained in the previous section were converted to PNG-format im ages for training and recognition.Firstly, the horizontal axis was divided into 60 equ intervals and the vertical axis was divided into 50 equal intervals, crossing the intervals the horizontal and vertical axes to create cells on the map.The 360° phase of the horizont axis was divided into 60 equal parts, with each cell occupying 6° of phase, and the voltag range of 2 V on the vertical axis was divided into 50 equal parts, with each cell represen ing an amplitude range of 0.04 V, resulting in a total of 3000 cells.The value of each ce was determined based on the number of discharge points within each respective cell; th conversion process is illustrated in Figure 7. Finally, the pixel values of the grayscale ma are normalized to a range of 0 to 255, based on the number of discharge points, resultin in the characteristic grayscale map for the final input model.The number of discharge points contained within each array represents the graysca value per pixel of the PNG image, and the generated image and parameters are shown Figure 8 and Table 1.The number of discharge points contained within each array represents the grayscale value per pixel of the PNG image, and the generated image and parameters are shown in Figure 8 and Table 1.

CNN Building and Porting
Based on Python language, the convolutional neural network model is built using a TensorFlow framework.The pattern-recognition is divided into three categories: pin-board, board-board, and ball-board discharge.

CNN Model Construction
Studies have shown that CNN classification performance and CNN neural network size have a large correlation with the number of network layers [41].A complete convolutional neural network consists of the following layers: input layer, convolutional layer, pooling layer, fully connected layer, and output layer [29].The layer structure is shown in Figure 9.
OR PEER REVIEW 8 of 16

CNN Building and Porting
Based on Python language, the convolutional neural network model is built using a TensorFlow framework.The pattern-recognition is divided into three categories: pinboard, board-board, and ball-board discharge.

CNN Model Construction
Studies have shown that CNN classification performance and CNN neural network size have a large correlation with the number of network layers [41].A complete convolutional neural network consists of the following layers: input layer, convolutional layer, pooling layer, fully connected layer, and output layer [29] .The layer structure is shown in Figure 9.By pressurizing the three PD models, we collected 4000 sets of discharge data in the laboratory.These datasets were processed using the methods described in the previous section to obtain 260 grayscale maps in PNG format.Subsequently, these maps were used for training and testing using CNN.
From the obtained 260 grayscale images, 200 were selected as the training set of the model, and the network model was obtained through 1000 iterations of training using 10fold cross-validation.Specifically, the training was repeated 10 times, and, for each train- By pressurizing the three PD models, we collected 4000 sets of discharge data in the laboratory.These datasets were processed using the methods described in the previous section to obtain 260 grayscale maps in PNG format.Subsequently, these maps were used for training and testing using CNN.From the obtained 260 grayscale images, 200 were selected as the training set of the model, and the network model was obtained through 1000 iterations of training using 10-fold cross-validation.Specifically, the training was repeated 10 times, and, for each training, nine subsets of data from the dataset were selected as the training set of the model, while the remaining 20 grayscale images were used as the test set of the model.The network model was tested every time the network weights were updated twice.Based on the above method, the number of convolutional layers that the convolutional neural network was set to were three, four, five, and six layers for training, respectively.After each training, 10 evaluation results were obtained, and then the accuracy of the network model was calculated as the average of these evaluation results.The experiments compared and analyzed the recognition effect of convolutional neural networks with different convolutional layers under different iteration numbers, as shown in Figure 10.
Appl.Sci.2023, 13, x FOR PEER REVIEW convolutional neural network model is better.Taking into account the need to tr the network model into the microprocessor to run, the more complex the model, it occupies processor resources, and the more time consuming it is.Therefore, in per, the network model with four layers of convolutional layers was selected for recognition.

CNN Porting
The neural network model obtained from the training described in the prev tion, generating .h5files, was converted using an ST's X-CUBE-AI control [43] to the code in Python environment to C environment code, generating .cand .hfile four-fold compression, the converted and compressed convolutional neural model required 946.01 KB of Flash space and 125.36 KB of RAM space, which co be ported to the STM32H743 microcontroller.Its RAM resource allocation is s Figure 11.From the figure, the following can be seen: the recognition accuracy fluctuated more in the early stage; the model's response to the data was relatively sensitive; the model could quickly learn some basic features; and the model's convergence speed was faster.When the number of network layers was small, the CNN's ability to fit the sample data was poor, the loss function value of the model was high, and the recognition effect was poor.With the increase in the number of convolutional layers, the complexity of the network model increased, with more parameters and more powerful feature-extraction ability, and the recognition accuracy of the network model could reach over 95% stably when the number of convolutional layers was four and five.However, due to less training data, when six convolutional layers were used, the convolutional neural network was deeper, generating the risk of overfitting [29,42], and the model learnt some useless feature information, which reduced the generalization performance of the model.In summary, when the number of convolutional layers is four and five, the recognition effect of the convolutional neural network model is better.Taking into account the need to transplant the network model into the microprocessor to run, the more complex the model, the more it occupies processor resources, and the more time consuming it is.Therefore, in this paper, the network model with four layers of convolutional layers was selected for training recognition.

CNN Porting
The neural network model obtained from the training described in the previous section, generating .h5files, was converted using an ST's X-CUBE-AI control [43] to convert the code in Python environment to C environment code, generating .cand .hfiles.Using four-fold compression, the converted and compressed convolutional neural network model required 946.01 KB of Flash space and 125.36 KB of RAM space, which could then be ported to the STM32H743 microcontroller.Its RAM resource allocation is shown in Figure 11.

CNN Porting
The neural network model obtained from the training described in the prev tion, generating .h5files, was converted using an ST's X-CUBE-AI control [43] t the code in Python environment to C environment code, generating .cand .hfil four-fold compression, the converted and compressed convolutional neural model required 946.01 KB of Flash space and 125.36 KB of RAM space, which c be ported to the STM32H743 microcontroller.Its RAM resource allocation is Figure 11.

System Design
To verify the method proposed in the paper, a PD monitoring system based on microcontroller and convolutional neural network was designed, and the overall framework is shown in Figure 12.The system used a pulse current sensor to sense the PD signal and then amplifier and detector circuits to condition the PD signal, and, finally, the data was acquired by the microcontroller with its own ADC.The laboratory test environment is shown in Figure 13.
The data acquisition section used an STM32F769 microcontroller, triggered by an industrial frequency signal with a sampling frequency of 5.4 MHz.The acquired data was subjected to feature construction after Section 3.1, and, after superimposing 15 cycles of data to generate PNG grayscale images, it was transferred to the data analysis section through the serial port.
The data analysis section used an STM32H743 microcontroller ported with the convolutional neural network described in Section 2.2.This microcontroller used the serial port to receive the grayscale image data and then performed a neural network calculation to identify and obtain the discharge type and return the identification result to the data acquisition section via the serial port for display.
To verify the method proposed in the paper, a PD monitoring system based on microcontroller and convolutional neural network was designed, and the overall framework is shown in Figure 12.The system used a pulse current sensor to sense the PD signal and then amplifier and detector circuits to condition the PD signal, and, finally, the data was acquired by the microcontroller with its own ADC.The laboratory test environment is shown in Figure 13.The data acquisition section used an STM32F769 microcontroller, triggered by an industrial frequency signal with a sampling frequency of 5.4 MHz.The acquired data was subjected to feature construction after Section 3.1, and, after superimposing 15 cycles of data to generate PNG grayscale images, it was transferred to the data analysis section through the serial port.
The data analysis section used an STM32H743 microcontroller ported with the convolutional neural network described in Section 2.2.This microcontroller used the serial

System Design
To verify the method proposed in the paper, a PD monitoring system based on m crocontroller and convolutional neural network was designed, and the overall framewor is shown in Figure 12.The system used a pulse current sensor to sense the PD signal an then amplifier and detector circuits to condition the PD signal, and, finally, the data wa acquired by the microcontroller with its own ADC.The laboratory test environment i shown in Figure 13.The data acquisition section used an STM32F769 microcontroller, triggered by an in dustrial frequency signal with a sampling frequency of 5.4 MHz.The acquired data wa subjected to feature construction after Section 3.1, and, after superimposing 15 cycles o data to generate PNG grayscale images, it was transferred to the data analysis sectio through the serial port.
The data analysis section used an STM32H743 microcontroller ported with the con volutional neural network described in Section 2.2.This microcontroller used the seria

System Testing
Using the PD monitoring system designed in the paper, the different discharge models were tested in the laboratory under pressure to evaluate the anti-interference, measurement range, and applicability of the system, and the detection accuracy of the CNN ported into the microcontroller was analyzed and compared with the test accuracy of the CNN on the PC side.The test results are as follows.

Test Results under Different Noise Environments
A calibration pulse generator was used as the noise condition, and, when the discharge signal of the discharge model was collected, the calibration pulse generator was passed through the HFCT magnetic ring alongside it, so that the measured signal contained the periodic pulse noise signal.
The calibration pulse generator was connected to the sensor with 10 pC, 50 pC, and 500 pC discharges at a fixed frequency interval of 1 kHz in the test environment, at an input voltage of 8 kV and an insulation medium thickness of 4.5 mm.The three discharge types were tested 100 times for identification after adding different noises, and the results are shown in Table 2.

Pattern-Recognition Accuracy at Different Test Voltages
For the collection of a dataset, the influence of different voltage ranges on the accuracy of the neural network needs to be considered.In this paper, discharge data under 6 kV, 7 kV, 8 kV, and 9 kV voltage conditions were mainly collected; the amplification of the amplification circuit was fixed; and the thickness of the insulation layer was fixed at 4.5 mm.The recognition accuracy under different voltages was obtained through 100 instances of actual tests, as shown in Table 3.The datasets collected at these different voltages were trained, and the results showed that the local discharge signal induced by the insulation layer defects when the discharge voltage was 8 kV had distinct characteristics and that the trained neural network had a higher accuracy rate of 98.3%.

Analysis of Test Results with Different Insulation Media Thickness
In practical applications, the thickness of insulation layers under different transmission voltages is different in order to account for the safety of the cables.The insulation thickness of commonly used 6~10 kV cables is generally 3.5 mm, 4.5 mm, 5.5 mm, and 6.5 mm.For these four insulation thicknesses, the recognition accuracy results of the three models were obtained after 100 instances of actual testing with the input voltage fixed at 8 kV; the results are shown in Table 4.

Comparison of CNN-Running Results on Microcontroller and PC
The network model was built on the PC side; the specific parameters of the CNN model were obtained by using 4000 sets of data as the training set; and the recognition accuracy of each discharge type was obtained after training, as shown in Table 5.The models were trained and imported into the STM32H743 microcontroller, and the discharge types were identified using the system built in the paper.The test conditions were kept the same as those when the training data were collected: the thickness of the insulation layer used was 4.5 mm and the discharge voltage was 8 kV.The recognition accuracies of the three discharge models were obtained through 100 actual tests, as shown in Table 6.According to the test results, it was concluded that the transplanted CNN model still had a high recognition accuracy and that the system could achieve the purpose of recognizing discharge types with an average recognition accuracy of 98.33%.

Comparison of Different Feature Extraction Methods
To emphasize that this paper enhanced the distinction of PD types through the stacking of PRPD maps, we conducted tests on the PRPD maps in various scenarios: without stacking, after stacking 10 times, 15 times, and 20 times.Subsequently, we converted these PRPD maps into grayscale images using the same method as the input for the CNN model.Each set of data was then processed by the three models under identical conditions.The results obtained are shown in Table 7. From the above table, it can be concluded that the PRPD plots generated by overlaying the data were more useful for the recognition of discharge patterns, especially for the tip discharge model.Among the three discharge models, the plate discharge and the ball-plate discharge exhibited similar waveforms, and, even after 10 superimpositions, the recognition accuracy remained low.However, after 15 superimpositions, the average accuracy of model recognition could reach 98.17%, with no significant improvement observed after 20 superimpositions.Additionally, it is important to note that, as the number of superimpositions increased, the program consumed more processing resources and time, thereby significantly increasing the workload on the microprocessor.Consequently, we made the decision to construct the data features using 15 superimpositions.

Comparison of Pattern-Recognition Methods
In order to illustrate the superiority of the proposed method in feature extraction and pattern-recognition compared with the traditional method, this paper compared the recognition results with the NanoEdge AI classifier.NanoEdge AI extracts features using the feature parameter method, combined with the literature references [22,28,30,31].Firstly, the collected data was normalized, and then the amplitude features of the discharge pulse, time-domain features of the discharge, frequency-domain features of the discharge, and skewness features were extracted from the data, among other attributes.The features from each group of data were integrated to generate an unsigned one-dimensional array with a length of 1080 elements, which was used as the input for the network model.By collecting 4000 sets of data for model training for each of the board-board, ball-board, and pin-board models, the best classification model was selected from the classification library and then transferred to the STM32F769NI microcontroller for model recognition.The two different approaches were executed on the embedded side for testing, using an insulation thickness of 4.5 mm and a discharge voltage of 8 kV, and the final recognition accuracy comparison was obtained through 200 sets of test experiments, as shown in Table 8.As can be seen from the above table, the overall accuracy of CNN between the two identification methods reached 98.17%, which was 11.47% higher than that of the NanoEdge AI classification algorithm.Among the three insulation types, board-plate discharge had more data on the PRPD map and its discharge characteristics were more obvious and easier to distinguish.In contrast, ball-plate discharge and tip discharge were relatively more challenging to recognize.The unique network structure of the CNN model allowed it to deeply extract data features, effectively capturing detailed information and learning a broader range of comprehensive and abstract features from the grayscale map.

Conclusions
In this paper, we propose a method for PD detection and discharge type recognition in HV equipment, based on a microcontroller and a CNN, where both data acquisition and pattern-recognition algorithms are completed by the microcontroller, characterized by low cost and low power consumption.Based on testing and analysis, the following conclusions have been reached: (1) The PRPD maps obtained through preprocessing and superimposing 15 consecutively collected emission datasets feature more clearly defined localized emission character-istics, a greater number of valid emission points, and significantly improved accuracy in distinguishing between PD types.
(2) We propose a method for transferring the complex deep learning network model to the microprocessor side, and the accuracy does not significantly degrade after the network model is ported to the microprocessor.To validate the feasibility of this approach, we designed a PD pattern-recognition system based on a microcontroller and a convolutional neural network.Through laboratory tests, the microcontroller achieved an accuracy of 98.33% in recognizing three typical discharge types, which differs by only 0.97% from that of the PC.
(3) The PD monitoring system designed using this method has a power consumption of 5.28 W and takes approximately 12 s for a single PD pattern-recognition.The system's cost is less than $150.In the engineering application field of PD pattern-recognition, this method offers a new detection approach characterized by its affordability, low power consumption, and a high recognition accuracy, rendering it of significant practical value.
(4) The amplification detector circuit designed in this paper can broaden a 25 MHz pulse signal to approximately 30 µs while preserving the primary characteristics of amplification and phase, allowing direct sampling using the microcontroller's built-in ADC.
(5) According to the performance of the algorithm and storage space requirements, we chose a four-layer convolutional network, trained the network model, and used ST's X-CUBE-AI control for conversion and compression.The algorithm occupies 946.01 KB of Flash space and 125.36 KB of RAM space, and can be ported to run in a STM32H7 microcontroller.The pattern-recognition of local discharges is achieved by the microcontroller without requiring data interaction with the host computer.
The method has a high accuracy in identifying the type of PD at the embedded end, and can identify a variety of discharge types.However, due to the limitation of data samples, the PD discharge phenomena occurring in different discharge environments are different, and the PD data generated by different degrees of insulation layer damage will also be different.Therefore, in order to improve the applicability of the system, in future research, we will collect as much data as possible from different PD types in the training samples, and we hope to integrate the model training into the system to run synchronously, so that when the accuracy of identifying the discharge types decreases, the training can be carried out in time to improve the ability of identifying PD types.

Figure 1 .
Figure 1.Physical diagram of the three designed discharge models.Note: (a) represents tip discharge, (b) represents flat plate discharge, and (c) represents ball-plate discharge model.The black disc in the middle of the top and bottom electrodes is the polyvinyl chloride insulation.

Figure 2 .
Figure 2. Physical diagram and transmission characteristics curve of the homemade HFCT.

Figure 1 .
Figure 1.Physical diagram of the three designed discharge models.Note: (a) represents tip discharge, (b) represents flat plate discharge, and (c) represents ball-plate discharge model.The black disc in the middle of the top and bottom electrodes is the polyvinyl chloride insulation.

Figure 1 .
Figure 1.Physical diagram of the three designed discharge models.Note: (a) represents tip discharge, (b) represents flat plate discharge, and (c) represents ball-plate discharge model.The black disc in the middle of the top and bottom electrodes is the polyvinyl chloride insulation.

Figure 2 .
Figure 2. Physical diagram and transmission characteristics curve of the homemade HFCT.

Figure 2 .
Figure 2. Physical diagram and transmission characteristics curve of the homemade HFCT.

Figure 4 .
Figure 4. Capture of the discharge signal at a discharge of 500 pC: (a) data captured cessing; (b) data captured using a detector amplifier circuit.

2.3. 1 .
Implementation of PRPD Feature ExtractionAccording to the three discharge models shown in Figure1and the m device shown in Figure5, PD data of 4000 IF cycles were collected in this pap

Figure 4 .
Figure 4. Capture of the discharge signal at a discharge of 500 pC: (a) data captured without processing; (b) data captured using a detector amplifier circuit.

Figure 4 .
Figure 4. Capture of the discharge signal at a discharge of 500 pC: (a) data captured without processing; (b) data captured using a detector amplifier circuit.

Figure 4 .
Figure 4. Capture of the discharge signal at a discharge of 500 pC: (a) data captured without processing; (b) data captured using a detector amplifier circuit.

Figure 6 .
Figure 6.PRPD plots corresponding to three different discharge types: (a) tip model single discharge data; (b) PRPD mapping corresponding to tip discharge; (c) single discharge data for ball-plate

Figure 6 .
Figure 6.PRPD plots corresponding to three different discharge types: (a) tip model single discharge data; (b) PRPD mapping corresponding to tip discharge; (c) single discharge data for ball-plate model; (d) PRPD mapping corresponding to ball-plate discharge; (e) single discharge data for board model; (f) PRPD mapping corresponding to board-board discharge.

Figure 8 .
Figure 8. Grayscale diagram of different discharge model features.(a) Grayscale map of tip discharge characteristics; (b) grayscale map of ball-plate discharge characteristics; (c) grayscale map of board-board discharge characteristics.

Figure 8 .
Figure 8. Grayscale diagram of different discharge model features.(a) Grayscale map of tip discharge characteristics; (b) grayscale map of ball-plate discharge characteristics; (c) grayscale map of boardboard discharge characteristics.

Figure 9 .
Figure 9.The basic structure of CNN.

Figure 9 .
Figure 9.The basic structure of CNN.

Figure 10 .
Figure 10.Variation of neural network recognition accuracy with number of iterations fo number of convolutional layers.

Figure 10 .
Figure 10.Variation of neural network recognition accuracy with number of iterations for different number of convolutional layers.

Figure 10 .
Figure 10.Variation of neural network recognition accuracy with number of iterations fo number of convolutional layers.

Table 1 .
Image information table.

Table 1 .
Image information table.

Table 2 .
Test results under different noise environments.

Table 3 .
Test results at different voltages.

Table 4 .
Different insulation media thickness test results.

Table 5 .
PC-side model test results.

Table 7 .
Recognition results for the three models with varying degrees of superposition.

Table 8 .
Comparison of recognition accuracy between CNN and NanoEdge AI.