2.1. Operational Principle of Proposed Electromagnetic Flowmeter
Faraday’s law of electromagnetic induction points out that when a conductor moves in the direction of cutting the magnetic field line in the magnetic field, there will be induced electromotive force in the closed circuit where the conductor is located; its magnitude is proportional to the change rate of loop magnetic flux, which can be expressed as [
10]:
Here
is the magnitude of the induced electromotive force, measured in V, and
is the magnetic flux passing through the closed loop, measured in Wb. The parameter
is the scale factor, dimensionless, determined by the experiment, and a negative sign indicates the direction of the induced electromotive force. If the direction of the induced electromotive force in Equation (1) is not considered, the above equation can be expressed as [
10]:
Here is the magnetic flux intensity, measured in T, and is the effective length of the conductor cutting magnetic induction line, measured in m. The parameter is the velocity of the conductor orthogonal to the direction of the magnetic inductance line, measured in m/s.
According to the basic structure of the electromagnetic flowmeter, when the measured liquid moves to cut the magnetic induction line in the magnetic field, a moving liquid surface is equivalent to a moving conductor. At this time, the induced electromotive force will be also generated. The induced electromotive force generated between the two detection electrodes can be expressed as [
1]:
Here is the induced electromotive force at both ends of the detection electrode, measured in V, and is a constant and its value is determined by experiment. The parameter is the magnetic flux intensity in the axial direction of the vertical measuring pipe, measured in T; the parameter is the diameter of the measuring pipe, measured in m; the parameter is the average flow velocity of the measured fluid, measured in m/s.
According to the calculation formula of the instantaneous flow [
10]:
Combined with Equation (3), Equation (4) can be expressed as:
To sum up, when the measured pipe diameter and magnetic flux intensity are determined, it can be concluded from Equation (3) that the induced electromotive force is linear with the average velocity of the measured fluid. At the same time, it can be seen from Equation (5) that the instantaneous flow is linear with the induced electromotive force between the detection electrodes a and b. Therefore, the instantaneous flow measured by the electromagnetic flowmeter is only related to the average velocity of the measured fluid and is not affected by other factors.
Equation (5) is only an ideal mathematical model of the working principle of the electromagnetic flowmeter. To make the above relationship hold, the following basic conditions must be met [
3]:
Firstly, the measuring pipe must be filled with conductive liquid, so that the length of the cutting magnetic induction line can be replaced by the pipe diameter length. Then Equation (3) is valid.
Secondly, the conductivity of the measured fluid must be uniform. Otherwise, it will affect the solution of the basic differential equation of the electromagnetic flowmeter. At the same time, if the fluid conductivity distribution is uneven, the eddy current effect will also occur under the action of the uniform magnetic field, interfering with the characteristic signal and affecting the measurement accuracy.
Thirdly, the magnetic field loaded on the measured pipe diameter must be uniform, otherwise the solution of Equation (3) will become more complex.
Finally, sufficient straight pipes should be ensured before and after the sensor installation position to make the flow pattern distribution in the pipe in the measurement area axisymmetric.
2.2. Design of Sensor
The main components of electromagnetic flow sensors include excitation coils, electrodes, liners, and sensor shells. In order to ensure that the electromagnetic flow sensor works stably and reliably, and can accurately sense the flow signal, the sensor must be able to output a sufficiently large potential signal proportional to the flow, have a sufficiently large signal-to-noise ratio, and be able to work stably in harsh environments.
2.2.1. Design of Magnetic Circuit System
The magnetic circuit system mainly includes an excitation coil and an iron core to generate a specified excitation magnetic field. Generally, the magnetic field of an electromagnetic flowmeter is generated by an electromagnet, and the excitation current of the magnetic field is provided by a converter. The magnetic circuit structure mainly includes the transformer iron core type: concentrated winding yoke type and grouped winding yoke type. The magnetic circuit designed in this paper adopts the transformer core type. In this way, the magnetic flux through the measuring tube is large, and the large induced electromotive force can be obtained at the same velocity of flow.
According to the relationship between the induced electromotive force at both ends of the detection electrode and the flow rate and magnetic field:
Here is the induced electromotive force, measured in V, and the parameter is the magnetic induction intensity, measured in T. The parameter is the average speed, measured in m/s, and the parameter is the diameter of the measuring pipe, measured in m.
According to Equation (7), we can obtain:
Similar to Ohm’s law in the circuit, the magnetic circuit includes [
10]:
Here
is the magnetomotive force, measured in A, and
represents the magnetic flux, measured in Wb. Here
is the magnetic resistance of the magnetic circuit, measured in
. Similar to the definition of resistance, the magnitude of magnetoresistance is related to the length
of the magnetic circuit, the area
of magnetic circuit, and the magnetic permeability
of the medium. At the same time, the relationship between magnetic flux, magnetic induction intensity, and magnetic flux area can be obtained:
In order to make the calculated value closer to the requirements, the magnetic leakage coefficient
is introduced in the calculation process:
According to the relationship between the effective exciting voltage
and the magnetic field [
2]:
Here
is the total number of turns of the coil and
is the maximum value of magnetic flux. The parameter
represents exciting frequency, measured in Hz. Therefore, the total number of turns of the coil can be expressed as:
Here
represents the coil turn coefficient of correction, which is generally about 0.65, and
is the cross-sectional area of the magnetic circuit. Therefore, the expression of the number of turns of the coil can be obtained as:
Furthermore, according to the relationship between the excitation current and the magnetomotive force, the excitation current can be obtained:
At the same time, in order to ensure the good heat dissipation performance of the excitation coil, the current passing through per unit area and the size of the excitation coil wire diameter must meet the following inequality:
Here is the current density, measured in , and is the diameter of the traverse, measured in m.
In engineering practice, in order to simplify the complexity of calculation, iron loss and copper loss are often not considered, and the length of the magnetic circuit of the sensor is approximately equivalent to the length of the gap between the coils, and the area of the magnetic circuit is equivalent to the projected area of the excitation coil on the plane of the detection electrode. At the same time, the permeability in the magnetic circuit is approximately equivalent to the magnetic permeability in vacuum .
2.2.2. Design of Detection Electrode
As shown in
Figure 1, the detection electrode inside the electromagnetic flowmeter is located on the inner wall of the pipeline and is in contact with the fluid. When the liquid flows through the electrodes, the induced electromotive force will generate a voltage signal between the electrodes. By measuring the magnitude of the voltage signal, the velocity of the fluid can be calculated to realize the flow measurement.
In this paper, stainless steel material is used as the preparation material of the sensor electrode. Stainless steel is widely used in the field of electrode preparation, and its scope of application covers a variety of fluid and environmental conditions. Stainless steel has excellent corrosion resistance to many chemicals, so it is very suitable for liquid flow measurement tasks. In addition, the stainless electrode has outstanding mechanical strength, which is enough to withstand certain stress and pressure, enhancing its reliability under various working conditions.
The structural diagram of the sensor designed in this paper is shown in
Figure 1. It consists of a magnetic circuit system composed of an iron core and an excitation coil. When the excitation current is applied, a uniform magnetic field will be generated, thus ensuring that the corresponding induced electromotive force can be obtained on the electrode.
2.3. Design of Hardware Circuit
The hardware circuit of the electromagnetic flowmeter is the supporting platform for the realization of the functions of the whole system. The system design uses SEM32F407ZET6 MCU as the core controller, and all functions of the instrument are realized by the MCU and its peripheral circuits. The MCU controls the ZXMH3A01N8 to generate the excitation signal, which is applied to the excitation coil of the sensor to produce a stable and alternating magnetic field. The analog signal generated by the sensor undergoes amplification and is then routed to the high-precision A/D converter AD7193. The digital signal obtained after A/D conversion is processed by the MCU to calculate instantaneous flow velocity, flow rate, and cumulative flow, which are subsequently displayed in real time on an LCD screen. Parameter configuration can be achieved through keyboard input. Furthermore, the system is equipped with the capability to retain parameters and computed data after power loss.
Figure 2 shows the overall hardware module diagram of the system. The hardware circuit of the system mainly includes a signal conditioning module, power supply and low voltage detection module, A/D sampling module, keyboard and display module, excitation circuit module, and data storage module.
The functions of each module are as follows:
(a) Signal conditioning module: the weak voltage signal output by the electromagnetic flow sensor is amplified, the interference signal unrelated to the measured signal is filtered out, and the useful signal is extracted to provide the amplified voltage analog quantity for the A/D converter.
(b) Power supply and low voltage monitoring module: real-time monitoring of the power supply voltage of the system. When the system voltage is lower than the specified low limit voltage value, the power monitoring module sends an interrupt request to implement power-down protection. That is, before the voltage drops to the working voltage, the important parameters of the system are saved in the memory chip.
(c) A/D sampling module: convert the analog voltage signal processed by the signal amplification processing module into a digital signal and send it to the MCU for processing.
(d) Keyboard and display module: users can set the operating parameters of the instrument using a keyboard, and can also view information such as instantaneous flow rate and velocity of flow on the LCD screen.
(e) Excitation circuit module: it receives the excitation signal from the MCU, amplifies the excitation signal for power, and provides an exciting current to the exciting coil.
(f) Data storage module: stores the configuration parameters and cumulative flow values during the normal operation of the system.
(g) Pulse output module: the pulse output module can output frequency or pulse. The pulse output mode is mainly used for metrological verification. Each pulse output by the MCU represents an equivalent volume of fluid flowing through the measurement pipeline. The frequency output mode is mainly used for control applications, and the output frequency corresponds to the percentage of flow.
(h) Electromagnetic flow sensor: it converts the velocity of the flow signal of the measured fluid into the corresponding electrical signal according to a certain linear function relationship.
2.3.1. Design of Exciting Circuit
The excitation circuit of the electromagnetic flowmeter is the most important part of the system, which is related to the conversion accuracy of the sensor, and also the largest part of the system’s power consumption. Using reasonable excitation technology can not only reduce the power consumption of the system but also improve the measurement accuracy of the system.
In this paper, the electromagnetic flowmeter uses the three-level low-frequency rectangular wave excitation mode to generate the excitation signal
. As shown in
Figure 3, the excitation is carried out in the intermittent sleep mode with the three values of
, 0, and
. The sampling period of the electromagnetic flowmeter designed in this paper is
, which can be adjusted within 1 s and 15 s according to the different requirements of measurement accuracy and power consumption. When low power consumption is needed,
can be set to a larger value, and the measurement accuracy is slightly lower than that of a small
, but it meets the accuracy requirements of the electromagnetic flowmeter.
The sampling period is divided into two stages: the excitation stage and dormant stage. During the dormant stage, all other modules except the low-frequency clock of the MCU are closed to reduce the quiescent current and reduce the power consumption of the system. During the excitation stage, the excitation period is set to 160 ms, and the frequency is 6.25 Hz, which is 1/6 of the industrial frequency, which can effectively eliminate the zero-point noise of the flow signal and improve the stability of the zero point of the instrument.
The excitation module determines the magnetic field of the sensor, which is a very important part, related to the stability and transformation accuracy of the magnetic field. The excitation module is essentially an H-bridge circuit driven by a constant current source. In order to reduce the size of the microchip, reduce the power consumption of the system, and improve reliability, this paper uses the integrated bridge chip ZXMHC3A01N8 to design the excitation circuit of the electromagnetic flowmeter, avoiding the use of discrete components to design the excitation circuit, reducing the cost, and improving the reliability of the system.
ZXMHC3A01N8 contains two pairs of complementary N-channel MOSFET and P-channel MOSFET. The high and low levels of the signals loaded on P1G-N2G or P2G-N2G control the on and off of the field-effect transistors, thereby generating an alternating magnetic field in the excitation coil. As shown in
Figure 4, the operational amplifier, field-effect transistor Q5, and resistor
constitute the constant current source circuit of the system. When P1G-N2G is on, P2G-N1G is off, and the excitation current flows from the power supply E1 in the direction I through the excitation coil, field-effect transistor, and resistor
. When P2G-N1G is on, P1G-N2G is off at this time, and the excitation current flows from the power supply
in the II direction through the excitation coil, field-effect transistor Q5, and resistor
. The magnitude of the current
flowing through the excitation coil is determined by the voltage of power supply
and resistance
(
). Since the excitation frequency of this design is controlled by the MCU, it has good adjustability. According to the different fluids being measured, different excitation frequencies can be selected for users to flexibly change.
The authors of this paper selected LMR51420 as the driving power supply of the H-bridge. The circuit is shown in
Figure 5. The
pin in the figure is connected to a 15 V power supply. The output voltage
is connected to the driving pin of ZXMHC3A01N8 to provide the driving current for it. The enable terminal EN is also connected to the 15 V power supply to keep the LMR51420 working.
2.3.2. Design of Core Controller Circuit
In this paper, the electromagnetic flowmeter uses STM32F407ZET6 as the core controller. The STM32F407ZET6 is a powerful microcontroller with high performance, rich peripherals, and flexibility, suitable for a variety of embedded systems and applications, including instrumentation, industrial control, automation, communications, and embedded computing. Multiple low-power consumption modes, ultra-high main frequency, powerful computing power, and rich hardware resources are the main reasons for choosing this model of MCU for this design.
In order to improve accuracy, a 25 MHz external clock is used. In order to filter out the impact of external interference noise and interference noise introduced by the power supply on the microcontroller, a decoupling capacitor is designed between the power supply and the ground of the microcontroller. On the one hand, it functions as an energy storage capacitor to provide and absorb the opening and closing moments of the integrated circuit. The charging and discharging energy, on the other hand, is to filter out the high-frequency noise of the device.
2.3.3. Design of Signal Processing and Sampling Circuit
The signal processing sampling circuit is the hub between the electromagnetic flow sensor and the MCU. Its function is to amplify and filter the induced electromotive force generated by the electromagnetic flow sensor, and then send it to the ADC for conversion. The converted digital signal is sent to the MCU for further processing. The flow chart of signal processing and sampling is shown in
Figure 6.
The electromagnetic flow sensor outputs a weak alternating signal (microvolt level), and the internal impedance of the signal is high. The amplitude of the noise signal is much larger than the measured signal, so the signal generated by the sensor needs to be amplified, and the magnification is controllable by the MCU. An integrating circuit is designed to compensate for the DC offset feedback in the signal. In order to filter out noise and interference signals, it is necessary to design a high-quality filter circuit to filter out noise and interference signals in order to meet the accuracy requirements of the instrument.
As shown in
Figure 7, the induced electromotive force output by the electromagnetic flow sensor first passes through a filtering circuit composed of an RC to filter out the noise interference signals. Then, a high common-mode rejection ratio amplification circuit composed of an adjustable gain and differential input AD8220 instrument amplifier is used to amplify the signal, thereby suppressing the interference signal.
As shown in
Figure 8, a high-performance and low-power TL071H operational amplifier is used to form an integral feedback circuit, which can provide DC offset feedback compensation for the above output signal.
The flow signal output by the electromagnetic flow sensor is amplified by the instrument amplifier, and must be filtered, amplified, and rectified to effectively improve the SNR of the flow signal, laying the foundation for establishing the relationship between the flow signal and the flow rate. As shown in
Figure 9, a low-noise TL072 operational amplifier and RC low-pass filter are used to form an amplification and filtering circuit to amplify and filter the above signal.
Since there is a linear relationship between the flow rate and the voltage signal output by the sensor, the signals corresponding to different flow rates require different amplification factors. For this purpose, the signal needs to go through an adjustable gain amplification circuit after being amplified and filtered by the previous stage. As shown in
Figure 10, a low-noise TL072 operational amplifier and resistors with different resistance values are used to form a six-level adjustable gain circuit. The gain of the amplifier circuit is changed according to the amplitude of the input signal, and the gain is adjustable through the MCU.
The signal output by the sensor is amplified and filtered before being sent to the A/D converter. As shown in
Figure 11, this design adopts a high-precision analog-to-digital converter AD7912 with a resolution of up to 24 bits, which is suitable for high-precision measurement and has low noise.
2.3.4. Design of Empty Pipe Detection Circuit
When using an electromagnetic flowmeter, it is necessary to ensure that the measuring pipeline of the electromagnetic flowmeter is filled with the measured liquid. This is because when the measuring pipeline is not full, the data detected by the sensor cannot accurately reflect the flow rate of the measured fluid. If the electrodes inside the measuring pipe are completely exposed to the air, the sensor will generate a significant interference signal, causing significant oscillation in the output signal, seriously affecting the normal use of the electromagnetic flowmeter. In practical measurement, it is difficult to ensure that the pipeline is always filled with liquid, so real-time detection of empty pipe status and providing warnings are crucial for the signal processing of electromagnetic flowmeters. The empty pipe detection circuit designed for this system is shown in
Figure 12, which uses the NE555 timer chip and is configured as a monostable mode. When the liquid level in the pipeline falls below or exceeds the threshold, the input state of the circuit will change, triggering the monostable state of the NE555 timer. The NE555 starts charging the capacitor until it reaches the threshold voltage. Once the capacitor is charged to the threshold voltage, the output state of NE555 will change and trigger the connection operation. When the tested pipeline is not empty, the timer cannot be triggered to work, and the timer output is at a low level. When the measured pipeline is an empty pipeline, the input signal pulse of the sensor continuously triggers the timer, and the output signal of the timer is always at a high level. Therefore, as long as the MCU detects the output signal of the timer, it can determine whether it is an empty pipe.