Rapid Implementation of Removing Power Frequency Interference in Single Chip Microcomputer Application System

Publisher:HarmonyJoyLatest update time:2012-03-19 Source: 单片机与嵌入式系统应用 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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

Reference address:Rapid Implementation of Removing Power Frequency Interference in Single Chip Microcomputer Application System

Previous article:Principle and Application of HD7279A
Next article:Dynamic Anti-Tracking Measures in Single-Chip Microcomputer System Encryption

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号