Next Article in Journal
Method and System for Heart Rate Estimation Using Linear Prediction Filtering
Previous Article in Journal
Wavelet-Based Estimation of Damping from Multi-Sensor, Multi-Impact Data
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Intelligent Closed-Loop Fluxgate Current Sensor Using Digital Proportional–Integral–Derivative Control with Single-Neuron Pre-Optimization

1
ChenYang Technologies GmbH & Co. KG, Markt Schwabener Str. 8, 85464 Finsing, Germany
2
Chair of High-Performance Inverter Systems, Technical University of Munich, Arcisstr. 21, 80333 Munich, Germany
*
Author to whom correspondence should be addressed.
Signals 2025, 6(2), 14; https://doi.org/10.3390/signals6020014
Submission received: 20 February 2025 / Revised: 14 March 2025 / Accepted: 18 March 2025 / Published: 24 March 2025

Abstract

:
This paper presents a microcontroller-controlled closed-loop fluxgate current sensor utilizing digital proportional–integral–derivative (PID) control with a single-neuron-based self-pre-optimization algorithm. The digital PID controller within the microcontroller (MCU) regulates the drive circuit to generate a feedback current in the feedback winding based on the zero-flux principle in a closed-loop system. This feedback current is proportional to the measured external current, thereby achieving magnetic compensation. Although PID parameters can be determined using heuristic approaches, empirical formulas, or model-based methods, these techniques are often labor-intensive and time-consuming. To address this challenge, this study implements a single-neuron-based self-pre-optimization algorithm for PID parameters, which autonomously identifies the optimal values for the closed-loop system. Once the PID parameters are optimized, a conventional positional PID algorithm is employed for the closed-loop control of the fluxgate current sensor. The experimental results show that the developed digital closed-loop fluxgate sensor has a non-linearity within 0.1% at the full scale in the measuring ranges of 0–1 A and 0–10 A DC current, with an effective response time of approximately 120 ms. The limitation of the sensors’ response time is found to be ascribed to its open-loop measuring circuit.

1. Introduction

Electric current is fundamental to modern industry, playing a crucial role in many aspects of industry, especially in power electronic converters and power distribution systems, where precise current measurement is often mandatory. Today, many current measurement techniques offer a specific performance in terms of linearity, accuracy, bandwidth, isolation, cost, measuring range, and size. Among these techniques, fluxgate current sensors have always been attractive to researchers due to their high performance and broad application in power electronics. A fluxgate current sensor is a magnetic field sensor widely used in DC or low-frequency AC measurements [1,2]. Compared to other types of magnetic sensors, fluxgate sensors offer advantages such as high sensitivity, high accuracy, high resolution (up to 0.1 nT), a wide operating temperature range, long-term stability, and minimal temperature drift of sensitivity [1,2,3,4,5,6,7,8,9,10,11]. However, their bandwidth is relatively limited [12]. To enhance their high-frequency performance, a current transformer can be incorporated, with its output combined with the low-frequency component from the fluxgate sensor [13,14,15]. Due to their superior performance, fluxgate current sensors are widely utilized in various applications. These include monitoring local magnetic field distributions on magnetic tape, assessing the influence of solar storms on Earth’s geomagnetic field, and analyzing human heartbeats [16]. Additionally, fluxgate sensors are crucial in battery management systems, energy storage solutions, and space applications, where high sensitivity and precision are essential [17,18,19].
Fluxgate current sensors are commonly classified into open-loop and closed-loop types based on the sensing configuration [6]. Compared to an open-loop system, a closed-loop fluxgate sensor is less susceptible to flux sensor gain variations. It has better linearity because the core flux density is always close to zero, avoiding the non-linearity introduced by the core material in open-loop systems [13]. Additionally, a closed-loop fluxgate sensor with a magnetic core and a feedback winding can improve the sensor’s sensitivity, eliminate offset and drift related to temperature, and significantly reduce the error caused by the magnetic hysteresis phenomenon [1,2]. However, these advantages come at the cost of a complex structure due to additional feedback windings and a higher power consumption due to the feedback loop. The high accuracy of a closed-loop sensor can be achieved by obtaining a zero-flux condition, i.e., a perfect balance between the magnetic flux generated by the measured current in the primary winding and that generated by the feedback current in the feedback winding [20].
Innovations in fluxgate current sensors have been made in both structure and signal processing. In terms of structure, a ripple compensation coil is added to reduce the high-frequency harmonics in the excitation waveform and to reduce the interference from external disturbances [21,22]. Completing signal processing in the digital domain means that after analog to digital conversion, it is completely unaffected by temperature, interference, and change in power supply [22]. Thus, employing digital closed-loop control in fluxgate current sensors is desirable. PID control theory is typically applied to achieve closed-loop control [23,24]. With its simple structure, good stability, and reliable performance, it has become one of the main industrial control technologies. In most control system applications, over 90% of control loops are in the PID form [25,26]. Most traditional analog closed-loop fluxgate current sensors rely on an analog PI or PID circuit to control the feedback current for magnetic field compensation to achieve a zero-flux condition. However, adjusting the parameters of analog PI or PID circuits is tedious and laborious. In addition, once the PID parameters of the analog sensor are fixed, they cannot be easily modified. For these reasons, digital PID controllers are preferred in the industrial control field. With the popularity of MCU chips, a simple PID controller can be easily realized by running the digital PID algorithm in cooperation with the ADC and DAC modules of the MCU.
In PID theory, the PID parameters determine the performance of the control system, making the search for the optimal PID parameters for the system the most critical step. The optimal PID parameters must enable the control system to stabilize at the desired point as quickly as possible without oscillations and overshoots. For analog closed-loop sensors, the PID parameters are constant when the hardware parameters remain unchanged. This means the optimal PID parameters can be regarded as a system property that does not vary with the system inputs. Various tuning methods can be used to find the optimal PID parameters, such as trial and error methods, experiment-based methods, model-based analytical methods, and automatic tuning methods [27]. The design and analysis of fluxgate current sensors present challenges due to the non-linearity of the B-H curve of the core material [28,29]. The non-linear characteristics make model-based analytical methods more difficult and complex. Hence, most commercial PID controllers employ automatic methods that can adjust the controller’s parameters dynamically if there is a change in the system. Integrating more artificial intelligence methods into traditional fluxgate current sensors can significantly improve the sensors [30]. This paper proposes an automatic tuning method called the single-neuron-based self-pre-optimization algorithm to find the optimal PID parameters of the system in a faster and more intelligent way. The developed closed-loop fluxgate current sensor incorporates the single-neuron-based self-pre-optimization algorithm and the conventional PID algorithm to realize precise closed-loop control.
The rest of this paper is organized as follows: Section 2 describes the fluxgate technology, focusing on the zero-flux principle under a closed-loop. In Section 3, the developed sensor structure is presented. Subsequently, Section 4 details the closed-loop control algorithms, which contain the conventional positional PID algorithm and the single-neuron-based self-pre-optimization algorithm. Finally, Section 5 presents and analyzes the experimental results, discusses the problems that arise, and proposes countermeasures.

2. Fluxgate Technology

Section 2 describes the fluxgate technology, focusing on the zero-flux principle under a closed-loop.

2.1. Fluxgate Basic Principle

The working principle of a fluxgate is to use a saturable inductor to detect the magnetic field produced by an external current. This process exploits the non-linear relationship between the magnetic field ( H ) and the magnetic flux density ( B ) within a magnetic material [3]. The slope of the B - H magnetization curve is defined as the magnetic permeability μ , which depends on the material.
μ = Δ B Δ H .
Figure 1 shows a simple fluxgate sensor prototype. When the excitation alternating current   I e x flows through the excitation coil, it produces a magnetic field that periodically saturates the soft magnetic material of the sensor core in both directions. The device’s name comes from this “gating” of the flux that occurs when the core is saturated [4]. The core saturates twice during a single excitation cycle; hence, the magnetic flux density B p that is generated by the external current undergoes flux “gating” twice. According to Faraday’s electromagnetic induction principle, the induced voltage can be expressed as follows:
  V i n d = N A d B t + B p d t ,
where N is the number of turns on the sensing winding and A is the cross-sectional area of the core. The second harmonic of V i n d can be used to derive the external measured current, which is known as the second harmonic detection method [23,31].

2.2. Zero-Flux Principle Under a Closed-Loop

Closed-loop fluxgate sensors are based on flux compensation technology, also known as the zero-flux principle, as shown in Figure 2. In the closed-loop sensor structure, both the excitation winding N e x and the feedback winding N f are wound around the core. Without the primary current I p , there is no current feedback, and the flux through the core is zero. When a primary current I p is present, the sensor exits the zero-flux state. To obtain a null magnetic field in the magnetic circuit, the feedback winding N f must be excited with an appropriate current [32]. Since the direction of the feedback magnetic field is opposite to that of the primary magnetic field generated by the primary current, the feedback current will gradually increase until the primary magnetic field is balanced by the feedback magnetic field [1,2]. Finally, the sum of the magnetic fluxes Φ p and Φ f which are generated, respectively, by the primary and feedback currents is equal to zero. At that time, the whole system reaches a dynamic balance, namely the zero-flux state. Under zero-flux conditions, the relationship between the primary and feedback currents is as follows:
  I P = N f I f .  
The zero-flux principle has the advantage of improving the linearity of current measurement and enabling larger dynamic ranges. Based on this principle, the zero-flux detection method is crucial. The standard method of detecting the zero-flux state in the sensor’s magnetic circuit is through the average value of the excitation current I e x in the excitation coil. The excitation current I e x can be generated by a square wave voltage from a separate pulse generator or by the oscillation of a self-excitation circuit and the inductance of the magnetic core [33]. Assuming that the alternating excitation voltage is ideally symmetrical with a duty cycle of 50%, a symmetrical alternating excitation current is thus produced. When the primary current is non-zero, the voltage waveform across R s becomes asymmetric, i.e., the average value of the excitation current I e x ¯ is non-zero. Subsequently, I f must be adjusted to compensate for the magnetic flux density generated by I p , resulting in a symmetrical voltage waveform across R s , i.e., I e x ¯ is zero.

3. Sensor Structure

The developed microcontroller-controlled closed-loop fluxgate sensor primarily consists of a fluxgate sensor core, an open-loop sensing circuit, a feedback current drive circuit, and a microcontroller unit, as illustrated in Figure 3.
The magnetic core for fluxgate sensors is made of ferrite, a material with high permeability, which is essential for concentrating the magnetic field. An excitation winding N e x is evenly wound around the core and is connected to the open-loop sensing circuit. Additionally, a feedback winding around the core is necessary for magnetization compensation in closed-loop fluxgate current sensors. The open-loop sensing circuit, also known as the zero-flux detector, operates on the self-oscillating fluxgate technology to detect the primary current I p , and its output voltage is V o p e n . The ADC module inside the MCU acquires the voltage V o p e n and converts it into digital signals to perform the closed-loop control algorithms. These algorithms include a single-neuron-based self-pre-optimization algorithm and a conventional positional PID algorithm, which will be described in Section 4. The operating results of the PID-based closed-loop algorithms are converted to an analog voltage signal V D A C through the DAC module inside the MCU. The voltage V D A C is used to control the feedback current drive circuit to generate the appropriate feedback current to compensate for the magnetic field generated by the primary current. In the feedback current drive circuit, V D A C is proportional to the controlled feedback current. Therefore, according to the zero-flux principle, V D A C is also proportional to the primary current. The V D A C can be output as an analog voltage and transmitted as a digital signal via the UART communication module on the MCU.

4. Closed-Loop Control Algorithms

Section 4 details the closed-loop control algorithms containing the conventional positional PID algorithm and the single-neuron-based self-pre-optimization algorithm.

4.1. Digital Positional PID Control Algorithm

The PID algorithm is currently the most popular feedback controller used in the industry [34]. The PID algorithm was formally developed in the late 1930s and has a history of more than 90 years [35]. The basic PID control theory is essentially to control the actuator by the superimposed result of proportional, integral, and differential operations on the error between the target value and the actual value. As depicted in Figure 4, a typical PID controller consists of proportional, integral, and derivative components. In practical applications, the data acquisition module ADC and the actuator module DAC are usually needed in cooperation. For instance, in the PID-controlled closed-loop fluxgate current sensor illustrated in Figure 4, the acquirer ADC first captures the output voltage of the open-loop sensing circuit V o p e n and converts it to a digital signal V a c t u a l for processing through the digital PID algorithm. Then, the digital PID output u ( t ) needs to be converted to the analog control voltage V D A C by the actuator DAC. Next, V D A C controls the feedback current drive circuit to generate an appropriate feedback current for magnetization compensation. The resulting feedback current I f and the primary current I p collectively influence the open-loop sensing circuit to maintain V o p e n at a zero-flux state. This closed-loop control mechanism is facilitated by a digital PID controller, which can be implemented on an MCU by utilizing its internal ADC and DAC modules and the digital PID algorithm.
In Figure 4, e ( t ) is the deviation between the target value V t a r g e t and the actual value V a c t u a l , and u t is the output value of the PID controller. The following equation can express the continuous control law of the PID controller:
u t = K p e t + 1 T i 0 t e t d t + T d d e t d t .
where K p is the proportional factor of the control system, T i is the integration time of the control system, and T d is the differentiation time of the control system [35]. When absorbing K p of Equation (4) into the brackets, a new equation can be obtained:
u t = K p e t + K i 0 t e t d t + K d d e t d t .
For discrete PID, Equation (5) can also be written in the difference equation form:
u k = K p e k + 1 T i j = 0 k e j × T + T d e k e k 1 T ,
where T is the sampling time, e k refers to the error of the k -th sampling cycle, and u k is the PID output value at the k -th sampling cycle. Equation (6) is the general discrete equation of the basic PID control theory, also called the positional PID control algorithm. Similarly, Equation (6) can also be rewritten using K p , K i , and K d as follows:
u k = K p e k + K i j = 0 k e j + K d   e k e k 1 .  
The positional PID controller computes the control variable output after the k -th sampling cycle based on the deviation e k between the k -th sampling result of the controlled variable and the set value [35]. This PID controller is well suited for systems with relatively stable set-points and exhibits small steady-state errors. However, positional PID has its drawbacks. One disadvantage is that each PID output is influenced by all past errors, which can lead to significant cumulative deviations over time. Additionally, the calculation process involves the accumulation of e k , which can be computationally intensive.
In general, the parameters K p , K i , and K d must be selected appropriately so that the system is free of oscillations and overshoots and settles quickly. The selection of these parameters depends mainly on the dynamics of the sensor system, which are often quite difficult to describe using mathematical models. Therefore, the optimal settings of the controller need to be determined through experiments, which is a process known as tuning [36]. Common PID tuning methods rely on heuristics, such as trial and error or tuning tables, and the tuning process is usually laborious. Consequently, most commercial controllers incorporate some automatic tuning methods [27]. Table 1 compares four PID tuning methods based on their complexity, precision, the effort to determine the optimal PID parameters, and their adaptability to changing systems. The automatic tuning method is the most effective overall, particularly for systems that may change. Given that the hardware of developed sensors is rarely identical and that sensor systems are susceptible to variability, automatic tuning methods with a high adaptability to system changes are preferred. This paper introduces an automatic tuning method, exploiting a single-neuron-based self-pre-optimization algorithm to identify the optimal PID parameters of the system efficiently and intelligently, and which is detailed in the following section.

4.2. Single-Neuron-Based Self-Pre-Optimization Algorithm

A biological neuron comprises a cell body, dendrites, and an axon. Dendrites serve as the receiving parts of the neuron that receive synaptic inputs from axons. When the sum of the dendritic inputs exceeds a threshold, the neuron fires an action potential. The axon acts as the transmitting part of the neuron, which initiates an action potential down the axon, leading to the release of neurotransmitters. Numerous neurons together form a vast network of nerves called the nerve center, and human beings can perform a variety of behaviors in response to the commands from the nerve center. Inspired by the structure of a biological neuron, computational models based on neuronal architecture can be designed to enable machines to self-learn. A typical single-neuron model in machine learning is illustrated in Figure 5.
In this model, the input x j (where j = 1 ,   ,   n   ) corresponds to the receivers which are analogous to the dendrites of a biological neuron, while the output y i serves as the transmitter for the i -th neuron, which corresponds to the axon of a biological neuron. Each w i j (where j = 1 ,   ,   n ) represents the weight coefficient of the i -th neuron’s input signals, and θ i denotes the i -th neuron’s threshold. This neuron model operates on the principle that the neuron produces an output signal if the sum of its inputs, weighted by the corresponding coefficients, exceeds its threshold θ i . This mirrors the behavior of a biological neuron, which fires an electrical signal only when sufficiently stimulated. The neuron model illustrated in Figure 5 can be mathematically represented as follows:
  y i = j = 1 n w i j x i θ i         i f j = 1 n w i j x i > θ i , 0                                                       i f j = 1 n w i j x i θ i .
A single neuron achieves self-learning and adaptation by modifying the weight coefficients based on specific learning rules [37]. Various learning rules exist for tuning these coefficients, such as the unsupervised Hebbian learning rule, the supervised Delta learning rule, the supervised Hebbian learning rule, etc. [38]. Learning processes are typically categorized into unsupervised and supervised learning, which are distinguished by introducing or not introducing an expectation value. The generic form of these learning rules is shown below:
Δ w i j t = η × r × x j t ,
where Δ w i j t represents the difference in weights at the moment t ; η is the scale factor or learning constant; r is the learning signal; and x j t is the input signal at the moment t . Then, the weight coefficients at the moment t can be derived:
w i j t = w i j t 1 + η × r × x j t .
For implementing a single-neuron self-adaptive PID controller, the supervised Hebbian learning rule can be utilized, which is the combination of the Hebbian learning rule and the Delta learning rule [38,39].
Hebbian theory suggests that when two neurons are activated simultaneously, their connection strengthens, allowing the cell to remember the association between the two stimuli. Conversely, if the activation of the neurons becomes less synchronized over time, their connection weakens. A significant feature of the unsupervised Hebbian learning rule is that the weighting difference is positively proportional to the product of the input and output, which is expressed as follows:
Δ w i j t = η × x j t × y i t ,
where x j represents the input from the previous neuron to the current neuron, and y i represents the output of the current neuron, which is also the input from the current neuron to the next neuron. The unsupervised Hebbian learning rule has the disadvantage that it cannot weaken the neuronal connections. In response to this issue, supervised learning rules are employed. A supervised learning rule must introduce an expectation value m i during learning. In the supervised delta learning rule, the learning effect can be evaluated using the following error function E :
E = 1 2 m i y i 2 .  
The delta rule is derived by minimizing the error between the neuron’s output and the expectation value through the gradient descent method. The partial derivative of the error concerning the i -th weight by using the chain rule can be written as:
E w i j = E y i y i w i j = m i y i y i w i j .
After replacing y i using Equation (8), the gradient of the function E is derived as follows:
E w i j = m i y i f j w i j w i j   x j .
According to the gradient descent law, the change in each weight should be proportional to the gradient. By removing the negative sign and multiplying by a scale factor η , the weights are moved in the negative direction of the gradient to minimize the error, so the supervised delta learning rule is expressed as follows:
  Δ w i j t = η × x j t × m i y i t .  
From Equation (15), the weight difference in the delta learning rule is proportional to the product of the input and the difference between the output value and the expectation value. Compared to the unsupervised Hebbian learning rule, the delta learning rule can weaken the neuronal connections through negative feedback and correct the weight coefficients to make the output value close to the given expectation.
By incorporating the unsupervised Hebbian learning rule of Equation (11) with the supervised delta learning rule of Equation (15), the supervised Hebbian learning rule is obtained as follows:
Δ w i j t = η × x j t × m i y i t × y i t .
The supervised Hebbian learning rule can strengthen or weaken the connection between two neurons activated simultaneously for a given expectation, which depends on the correlation between the inputs of the respective neurons.
In Section 4.1, the conventional positional PID algorithm is introduced. It has three terms: proportional, integral, and derivative, with the corresponding parameters K p , K i , and K d . To conceptualize the neuronal PID algorithm, consider the PID controller as a single neuron where its three components function as dendrites, and the parameters K p , K i , and K d act as the weighting coefficients of the input signals to these dendrites. The output of the neuronal PID controller represents the axon of the neuron. Hence, the neuron PID algorithm under the supervised Hebbian learning rule is shown as the following formulas:
u k = K j = 1 3 w ´ j k x j k ,
where w ´ j   ( j = 1 ,   2 ,   3 ) denotes the weights of the neuron’s dendrites, which are expressed as follows:
w ´ j k = w j k j = 1 3 w j k .  
According to the supervised Hebbian learning rule given in Equation (16), the weighting coefficients for the three components of the neuronal PID controller are expressed as follows:
w 1 k = w 1 k 1 + η p e k u k x 1 k , w 2 k = w 2 k 1 + η i e k u k x 2 k , w 3 k = w 3 k 1 + η d e k u k x 3 k ,
where K represents the scale learning rate of a single neuron; x 1 k , x 2 k , and x 3 k correspond to the three components of the PID algorithm without the weighting parameters; while η p , η i , and η d signify the learning rates corresponding to the proportional, integral, and derivative components of the neuronal PID, respectively.
According to Equation (7) of the positional PID algorithm, x j   ( j = 1 ,   2 ,   3 ) can be expressed as follows:
x 1 k = e k , x 2 k = j = 0 k e j ,   x 3 k = e k e k 1 .  
Similarly, the three key parameters of the positional PID algorithm can be expressed using the signal neuron PID parameters as follows:
K p = K w ´ 1 k ,   K i = K w ´ 2 k , K d = K w ´ 3 k .
The single-neuron PID controller described above is essentially a variable coefficient proportional–integral–derivative compound controller. Through its own learning process, a corresponding change is made in the control parameters, and therefore, it has strong robustness [39]. In general, the neuronal PID algorithm has more parameters than the conventional PID algorithm, including the neuronal learning rate K , the weighting coefficients for each of the three PID components, and their respective learning rates. Among them, η p , η i , and η d can be selected by the method of the conventionality PID parameters [38]. In addition, the selection of K is very important. If the overshoot is more significant, the scale coefficient K may be decreased; otherwise, it may be increased [37]. In the practical parameter tuning process, the first step is to ensure that the system will stabilize. Then, increasing K can improve the speed at which the system reaches stability. When the system reaches the steady state through self-learning of the single neuron, the relative optimal positional PID parameters for the system have been identified. This process is also known as the single-neuron-based self-pre-optimization process.

4.3. Control Flow Diagram

The PID-based closed-loop control algorithms are implemented on the MCU, effectively realizing a digital PID controller. Figure 6 illustrates the program control flow diagram for the developed closed-loop fluxgate sensor. The program begins with initializing the global variable pid_optim to zero, indicating that the optimal positional PID parameters have not yet been identified. Then, the neuronal PID parameters are initialized first for the subsequent invocation of the single-neuron-based self-pre-optimization algorithm to determine the optimal positional PID parameters. Next, the DAC and ADC modules inside the MCU are sequentially activated, i.e., the input and output ports of the PID controller are enabled. Since the initial pid_optim value is zero, the single-neuron-based self-pre-optimization algorithm is executed, where the PID parameters are continuously modified to minimize the steady-state error of the closed-loop control system, i.e., to make the pid_error converge to zero. Once the pid_error converges to zero, the global variable pid_optim is set to 1, and the optimal PID parameters K p , K i , and K d for the positional PID algorithm are identified. Finally, the digital PID controller consistently applies the positional PID algorithm with the optimal parameters for the closed-loop control of the sensor system.
The advantage of the above closed-loop control is that after each restart, the sensor must first locate the optimal positional PID parameters for the current system using the single-neuron-based self-pre-optimization algorithm. This approach mitigates the risk that the factory-set PID parameters for the positional PID algorithm become suboptimal for the current system due to changes in the sensor system. Furthermore, the single-neuron-based self-learning approach significantly reduces the hardware system’s differentiation requirements, as it dynamically identifies the optimal positional PID parameters based on the unique characteristics of each sensor.

5. Experiment and Analysis

Section 5 presents and analyzes the experimental results, discusses the response limitation problem, and proposes countermeasures.

5.1. Experimental Results

The developed MCU-controlled closed-loop fluxgate current sensor is designed to measure DC current at 0–1 A and 0–10 A, with feedback winding turns of 200 and 500, respectively. The sensor system changes at different range settings, necessitating adjustments to the optimal PID parameters for the closed-loop controller. The process of determining these PID parameters is called the debugging process, which involves the parameter tuning of the single-neuron-based self-pre-optimization algorithm. Four key parameters, K, ηp, ηi, and ηd, are manually adjusted during debugging, while the remaining parameters remain unchanged. The debugging table for the 0–10 A range is presented in Table 2, with the corresponding PID operating curve illustrated in Figure 7.
The PID error rapidly converges to zero on the optimal PID control curve without oscillations or overshoots. This indicates that Result 5 yields the best performance, with its corresponding Kp, Ki, and Kd values representing the optimal PID parameters for the sensor system. In particular, manual debugging can be improved to automatic debugging in future work, i.e., by setting the PID optimization criteria in the program and automatically adjusting the neuronal parameters to compare the PID operating results, thus obtaining the best controller parameters. At present, the neuronal parameters are determined for both the 0–1 A and 0–10 A measuring ranges through the manual debugging process. Once the sensor executes the single-neuron-based self-pre-optimization algorithm, it autonomously determines the optimal PID parameters for the current system. This adaptive approach mitigates the risk of factory-set PID parameters becoming suboptimal due to hardware variations or sensor aging.
In the next phase, the experimental measurements will validate the sensor’s accuracy across both ranges. The states of the sensor are characterized into two phases: the self-learning phase and the measurement phase, as illustrated in Figure 8. In the self-learning phase, the optimal PID parameters are identified by the single-neuron-based self-pre-optimization algorithm, which usually lasts a few seconds. Subsequently, the sensor enters the measurement phase, where the digital positional PID control algorithm is used to achieve the closed-loop control of the sensor.
The microcontroller-controlled closed-loop fluxgate current sensor prototype is tested using a 12 V power supply provided by a Tenma 72-10495 power source. The BD-4D measuring instrument offers a current source with an accuracy of 0.1%. A BZ-10 reference resistor of 0.1 Ω is used to precisely measure the input current. This reference resistor features an accuracy of 0.01% and a maximum measuring current of 10 A. The input current is determined using Ohm’s law by measuring the voltage across the reference resistor. The voltage across the reference resistor and the sensor output voltage, VDAC, are simultaneously measured with two Keithley 2110 digital multimeters, each with a 5.5 digit resolution and a basic DC voltage accuracy of 0.012%. Using a high-precision reference resistor and digital multimeters ensures accurate measurements. The calculated input currents and corresponding sensor output voltages are presented in Table 3 and Table 4. The experimental results indicate that the non-linearity of the developed closed-loop fluxgate sensor is less than 0.1% in the measuring ranges of 0–1 A and 0–10 A.
The voltage V D A C value can be output as a digital signal via the UART communication protocol. In the experiments, closed-loop control algorithms are optimized to maximize the efficiency of PID control, thus increasing the data output rate of the sensors. The experimental results show that the maximum data output rate of the sensor is limited to about 100 samples per second, i.e., the minimal response time that the sensor can achieve is about 10 ms.

5.2. Problem and Countermeasures

During the optimization of the sensor’s data output rate, researchers identified that the limiting factor is not the closed-loop control algorithms, but rather the open-loop measuring circuit of the sensor.
In the closed-loop system, the MCU starts capturing the open-loop output V o p e n and then executes the PID-based closed-loop algorithms to output the control voltage V D A C , which takes a time interval referred to as t p . Then, the voltage V D A C controls the feedback current drive circuit to generate an appropriate feedback current, which acts on an open-loop measuring circuit until the corresponding open-loop output occurs. The time required for this process can be called the control response time t c . A crucial precondition for the proper operation of the PID controller is that the outcome of the previous control cycle has been incorporated into the PID controller’s calculations before initiating the next control cycle. Therefore, the prerequisite for ideal closed-loop control is as follows:
t p t c .
Since data output occurs at each program loop, the response time of the closed-loop sensor is nearly equal to the program’s single run time, i.e., t p . Equation (22) shows that the response time of the closed-loop sensor is limited by the control response time t c . In the developed closed-loop fluxgate current sensor, t c is determined by the response times of both the open-loop sensing circuit and the feedback current drive circuit. The open-loop sensing circuit used in this paper is based on the circuit of the open-loop fluxgate current sensor CYCT03 series, which is developed by ChenYang Technologies GmbH & Co. KG and has a response time of about 120 ms [40]. As a result, the actual effective response time of the developed closed-loop sensor is limited to at least 120 ms, although the minimal response time from the experiments can be 10 ms. To respond to this issue, increasing the response speed of the open-loop measuring circuit is necessary, e.g., by increasing the excitation voltage frequency and increasing the integration speed over the excitation current.

6. Conclusions and Suggested Future Work

This paper presents the development of an intelligent MCU-controlled closed-loop fluxgate current sensor. The closed-loop control leverages the zero-flux principle of fluxgate technology and the PID control theory. To avoid the tedious and difficult parameter tuning process when using analog PID circuits, the digital PID algorithms are programmed on an MCU. More importantly, this paper proposes a single-neuron-based self-pre-optimization algorithm for identifying the optimal PID parameters of the sensor system efficiently and intelligently. During this parameter optimization process, the single-neuron PID controller utilizes a supervised Hebbian learning rule with an expected value to automatically modify the positional PID parameters until the closed-loop system reaches a steady state, i.e., the error of the PID controller converges to zero. After determining the optimal PID parameters, the sensor utilizes the digital positional PID algorithm for continuous closed-loop control and measures the current, unless the sensor is powered off and restarted. At each restart, the sensor starts with a self-learning phase to locate the sensor system’s relative optimal positional PID parameters before the measurement phase. This approach mitigates the risk of factory-set PID parameters becoming unfit over time, as each sensor can self-optimize its positional PID parameters after a reboot.
The experimental results demonstrate that the developed sensor can measure DC in the range of 0–1 A and 0–10 A with a high non-linearity of 0.1%. However, to improve the sensor’s response time, the open-loop measuring circuit must be optimized to increase its response speed. Future research will focus on optimizing the response time of the MCU-controlled closed-loop fluxgate current sensor and expanding its measuring range.

Author Contributions

Conceptualization, J.L.; methodology, Q.S. and J.L.; software, Q.S.; validation, Q.S.; formal analysis, Q.S. and J.L.; investigation, Q.S.; resources, Q.S. and J.L.; data curation, Q.S.; writing—original draft preparation, Q.S.; writing—review and editing, J.L.; visualization, J.L., S.K. and M.L.H.; supervision, J.L., S.K. and M.L.H.; project administration, J.L. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

Restrictions apply to the availability of these data. Data were obtained from ChenYang Technologies GmbH & Co. KG and are available from J.L. with the permission of ChenYang Technologies GmbH & Co. KG.

Conflicts of Interest

Author Qiankun Song is employed by ChenYang Technologies GmbH & Co. KG and also a PhD student at the Technical University of Munich. Author Jigou Liu is the managing director of Chen Yang Technologies GmbH & Co.KG. The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
ACAlternating Current
ADCAnalog-to-Digital Converter
DACDigital-to-Analog Converter
DCDirect Current
FSFull Scale
MCUMicrocontroller
PIDProportional Integral Derivative
UARTUniversal Asynchronous Receiver Transmitter

References

  1. Yang, X.; Li, Y.; Zheng, W.; Guo, W.; Wang, Y.; Yan, R. Design and realization of a novel compact fluxgate current sensor. IEEE Trans. Magn. 2015, 51, 4002804. [Google Scholar]
  2. Yang, X.; Li, Y.; Guo, W.; Zheng, W.; Xie, C.; Yu, H. A new compact fluxgate current sensor for AC and DC application. IEEE Trans. Magn. 2014, 50, 4005704. [Google Scholar]
  3. Shen, X.; Teng, Y.; Hu, X. Design of a low-cost small-size fluxgate sensor. Sensors 2021, 21, 6598. [Google Scholar] [CrossRef] [PubMed]
  4. Ripka, P. Advances in fluxgate sensors. Sens. Actuators A Phys. 2003, 106, 8–14. [Google Scholar]
  5. Wei, S.; Liao, X.; Zhang, H.; Pang, J.; Zhou, Y. Recent progress of fluxgate magnetic sensors: Basic research and application. Sensors 2021, 21, 1500. [Google Scholar] [CrossRef]
  6. Ziegler, S.; Woodward, R.C.; Iu, H.H.-C.; Borle, L.J. Current sensing techniques: A review. IEEE Sens. J. 2009, 9, 354–376. [Google Scholar]
  7. Ripka, P. Review of fluxgate sensors. Sens. Actuators A Phys. 1992, 33, 129–141. [Google Scholar]
  8. Weiss, R.; Itzke, A.; ReitenspieB, J.; Hoffmann, I.; Weigel, R. A novel closed loop current sensor based on a circular array of magnetic field sensors. IEEE Sens. J. 2018, 19, 2517–2524. [Google Scholar]
  9. Ripka, P. Current sensors using magnetic materials. J. Optoelectron. Adv. Mater. 2004, 6, 587–592. [Google Scholar]
  10. Ripka, P. New directions in fluxgate sensors. J. Magn. Magn. Mater. 2000, 215, 735–739. [Google Scholar]
  11. Wang, S.; Lu, C.; Song, L.; Chen, Y.; Fu, Z.; Liu, F.; Huang, H. Research on characteristics of a high precision current sensor. In Proceedings of the 2022 23rd International Conference on Electronic Packaging Technology (ICEPT), Dalian, China, 10–13 August 2022; pp. 1–4. [Google Scholar]
  12. Kaluza, F.; Grüger, A.; Grüger, H. New and future applications of fluxgate sensors. Sens. Actuators A Phys. 2003, 106, 48–51. [Google Scholar] [CrossRef]
  13. Schrittwieser, L.; Mauerer, M.; Bortis, D.; Ortiz, G.; Kolar, J.W. Novel principle for flux sensing in the application of a DC+ AC current sensor. IEEE Trans. Ind. Appl. 2015, 51, 4100–4110. [Google Scholar] [CrossRef]
  14. Schrittwieser, L.; Mauerer, M.; Bortis, D.; Ortiz, G.; Kolar, J.W. Novel principle for flux sensing in the application of a DC+ AC current sensor. In Proceedings of the 2014 International Power Electronics Conference (IPEC-Hiroshima 2014—ECCE ASIA), Hiroshima, Japan, 18–21 May 2014; pp. 1291–1298. [Google Scholar] [CrossRef]
  15. Shede, P.; Mane, S. Leakage current sensing techniques. In Proceedings of the 2017 Third International Conference on Sensing, Signal Processing and Security (ICSSS), Chennai, India, 4–5 May 2017; pp. 181–185. [Google Scholar]
  16. Topal, U.; Can, H.; Çelik, O.M.; Narman, A.; Kamiş, M.; Çıtak, V.; Çakrak, D.; Sözeri, H.; Svec, P. Design of fluxgate sensors for different applications from geology to medicine. J. Supercond. Nov. Magn. 2019, 32, 839–844. [Google Scholar] [CrossRef]
  17. Djamal, M.; Sanjaya, E. Development of fluxgate sensors and its applications. In Proceedings of the 2011 2nd International Conference on Instrumentation, Communications, Information Technology, and Biomedical Engineering, Bandung, Indonesia, 8–9 November 2011; pp. 421–426. [Google Scholar]
  18. Topal, U.; Švec, P.; Can, H.; Celik, F.; Birlikseven, C.; Skorvanek, I.; Andrejka, F.; Kunca, B.; Marcin, J.; Janotova, I.; et al. Optimization of the temperature stability of fluxgate sensors for space applications. IEEE Sens. J. 2020, 21, 2749–2756. [Google Scholar] [CrossRef]
  19. Azzoni, D.; Teppan, W.; Carpita, M. Battery monitoring current sensors: The fluxgate concept. In Proceedings of the 2009 13th European Conference on Power Electronics and Applications, Barcelona, Spain, 8–10 September 2009; pp. 1–10. [Google Scholar]
  20. Wang, N.; Zhang, Z.; Li, Z.; He, Q.; Lin, F.; Lu, Y. Design and Characterization of a Low-Cost Self-Oscillating Fluxgate Transducer for Precision Measurement of High-Current. IEEE Sens. J. 2016, 16, 2971–2981. [Google Scholar] [CrossRef]
  21. Yang, X.; Guo, W.; Li, C.; Zhu, B.; Chen, T.; Ge, W. Design optimization of a fluxgate current sensor with low interference. IEEE Trans. Appl. Supercond. 2016, 26, 1–5. [Google Scholar] [CrossRef]
  22. Zhou, L.; Zhu, L.; Pan, Y. Research progress in fluxgate current sensors for precise measurement. In Proceedings of the IET Conference Proceedings CP884, Shenzhen, China, 14–16 August 2024; The Institution of Engineering and Technology: Stevenage, UK, 2024; Volume 2024, pp. 92–98. [Google Scholar]
  23. Gao, W.; Wang, G.; Zhao, Q. Design and realization of fluxgate sensor signal processing unit. In Proceedings of the 2011 IEEE International Conference on Mechatronics and Automation, Beijing, China, 7–10 August 2011; pp. 2386–2391. [Google Scholar] [CrossRef]
  24. Angelopoulos, S.; Priftis, P.; Anastasopoulos, A.; Ktena, A.; Hristoforou, E. Design and development of a high-sensitivity, portable, and low-cost fluxgate magnetometer. IEEE Trans. Magn. 2022, 59, 1–8. [Google Scholar] [CrossRef]
  25. Borase, R.P.; Maghade, D.K.; Sondkar, S.Y.; Pawar, S.N. A review of PID control, tuning methods and applications. Int. J. Dyn. Control 2021, 9, 818–827. [Google Scholar] [CrossRef]
  26. Wu, H.; Su, W.; Liu, Z. PID controllers: Design and tuning methods. In Proceedings of the 2014 9th IEEE Conference on Industrial Electronics And Applications, Hangzhou, China, 9–11 June 2014; pp. 808–813. [Google Scholar]
  27. De Prada, C. PID Controllers and Tuning; Department Systems Engineering and Automatic Control, University of Valladolid: Spain. Available online: https://www.eii.uva.es/~prada/PidUK.pdf (accessed on 14 February 2025).
  28. Cay, Y.; Demirok, E.; Keysan, O. Modeling and Simulation of Fluxgate based Current Sensor. In Proceedings of the PCIM Europe 2024, International Exhibition and Conference for Power Electronics, Intelligent Motion, Renewable Energy and Energy Management, Nürnberg, Germany, 11–13 June 2024; pp. 3242–3250. [Google Scholar]
  29. Ponjavic, M.M.; Duric, R.M. Nonlinear modeling of the self-oscillating fluxgate current sensor. IEEE Sens. J. 2007, 7, 1546–1553. [Google Scholar] [CrossRef]
  30. Li, J.; Ren, W.; Luo, Y.; Zhang, X.; Liu, X.; Zhang, X. Design of Fluxgate Current Sensor Based on Magnetization Residence Times and Neural Networks. Sensors 2024, 24, 3752. [Google Scholar] [CrossRef]
  31. Çoker, E.G.; Can, H.; Selvi, S.; Svec, P.; Topal, U. Design of a DC current sensor based on fluxgate principle. In AIP Conference Proceedings; AIP Publishing: Melville, NY, USA, 2019; Volume 2131. [Google Scholar]
  32. Velasco-Quesada, G.; Román-Lumbreras, M.; Conesa-Roca, A.; Jeréz, F. Design of a low-consumption fluxgate transducer for high-current measurement applications. IEEE Sens. J. 2010, 11, 280–287. [Google Scholar]
  33. Kudo, T.; Kuribara, S.; Takahashi, Y. Wide-range ac/dc earth leakage current sensor using fluxgate with self-excitation system. In Proceedings of the SENSORS, Limerick, Ireland, 28–31 October 2011; pp. 512–515. [Google Scholar]
  34. Youney, J. A Comparison and Evaluation of Common PID Tuning Methods. Electronic Theses and Dissertations, University of Central Florida, Orlando, FL, USA, 2007. [Google Scholar]
  35. Li, Z. Review of PID control design and tuning methods. J. Phys. Conf. Ser. 2023, 2649, 012009. [Google Scholar] [CrossRef]
  36. Bharat, S.; Ganguly, A.; Chatterjee, R.; Basak, B.; Sheet, D.K.; Ganguly, A. A review on tuning methods for PID controller. Asian J. Converg. Technol. (AJCT), 2019; V, ISSN 2350-1146. [Google Scholar]
  37. Wang, M.; Cheng, G.; Kong, X. A single neuron self-adaptive PID controller of brushless DC motor. In Proceedings of the 2011 Third International Conference on Measuring Technology and Mechatronics Automation, Shanghai, China, 6–7 January 2011; pp. 262–266. [Google Scholar]
  38. Lin, H.; Changlin, M.; Feng, L. Study of adaptive PID controller based on single neuron and genetic optimization. In Proceedings of the 2007 8th International Conference on Electronic Measurement and Instruments, Xi’an, China, 16–18 August 2007; pp. 240–243. [Google Scholar]
  39. Yu, L.; Lim, J.G.; Fei, S. An improved single neuron self-adaptive PID control scheme of superheated steam temperature control system. Int. J. Syst. Control Inf. Process. 2017, 2, 1–13. [Google Scholar]
  40. Liu, J.; DC Current Sensor CYCT03-xnWS3. Released in January 2024. Available online: https://www.chenyang-gmbh.com/media/pdf/33/ec/73/CYCT03-xnWS3.pdf (accessed on 14 February 2025).
Figure 1. A simple fluxgate sensor prototype.
Figure 1. A simple fluxgate sensor prototype.
Signals 06 00014 g001
Figure 2. Zero-flux principle for the fluxgate current sensor.
Figure 2. Zero-flux principle for the fluxgate current sensor.
Signals 06 00014 g002
Figure 3. Block diagram of an MCU-controlled closed-loop fluxgate current sensor.
Figure 3. Block diagram of an MCU-controlled closed-loop fluxgate current sensor.
Signals 06 00014 g003
Figure 4. Block diagram of a PID-controlled closed-loop fluxgate current sensor.
Figure 4. Block diagram of a PID-controlled closed-loop fluxgate current sensor.
Signals 06 00014 g004
Figure 5. Block diagram of a typical single-neuron model in machine learning.
Figure 5. Block diagram of a typical single-neuron model in machine learning.
Signals 06 00014 g005
Figure 6. Flow diagram for the MCU-controlled closed-loop fluxgate sensor.
Figure 6. Flow diagram for the MCU-controlled closed-loop fluxgate sensor.
Signals 06 00014 g006
Figure 7. PID operation curves for different debugging results.
Figure 7. PID operation curves for different debugging results.
Signals 06 00014 g007
Figure 8. Closed-loop control graph of current sensor: phase 1: self-learning phase, and phase 2: measurement phase.
Figure 8. Closed-loop control graph of current sensor: phase 1: self-learning phase, and phase 2: measurement phase.
Signals 06 00014 g008
Table 1. A comparison of four PID tuning methods.
Table 1. A comparison of four PID tuning methods.
Method TypeComplexityPrecisionEffortAdaptability
Trial and ErrorLowLowHighLow
Experiment-BasedModerateHighModerateModerate
Model-BasedHighHighHighLow
Automatic TuningModerateHighModerateHigh
Table 2. Debugging table for important neuronal PID parameters.
Table 2. Debugging table for important neuronal PID parameters.
ResultParameterizationPID Parameter
Result 1K = 1.0, ηp = 0.8, ηi = 0.20, ηd = 0.1Kp = 0.6336, Ki = 0.3649, Kd = 0.0015
Result 2K = 0.8, ηp = 0.8, ηi = 0.03, ηd = 0.1Kp = 0.6747, Ki = 0.1212, Kd = 0.0041
Result 3K = 0.5, ηp = 0.5, ηi = 0.10, ηd = 0.1Kp = 0.3566, Ki = 0.1413, Kd = 0.0020
Result 4K = 0.1, ηp = 0.8, ηi = 0.10, ηd = 0.1Kp = 0.0712, Ki = 0.0263, Kd = 0.0024
Result 5K = 0.1, ηp = 0.8, ηi = 0.08, ηd = 0.1Kp = 0.0737, Ki = 0.0239, Kd = 0.0024
Result 6K = 0.1, ηp = 0.8, ηi = 0.02, ηd = 0.1Kp = 0.0873, Ki = 0.0114, Kd = 0.0012
Table 3. Measuring results under the input DC current range of 0–1 A.
Table 3. Measuring results under the input DC current range of 0–1 A.
Input (A)VDAC (V)Theor. Value (V)Diff (V)Non-Linearity
0.0010.00086491.8965 × 10−5−0.000845935−0.03%
0.1970.63691420.6379921050.0010779050.03%
0.3941.2804481.27922021−0.00122779−0.04%
0.5921.9217071.923703280.001996280.06%
0.7892.565332.564931385−0.000398615−0.01%
0.9873.2100183.209414455−0.000603545−0.02%
Table 4. Measuring results under the input DC current range of 0–10 A.
Table 4. Measuring results under the input DC current range of 0–10 A.
Input (A)VDAC (V)Theor. Value (V)Diff (V)Non-Linearity
0.0120.000337760.0023679130.0020301530.06%
1.980.63652350.634203051−0.002320449−0.07%
3.9661.2732391.271817169−0.001421831−0.04%
5.9611.910071.9123207770.0022507770.07%
7.9382.548122.547045405−0.001074595−0.03%
9.9313.1863713.1869069040.0005359040.02%
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Song, Q.; Liu, J.; Heldwein, M.L.; Klaß, S. Intelligent Closed-Loop Fluxgate Current Sensor Using Digital Proportional–Integral–Derivative Control with Single-Neuron Pre-Optimization. Signals 2025, 6, 14. https://doi.org/10.3390/signals6020014

AMA Style

Song Q, Liu J, Heldwein ML, Klaß S. Intelligent Closed-Loop Fluxgate Current Sensor Using Digital Proportional–Integral–Derivative Control with Single-Neuron Pre-Optimization. Signals. 2025; 6(2):14. https://doi.org/10.3390/signals6020014

Chicago/Turabian Style

Song, Qiankun, Jigou Liu, Marcelo Lobo Heldwein, and Stefan Klaß. 2025. "Intelligent Closed-Loop Fluxgate Current Sensor Using Digital Proportional–Integral–Derivative Control with Single-Neuron Pre-Optimization" Signals 6, no. 2: 14. https://doi.org/10.3390/signals6020014

APA Style

Song, Q., Liu, J., Heldwein, M. L., & Klaß, S. (2025). Intelligent Closed-Loop Fluxgate Current Sensor Using Digital Proportional–Integral–Derivative Control with Single-Neuron Pre-Optimization. Signals, 6(2), 14. https://doi.org/10.3390/signals6020014

Article Metrics

Back to TopTop