Используя этот веб-сайт, вы соглашаетесь с использованием файлов cookie. Мы используем их для оптимизации процессов использования сайта его посетителями.
ок
Click to order
Ваш заказ
Total:
Фамилия
Имя
Email
Ваш телефон
Доставка
Точную стоимость доставки уточнит оператор после оформления заказа
Нажимая на эту кнопку, вы даете согласие на обработку персональных данных и соглашаетесь c политикой конфиденциальности. Content Oriented Web
Make great presentations, longreads, and landing pages, as well as photo stories, blogs, lookbooks, and all other kinds of content oriented projects. Elemyo | 12 March 2020

# Digital notch (band-stop) noise filter 50/60 Hz.

The main reason causes a decrease in the accuracy of measurements of low-frequency signal parameters (including EMG / ECG / EEG signals) in laboratory, industrial and field conditions is the 50/60 Hz network interference.

Elemyo sensors provide the highest possible common mode rejection ratio, which allows the sensors to be used in very strong 50/60 Hz environments. Unfortunately, in some conditions, interference still appears in the signal. Examples of these conditions: touching the body of electrical equipment, power wires, working in a room with a very strong network load, individual skin parameters that affect the sensor contact. To suppress noise in such cases, it is proposed to use a 50/60 Hz notch filter. Below is a mathematical description of the filter, as well as an example of its implementation in the Arduino IDE.

You can find Elemyo library for Arduino here.
The content of the article:
2
Implementation
Go to the section
3
Filter Examples
Go to the section

1
Theory
The notch filter example below is taken from Digital Signal Processing (Third Edition). Authors: LizheTan, JeanJiang. (2019).

Filter Transfer Function: The scale factor for tuning the bandpass filter to a single gain of the passband is defined as: The difference equation describing the considered IIR filter has the following form: where x(n) is the last measurement of the signal, and x(n-1) and x(n-2) are the two previous measurements, y (n) is the current filtered value of the signal, and y (n-1) and y (n -2) - two previous values of the filtered signal. Fig. 1: Frequency response of the filter
(Signal sampling frequency 500 Hz, notch frequency 50 Hz, notch window 46-54 Hz).

2
Implementation
notch filter described in paragraph 1. implemented in the «ELEMYO.h» library for Arduino. The function for filtering is a method of the ELEMYO class and has the following form:
``````int ELEMYO::BandStop (int sensorValue, int f, int BW)
{
//Calculation of time since the previous call
short DT = micros()-T;

//New countdown
T = micros();

//-----Calculation of filter coefficients-------------------
float r = 1 - 0.00000314*BW*DT;
float b1 = -2*cos(0.000006283*f*DT);
float a1 = r*b1;
float K = (1+a1+r*r)/(2+b1);
//------------------------------------------------------------------------

//The new signal value after filtering
Y=K*(sensorValue+b1*X+X)-a1*Y-r*r*Y;

//----Saving Values x(n-1), x(n-2), y(n-1), y(n-2)
Y=Y;
Y=Y;
X=X;
X=sensorValue;
//--------------------------------------------------------------------

return (int) Y;
}``````
Here sensorValue is the current value of the filtered signal, f is the filter frequency (for 50 Hz, f = 50; for 60 Hz, f = 60), BW is the filter rejection window. The function returns a filtered value at the output.

The function body automatically calculates the frequency of reading the signal fs. For a function to work correctly, it is important that after reading the signal, it is immediately substituted into this function. You can perform signal readings with automatic filtering using the BandStop command (analogRead(…), 50, 4).
How the function works:
1. When a function is called, the first step is the calculation of the time interval in microseconds that has passed since the previous call and determines fs.

2. The second step is the calculation of the coefficients, according to the formulas in paragraph 1.

3. The current filtered value of the signal y is calculated.

4. The values x (n-1), x (n-2), y (n-1), y (n-2) are stored, which will be used on the next function call.

3
Filter examples
In fig. Figure 2 shows an example of an EMG signal that is very noisy by network interference. From the signal spectrum in Fig. Figure 5 shows that the interference frequency is 50 Hz and there are no other sources of interference. In fig. 3 shows a real-time filtered function described above. Fig. 2: Signal, very noisy by network interference. Fig. 3: The result of filtering the signal shown in Fig. 2. Fig. 4: Raw and filtered signals received in real time. Fig. 5: Spectrum of the signal shown in fig. 2. Fig. 6: Spectrum of the filtered signal (Fig. 3).
From the graphs in Fig. 5 and fig. Figure 6 shows that the network interference is suppressed more than 14 times. The above notch filter is a good solution to eliminate network interference, in case of its occurrence.
Thanks for attention! We hope you find this article helpful. If you have any questions - feel free to contact us at info@elemyo.com. We will answer you!