Introduction
Aiming at the characteristics of power frequency interference, this paper uses the adaptive coherent template method proposed in reference 1. This is an extremely simple and effective algorithm for filtering out power frequency interference, which is very conducive to the rapid implementation of single-chip microcomputers. When the sampling rate is not too high, it can achieve real-time filtering. The reason why this algorithm is conducive to the rapid implementation of single-chip microcomputers is that the algorithm itself is mostly addition and subtraction operations, and does not involve multiplication operations. In addition, by reasonably selecting the M value, the division operation can be cleverly simplified to a shift operation or simply directly discarding the low-order bytes [2].
1 Adaptive coherent template method
1.1 Principle of filtering out power frequency interference
The adaptive coherent template method proposed in reference 1 is based on the characteristics of power frequency interference. It obtains the template of power frequency interference from the original signal, and then subtracts the template from the original signal to achieve the purpose of filtering out power frequency interference.
Assume that X(n) is the original signal, S(n) is the useful signal, and N(n) is the power frequency interference signal, then
X(n) = S(n) + N(n)
defines the template signal as
In the formula, fs is the sampling frequency of the signal, and fg is the frequency of the power frequency interference (50 Hz). In the adaptive template method, fs is required to be an integer multiple of fg, that is, fs=k·50Hz (k is a positive integer).
Since N(n) is a periodic signal, if S(n) is a zero-mean signal, when M is large enough, there is
Therefore, the purpose of filtering out power frequency interference can be achieved by subtracting the template signal from the original input signal, that is,
Taking Z transform on both ends of equation (1), the transfer function of the system can be obtained as
1.2 Amplitude-frequency response characteristics
According to the system transfer function (2), the amplitude-frequency response characteristics of different sampling frequencies and different M values are compared using MATLAB language, as shown in Figure 1. [page]
From Group A of Figure 1, it can be seen that the filter has a filtering effect not only on 50 Hz, but also on all signals with frequencies that are integer multiples of 50 Hz. Therefore, if the adaptive coherent template method is used to filter out power frequency interference, when the useful signal frequency band range is wide and the signal sampling rate is high, it will have a good suppression effect on the power frequency interference 50 Hz and its harmonic signals.
Therefore, not only is the sampling rate required to be an integer multiple of 50 Hz, but also the highest frequency component of the useful signal is required not to exceed 100 Hz, otherwise, the useful signal with a frequency of 100 Hz will be filtered out like the power frequency interference. In this way, the filtered signal will be distorted.
As can be seen from Group B of Figure 1, the amplitude-frequency characteristics of the filter are greatly affected by the M value. When the M value is large, the ripple coefficient of the passband is small and the stopband width is also narrow. In other words, the larger the M value, the better the effect of filtering out the ideal 50 Hz; however, the actual power frequency interference has a certain frequency variation range. When the M value is large enough to exceed a certain value, the power frequency interference filtering effect will decrease. Therefore, when designing the filter in practice, the selection of the M value should be considered comprehensively. Generally, the M value can be selected as 256.
2 MCU Implementation
Using the adaptive coherent template method to remove power frequency interference can achieve real-time filtering, which is determined by the sampling frequency of the signal and the speed of the single-chip microcomputer. If the sampling frequency of the signal is not high and the single-chip microcomputer speed is fast, the power frequency interference can be filtered out within the sampling interval of the signal. Therefore, before using this method, the time required for signal filtering should be roughly estimated (proportional to the number of channels of the signal), and then the sampling rate and crystal oscillator should be appropriately selected.
For the convenience of explanation, the following example takes the A/D sampling accuracy of 16 bits, the single-chip microcomputer 89C51, fs = 200 Hz, and M = 256 as an example to discuss the rapid implementation of power frequency interference removal in a single-channel signal. Since the A/D accuracy is 16 bits, the operations involved in the single-chip microcomputer are generally double-byte or three-byte addition or subtraction operations, and since the M value is 256, the division operation also becomes extremely simple, which can be directly simplified to discarding the low byte.
2.1 Establishing the initial template
As mentioned above, the key to removing power frequency interference using the adaptive coherent template method is to establish a template for power frequency interference, and in order to achieve continuous filtering, an initial template must be established first.
Since the sampling rate of the signal is 200 Hz, which is 4 times the power frequency interference of 50 Hz, that is, there are 4 sampling values in one power frequency interference cycle, so the established template includes 4 values, corresponding to 4 sampling values of different phases. In addition, since the M value is 256, the first 1024 (=256×4) data (16 bits) collected are used to establish the initial template: the 1024 data are accumulated and stored in memory cells of different addresses according to the different values of mod (n/4) (n=0,1,2,…,1023) (a total of 3 bytes×4=12 bytes is required). When the 1024 data are accumulated, the data stored in the corresponding memory cells is (
m=0,1,2,3). These 4 data are respectively taken from the high 16 bits (middle and high bytes, that is,
2.2 Filter out power frequency interference
After establishing the initial template, the power frequency interference of the signal can be filtered out: for the 1024th (n = 1024) sampling data, since mod(n/4)=0, as long as the sampling value is subtracted from the initial template value 0, that is, a subtraction operation is performed, the power frequency interference of the signal at this moment is filtered out. However, in order to achieve 50 Hz filtering quickly, continuously, and in real time, the initial template value 0 needs to be modified, that is, the content of the stored memory unit is modified to
. Similarly, for the 1025th (n = 1025) sampling data, at this time mod(n/4)=1, to filter out the power frequency interference contained in the signal at this moment, just subtract the initial template value 1, that is, complete the subtraction operation
. Of course, the initial template value 1 also needs to be modified, that is,
the storage The memory unit content is modified to
.
By analogy, each data collected in the future is processed accordingly: filtering and modifying the template, and finally the entire signal can be quickly, continuously and real-timely removed from the power frequency interference. Since the filtering process involves subtraction operations, and the microcontroller's operation and processing of signed numbers are more complicated, before performing the subtraction operation, a constant should be added to the minuend to ensure that the operation results are all positive. Figure 2 is a flowchart of the filtering program.
Conclusion
This paper mainly discusses the problem of rapid implementation of the adaptive coherent template method to remove power frequency interference in the microcontroller application system. Compared with the analog filtering method, this method has the characteristics of low cost and good filtering effect; compared with other digital filtering methods, this method is easy to implement, fast, and has excellent frequency response characteristics.
References
1 Li Gang, Lin Ling, Yu Qilian, Adaptive coherent template method for filtering power frequency interference, Journal of Chinese Biomedical Engineering, Vol. 16, No. 3, pp280-283, 1997.9
2 Sun Hanfang, Xu Aiqing, Principles and Applications of Single Chip Microcomputers, Beijing University of Aeronautics and Astronautics Press, 1988.2
Previous article:Principle and Application of HD7279A
Next article:Dynamic Anti-Tracking Measures in Single-Chip Microcomputer System Encryption
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- [GD32L233C-START Review] RTX operating system
- BAT chip industry procurement recruitment
- A look at hybrid electric vehicles from the perspective of driving methods and related main technologies
- Power module viewing operation
- NUCLEO-G431RB review -> ADC basic configuration (without oversampling)
- Design of Phase Detection Broadband Frequency Measurement System Based on FPGA
- EEWORLD University Hall----Challenges and solutions for ultrasonic water and gas meter design
- Wi-Fi 6E FEM, unleashing the full performance of the 6GHz band
- New uses for old mobile phones (7) - Automatically start the server when the phone is turned on
- [Perf-V Evaluation] Development Board Circuit Analysis and Xilinx Software Trial