Power frequency signal filtering method and device and snore stopping pillow
By using the power frequency signal filtering method in the snoring pillow, the power frequency interference in the signal is filtered out by using the notch, the power frequency interference problem caused by the power system is solved, and the accuracy of the snoring operation is improved.
Patent Information
- Application Number
- CN202411713090.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-07
AI Technical Summary
When the snoring pillow is connected to the power supply, the power system causes the piezoelectric signal to be disturbed by the power frequency, which in turn affects the accuracy of the snoring operation.
An industrial frequency signal filtering method is adopted to obtain the pressure signal collected by the sensor, extract the signal characteristics, determine the target frequency, set the notch, and filter out the industrial frequency interference in the signal by using the notch.
It effectively eliminates the power frequency interference, improves the accuracy of the snoring operation, and ensures the accuracy of the piezoelectric signal.
Smart Images

Figure CN119564396A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of power frequency interference, and in particular to a power frequency signal filtering method, device and anti-snoring pillow. Background Art
[0002] The anti-snoring pillow uses a piezoelectric sensor to detect the pressure on the pillow body and generate a piezoelectric signal. It determines whether there is snoring based on the piezoelectric signal. If there is snoring, an anti-snoring operation is performed.
[0003] During use, the anti-snoring pillow needs to be connected to the mains power supply so that the various devices and components in the anti-snoring pillow can work normally. When the anti-snoring pillow is connected to the power supply, the power system will cause the piezoelectric signal to be interfered by the power frequency, making the piezoelectric signal inaccurate, and thus causing the subsequent inability to effectively stop snoring. Summary of the invention
[0004] The present application solves at least one of the above-mentioned technical problems to a certain extent. To this end, the present application provides a method and device for filtering power frequency signals and an anti-snoring pillow, which can filter out power frequency signals and reduce power frequency interference.
[0005] In a first aspect, an embodiment of the present application provides a method for filtering a power frequency signal, which is applied to a power frequency signal filtering device, wherein the power frequency signal filtering device includes a sensor, and the sensor is used to collect a pressure value of an anti-snoring pillow. The method includes:
[0006] Acquire a first signal collected by the sensor, wherein the first signal represents a pressure value of the anti-snoring pillow;
[0007] Extracting a signal feature of the first signal, wherein the signal feature is a time domain feature or a frequency domain feature;
[0008] Determining a target frequency according to the signal characteristics, wherein the target frequency is the frequency of the power frequency signal in the first signal;
[0009] determining a notch filter according to the target frequency;
[0010] The notch filter is used to filter out the power frequency signal in the first signal.
[0011] In some embodiments, if the signal feature is a time domain feature, extracting the signal feature of the first signal includes:
[0012] Performing band-pass filtering on the first signal to obtain a second signal, wherein a frequency interval of the band-pass filtering includes the target frequency;
[0013] A midpoint value of the first amplitude of the second signal is obtained, and the midpoint value is used as the signal feature.
[0014] In some embodiments, determining the target frequency according to the signal characteristics includes:
[0015] Traversing the data points in the second signal, and determining the number of adjacent data points in the second signal that pass through the midpoint value;
[0016] If the number is within a first numerical interval, determining the first frequency as the target frequency;
[0017] If the number is within the second value interval, the second frequency is determined to be the target frequency.
[0018] In some embodiments, determining the number of the second signal passing through the midpoint value includes:
[0019] If adjacent data points in the second signal are respectively a first data point and a second data point;
[0020] Obtaining a first difference between a first data point amplitude corresponding to the first data point and the midpoint value;
[0021] Obtaining a second difference between a second data point amplitude corresponding to the second data point and the midpoint value;
[0022] If the product of the first difference and the second difference is less than zero, the number is increased by one, and so on, until the traversal of the data points in the second signal is completed.
[0023] In some embodiments, before obtaining the average value of the first amplitude of the second signal, the method further includes:
[0024] The data of the second signal before the first preset time length is deleted.
[0025] In some embodiments, if the signal feature is a frequency domain feature, extracting the signal feature of the first signal includes:
[0026] Performing a fast Fourier transform on the first signal to obtain frequency domain features of the first signal, wherein the frequency domain features include each frequency of the first signal and each second amplitude corresponding to each frequency.
[0027] In some embodiments, determining the target frequency according to the signal characteristics includes:
[0028] Obtaining a maximum value among the second amplitudes and a frequency corresponding to the maximum value;
[0029] If the frequency corresponding to the maximum value is within the first frequency interval, determining the first frequency as the target frequency;
[0030] If the frequency corresponding to the maximum value is within the second frequency interval, the second frequency is determined to be the target frequency.
[0031] In some embodiments, before obtaining the maximum value in the second amplitude and the frequency corresponding to the maximum value, the method further includes:
[0032] The first frequency and the second amplitude corresponding to the first frequency in the first signal are deleted.
[0033] In a second aspect, an embodiment of the present application provides a power frequency signal filtering device, the power frequency signal filtering device comprising:
[0034] A sensor for collecting pressure values of the anti-snoring pillow; and
[0035] A controller, the controller is communicatively connected to the sensor, the controller includes at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions are executed by the at least one processor so that the at least one processor can perform the power frequency signal filtering method as described above.
[0036] In some embodiments, the sensor is a piezoelectric sensor.
[0037] In a third aspect, an embodiment of the present application provides an anti-snoring pillow, the anti-snoring pillow comprising: a pillow body, a USB main control box, and the power frequency signal filtering device as described above;
[0038] The pillow body is provided with a USB interface, and the sensor is arranged in the pillow body;
[0039] The controller is arranged in the USB main control box, and the sensor is connected to the controller by wired communication via the USB interface.
[0040] Compared with the prior art, the present application has at least the following beneficial effects: in the power frequency signal filtering method of the present application, firstly, the first signal collected by the sensor is obtained, wherein the first signal represents the pressure value of the anti-snoring pillow, and then the signal characteristics of the first signal are extracted, wherein the signal characteristics are time domain characteristics or frequency domain characteristics, and the target frequency is determined according to the signal characteristics, wherein the target frequency is the frequency of the power frequency signal in the first signal, and the notch filter is determined according to the target frequency, and finally the power frequency signal in the first signal is filtered out by the notch filter. Therefore, the method can determine the frequency of the power frequency signal according to the signal characteristics of the first signal, and then filter out the power frequency signal in the first signal, remove the power frequency interference, and improve the accuracy of the subsequent anti-snoring operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0042] Figure 1 It is a structural schematic diagram of one of the anti-snoring pillows provided in the embodiments of the present application;
[0043] Figure 2 It is a circuit structure diagram of one of the power frequency signal filtering devices provided in the embodiments of the present application;
[0044] Figure 3 This is a schematic diagram of a controller structure provided in an embodiment of the present application;
[0045] Figure 4 It is a schematic diagram of the application environment of one of the power frequency signal filtering devices provided in the embodiments of the present application;
[0046] Figure 5 This is a schematic diagram of a process flow of a power frequency signal filtering method provided in an embodiment of the present application;
[0047] Figure 6 yes Figure 5 Schematic diagram of the process of step S52;
[0048] Figure 7 yes Figure 5 Schematic diagram of the process of step S53;
[0049] Figure 8 is a schematic diagram of one of the second signals, the midpoint value SigMean and each first amplitude provided in an embodiment of the present application;
[0050] Fig. 9 is a schematic diagram of one of the second signals, the midpoint value SigMean and each first amplitude provided in an embodiment of the present application;
[0051] Fig.10 yes Figure 5 Another schematic flow chart of step S53;
[0052] Fig.11 This is a schematic diagram of the amplitude-frequency relationship of a 50 Hz power frequency signal provided in an embodiment of the present application;
[0053] Fig.12 This is a schematic diagram of the amplitude-frequency relationship of a 60 Hz power frequency signal provided in an embodiment of the present application;
[0054] Fig.13 It is a structural schematic diagram of one of the power frequency signal filtering devices provided in the embodiments of the present application. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0056] It should be noted that, if there is no conflict, the various features in the embodiments of the present application can be combined with each other, all within the scope of protection of the present application. In addition, although the functional module division is performed in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a sequence different from the module division in the device or the flow chart. Furthermore, the words "first", "second", "third", etc. used in this application do not limit the data and execution order, but only distinguish the same items or similar items with basically the same functions and effects.
[0057] The power frequency signal filtering device of the embodiment of the present application can be constructed into any suitable shape and placed in various anti-snoring pillows to automatically calibrate the threshold of the anti-snoring pillow state.
[0058] See also Figure 1 , Figure 1 is a schematic diagram of an anti-snoring pillow provided in an embodiment of the present application, such as Figure 1 As shown, the anti-snoring pillow 100 includes a pillow body 10 , a USB main control box 20 and an industrial frequency signal filtering device 30 .
[0059] Please also read Figure 2 , Figure 2 Schematic diagram of the circuit structure of a power frequency signal filtering device provided in an embodiment of the present application. Figure 2 As shown, the power frequency signal filtering device 30 includes a sensor 31 and a controller 32 .
[0060] The pillow body 10 is provided with a USB interface 11, and the sensor 31 is disposed in the pillow body 10. The controller 32 is disposed in the USB main control box 20, and the sensor 31 is connected to the controller 32 via the USB interface 11 by wired communication.
[0061] The USB interface 11 can be connected to the controller 32 in the USB main control box 20 through a signal transmission line. The USB interface 11 can be a Type-C interface, or other easy-to-connect and stable interfaces. The USB interface 11 supports plugging and unplugging. When a snoring stop operation or a power frequency signal filtering operation is required, the plug of the signal transmission line can be plugged into the USB interface 11.
[0062] The sensor 31 may be a piezoelectric sensor. In the embodiment of the present application, it may be a piezoelectric sensor. As a dynamic strain sensor, the piezoelectric material of the piezoelectric sensor generates a charge on its surface after being subjected to force. After being amplified and transformed into impedance by a charge amplifier and a measuring circuit, the charge becomes an electrical output proportional to the external force. Therefore, a piezoelectric sensor may be used to detect the pressure on the pillow body 10, generate a piezoelectric signal, and determine whether a user is resting on the pillow body 10 based on the piezoelectric signal, and determine whether there is snoring based on the piezoelectric signal. If there is snoring, a snoring stop operation is performed.
[0063] When the user is sleeping, the head rests on the pillow body 10, and the sensor 31 can collect the pressure value of the pillow body 10 and convert the collected pressure value into a piezoelectric signal. The piezoelectric signal is transmitted to the controller 32 through the USB interface 11 and the signal transmission line. The controller 32 receives and processes the signal to analyze whether the user snores during sleep. When snoring occurs, the airbags at different positions in the pillow body 10 are controlled to inflate and deflate to stop snoring.
[0064] During use, the anti-snoring pillow needs to be connected to the mains power supply so that the various devices and components in the anti-snoring pillow can work normally. When the anti-snoring pillow is connected to the power supply, the power system will cause the piezoelectric signal to be interfered by the power frequency, making the piezoelectric signal inaccurate, and thus causing the subsequent inability to effectively stop snoring.
[0065] Based on the above reasons, an embodiment of the present application provides a power frequency signal filtering method, which is applied to a power frequency signal filtering device, and can remove power frequency interference in the piezoelectric signal and improve the accuracy of subsequent anti-snoring operations.
[0066] Please also read Figure 3 The controller 32 includes at least one processor 321 (connected via a system bus or other communication methods). Figure 3 The controller 32 may be in the form of a chip.
[0067] Among them, the memory 322 stores instructions that can be executed by the at least one processor 321, and the instructions are executed by the at least one processor 321. The processor 321 is used to provide computing and control capabilities to control the power frequency signal filtering device 30 to execute relevant commands, for example, to control the power frequency signal filtering device 30 to execute any one of the power frequency signal filtering methods provided in the following embodiments of the present application.
[0068] The memory 322, as a non-transient computer-readable storage medium, can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the power frequency signal filtering method provided in the following embodiments of the present application. The processor 321 can implement the power frequency signal filtering method in any of the following method embodiments by running the non-transient software programs, instructions and modules stored in the memory 322. Specifically, the memory 322 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 322 may also include a memory remotely arranged relative to the processor 321, and these remote memories may be connected to the processor 321 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.
[0069] See also Figure 4 , Figure 4 is a schematic diagram of an application scenario of an industrial frequency signal filtering device 30 provided in an embodiment of the present application, such as Figure 4 As shown, the power frequency signal filtering device 30 can also be communicatively connected with the mobile terminal 200, and the mobile terminal 200 and the power frequency signal filtering device 30 can be communicatively connected in any manner, such as: wired connection or wireless connection achieved by using wireless fidelity technology (Wireless Fidelity, Wi-Fi), Bluetooth technology or mobile communication technologies such as the 3rd Generation (3G), 4th Generation (4G), or 5th Generation (5G).
[0070] The mobile terminal 200 may be configured with one or more different user interaction devices to collect user instructions or display and feedback information to the user. These interaction devices include but are not limited to: buttons, display screens, touch screens, and speakers. For example, the mobile terminal 200 may be equipped with a touch screen, through which the user's remote control instructions for the power frequency signal filtering device are received and the frequency of the power frequency signal may be displayed to the user through the touch screen.
[0071] The mobile terminal 200 and the power frequency signal filtering device 30 transmit communication data to each other. For example, the power frequency signal filtering device 30 can transmit the frequency of the power frequency signal and the result of the power frequency signal filtering to the mobile terminal 200 for the user to view in time. The mobile terminal 200 displays the frequency of the power frequency signal and the filtering result in real time, which can be displayed in various forms to facilitate user viewing. At the same time, the user can also control the power frequency signal filtering device through the mobile terminal 200 to set the power frequency signal filtering device to work in a suitable mode. For example, before the user lies down to sleep, the mobile terminal 200 controls the power frequency signal filtering device to automatically filter the power frequency signal. After the power frequency signal is filtered, the user lies down to sleep to improve the detection accuracy of the subsequent anti-snoring pillow state, thereby ensuring the sleeping effect.
[0072] It should be noted that the mobile terminal 200 may be a smart phone, a tablet computer, a personal digital assistant, or other hardware device with various operating systems.
[0073] Please continue reading Figure 2 The power frequency signal filtering device 30 also includes a signal processing circuit 33 , which is electrically connected to the sensor 31 and the controller 32 , respectively, for processing the piezoelectric signal and transmitting the processed piezoelectric signal to the controller 32 .
[0074] The signal processing circuit 33 can amplify and filter the piezoelectric signal. The amplified signal is easier to be processed by the controller 32, and different filtering methods can be used according to different stages. In some embodiments, the signal processing circuit 33 can also perform AD conversion on the piezoelectric signal, converting the piezoelectric signal into a digital signal, and the controller 32 receives and processes the digital signal. In some embodiments, the signal processing circuit 33 can also be integrated into the controller 32, and the controller 32 can realize the amplification, filtering and AD conversion of the piezoelectric signal.
[0075] In some embodiments, the power frequency signal filtering device 30 further includes a wireless module 34 , which is communicatively connected to the controller 32 and is used for data communication with the mobile terminal 200 .
[0076] The wireless module 34 can be implemented in various ways, such as a Bluetooth module, a WIFI module, or other wireless modules.
[0077] See also Figure 5 , Figure 5 is a flow chart of a method for filtering power frequency signals provided in an embodiment of the present application, such as Figure 5 As shown, the power frequency signal filtering method includes:
[0078] S51, acquiring a first signal collected by the sensor, wherein the first signal represents a pressure value of the anti-snoring pillow;
[0079] The first signal is a piezoelectric signal, which represents the pressure value of the anti-snoring pillow. Before the user lies down to sleep, if there is no object on the anti-snoring pillow and the anti-snoring pillow is in a static state, the pressure on the anti-snoring pillow should be very small and fluctuate less. If the anti-snoring pillow is in the process of deformation, the pressure on the anti-snoring pillow is fluctuating. Therefore, the anti-snoring pillow is subjected to different pressures in different states, and the size of the first signal represents the pressure value of the pressure on the anti-snoring pillow.
[0080] The collection method of this application is to collect the first signal before the user falls asleep. If the anti-snoring pillow is deformed, the first signal is a mixed signal of the piezoelectric signal, the noise signal and the industrial frequency signal. If the anti-snoring pillow is not deformed, the first signal is a mixed signal of the noise signal and the industrial frequency signal.
[0081] A faster sampling frequency can be used to sample the first signal to obtain more piezoelectric data to obtain an accurate power frequency signal frequency. The sampling frequency of the sensor can be set as needed. In this embodiment, the sampling frequency is 400 Hz.
[0082] S52, extracting a signal feature of the first signal, wherein the signal feature is a time domain feature or a frequency domain feature;
[0083] The power frequency signal is generally 50Hz or 60Hz, depending on the AC power frequency in different countries or regions. Signals of this frequency may interfere with the piezoelectric signal collected by the sensor, making it impossible to accurately stop snoring based on the piezoelectric signal.
[0084] The signal feature characterizes the signal characteristics of the first signal, and these signal characteristics can be time domain characteristics or frequency domain characteristics. Time domain characteristics refer to the characteristics of the signal on the time axis, such as amplitude, frequency, energy, etc. Frequency domain characteristics refer to the characteristics of the signal on the frequency axis, such as amplitude, frequency, and are usually obtained through methods such as Fourier transform or fast Fourier transform.
[0085] Since the first signal includes a power frequency signal, the signal characteristics of which are different from those of the undisturbed piezoelectric signal, the power frequency signal in the first signal can be screened out according to the signal characteristics and then filtered out.
[0086] Specifically, if the signal feature is a time domain feature, such as Figure 6 As shown, step S52 includes:
[0087] S521. Perform band-pass filtering on the first signal to obtain a second signal, wherein a frequency interval of the band-pass filtering includes the target frequency;
[0088] In signal processing, bandpass filtering is a commonly used technique for extracting components within a specific frequency range from an original signal. Bandpass filtering is performed on the first signal (i.e., the original signal collected by the piezoelectric sensor) in order to extract the frequency components containing useful information while suppressing other unnecessary frequency components.
[0089] Specifically, the purpose of bandpass filtering is to ensure that the target frequency (i.e., the frequency of the power frequency signal) is retained in the filtered signal, i.e., the second signal, for subsequent analysis and processing. Bandpass filtering also suppresses signals of other frequencies and filters out signals with frequencies below and above a specific range, which may be noise (such as the noise signal in the first signal) or other irrelevant signal components (such as normal piezoelectric signals).
[0090] When implementing a bandpass filter, you need to determine the filter's cutoff frequency. The cutoff frequency defines the filter's frequency response, and there are usually two cutoff frequencies: a low-frequency cutoff frequency (f_low) and a high-frequency cutoff frequency (f_high). In this way, the bandpass filter will allow frequencies between f_low and f_high to pass, while blocking frequencies below f_low and above f_high.
[0091] The low frequency cutoff frequency (f_low) and the high frequency cutoff frequency (f_high) constitute the frequency interval of the bandpass filter, and the target frequency is within the frequency interval of the bandpass filter. For example, if the frequency of the power frequency signal is 50HZ or 60HZ, that is, the target frequency is 50HZ or 60HZ, then the frequency interval of the bandpass filter can be [30HZ-80HZ], and the second signal will include a signal with a frequency of [30HZ-80HZ].
[0092] Bandpass filtering can be achieved by an IIR Butterworth bandpass filter, whose specific parameter configuration is an order of 4 and a sampling rate of 400HZ.
[0093] S522. Obtain a midpoint value of the first amplitude of the second signal, and use the midpoint value as the signal feature.
[0094] The second signal is a time domain signal, which includes each data point and a first amplitude corresponding to each data point. Based on the first amplitude corresponding to each data point in the second signal, a signal feature is obtained.
[0095] The first amplitude usually refers to the amplitude or strength of the second signal, and the "midpoint value" provides a way to quantify the overall level of the second signal. First, the largest first amplitude among the first amplitudes in the second signal is obtained, and then the smallest first amplitude among the first amplitudes is obtained. The average of the largest first amplitude and the smallest first amplitude is the midpoint value.
[0096] In some embodiments, the average value of each first amplitude value may be determined as the signal feature, or the middle value (median) of each first amplitude value may be determined as the signal feature.
[0097] S53, determining a target frequency according to the signal characteristics, wherein the target frequency is the frequency of the power frequency signal in the first signal;
[0098] The signal characteristics include the characteristics of the power frequency signal, based on which the specific frequency of the power frequency signal can be determined so that it can be accurately filtered out later.
[0099] Specifically, if the signal feature is a time domain feature, such as Figure 7 As shown, step S53 includes:
[0100] S531, traversing the data points in the second signal, and determining the number of adjacent data points in the second signal that pass through the midpoint value;
[0101] The number of data points passing through the midpoint value in the second signal represents a change trend of adjacent data points relative to the midpoint value, and specific features of the second signal are identified based on the change trend of adjacent data points relative to the midpoint value in the second signal.
[0102] Specifically, if adjacent data points in the second signal are the first data point and the second data point, respectively, the first difference between the amplitude of the first data point corresponding to the first data point and the midpoint value is obtained, and the second difference between the amplitude of the second data point corresponding to the second data point and the midpoint value is obtained. If the result of the first difference and the second difference is less than zero, the number of values passing through the midpoint value is increased by one, and so on, until the traversal of the data points in the second signal is completed.
[0103] That is, first calculate the first difference = the first data point amplitude - the midpoint value, the second difference = the second data point amplitude - the midpoint value, and then identify the intersection of the amplitude of the second signal and the midpoint value. If the product of the first difference and the second difference is less than zero (i.e., the first difference * the second difference <0), this indicates that between the first data point and the second data point, the amplitude of the second signal crosses from below the midpoint value to above the midpoint value, or from above the midpoint value to below the midpoint value. This crossing indicates that the signal has a zero crossing point near the midpoint value. Whenever such a crossing is found, a counter is incremented by one, which records the number of zero crossings of the signal near the midpoint value.
[0104] If the second signal includes 400 data points, the first amplitudes of the 400 data points are stored in the array SigFlt, the maximum and minimum values of the first amplitudes in the array SigFlt are found and recorded as SigMax and SigMin respectively, and then the midpoint value SigMean at 1 / 2 of SigMax and SigMin is calculated, that is, SigMean = (SigMax + SigMin) / 2 is calculated.
[0105] Then traverse the first amplitude in the array SigFlt and record the number Cnt of (SigFlt[i]-SigMean)*(sigFlt[i+1]-SigMean)<0, where SigFlt[i] is the i-th value in the SigFlt array and i is any integer from 0 to 399.
[0106] S532: If the number is within a first numerical interval, determining the first frequency as the target frequency;
[0107] S533: If the number is within a second numerical interval, determine the second frequency as the target frequency.
[0108] Different numbers represent different frequencies of signals. Therefore, the size of the number can be used to determine whether there is an industrial frequency signal and the specific frequency of the industrial frequency signal.
[0109] If the second signal includes 400 data points and is a 50 Hz power frequency signal, then the second signal, the midpoint value SigMean, and each first amplitude in the array SigFlt are as follows: Figure 8 As shown, if the second signal is a 60 Hz power frequency signal, the second signal, the midpoint value SigMean and each first amplitude in the array SigFlt are as follows: Fig. 9 shown. Figure 8 and Fig. 9 The horizontal axis of the coordinate axis is the sampling point, and the vertical axis of the coordinate axis is the first amplitude. Figure 8 and Fig. 9 It can be seen that, when the sampling points are the same (as shown in the figure, the number of sampling points is 400), the number of industrial frequency signals with a frequency of 50 Hz crossing the midpoint value is less than the number of industrial frequency signals with a frequency of 60 Hz crossing the midpoint value. The industrial frequency signal with a frequency of 50 Hz is more sparse, and the industrial frequency signal with a frequency of 60 Hz is more dense. Therefore, the frequency of the industrial frequency signal can be determined by the number of midpoint values crossed in the second signal, so that the industrial frequency signal can be accurately filtered out later.
[0110] The first numerical interval and the second numerical interval are determined according to the specific frequency of the power frequency signal. For example, the first numerical interval can be (92, 108), and the second numerical interval can be (112, 128). If the number is within the first numerical interval, 50 Hz is determined as the target frequency, that is, the frequency of the power frequency signal is 50 Hz. If the number is within the second numerical interval, 60 Hz is determined as the target frequency, that is, the frequency of the power frequency signal is 60 Hz.
[0111] In some embodiments, since the second signal obtained after filtering may be distorted, generally the front segment data will be distorted, therefore, before obtaining the average value of the first amplitude of the second signal, the data of the first preset time length of the second signal can be deleted. Among them, the first preset time length can be set as needed. In this embodiment, if the sampling time length is 2 seconds, that is, the time length of the second signal is 2 seconds, the data of the first 1 second is deleted, and the data of the last second is left to obtain the average value of the data of the last second. In some embodiments, the data of the second signal after the second preset time length can also be directly intercepted, such as intercepting the data of the last second for processing and analysis.
[0112] Deleting distorted data or using only valid data for processing and analysis can more accurately obtain the frequency of the power frequency signal, so that the power frequency signal can be accurately filtered out subsequently.
[0113] In some embodiments, if the signal feature is a frequency domain feature, when extracting the signal feature of the first signal, a fast Fourier transform is performed on the first signal to obtain the frequency domain feature of the first signal, wherein the frequency domain feature includes each frequency of the first signal and each second amplitude corresponding to each frequency.
[0114] Fast Fourier Transform (FFT) is a technique commonly used to convert signals from the time domain to the frequency domain. The first signal is a time domain signal, and the FFT algorithm is applied to the first signal to convert it to the frequency domain. In the frequency domain, the first signal is represented as a collection of various frequency components, and each frequency component has a corresponding second amplitude (or amplitude) that represents the intensity of the frequency component in the first signal.
[0115] Power frequency signals of different frequencies have different corresponding frequency domain characteristics, and the amplitude corresponding to the frequency of the power frequency signal is the largest among all second amplitudes. Therefore, the frequency of the power frequency signal can be determined based on each frequency and the second amplitude corresponding to each frequency.
[0116] Specifically, Fig.10 As shown, step S53 also includes:
[0117] S534, obtaining a maximum value among the second amplitudes and a frequency corresponding to the maximum value;
[0118] S535: If the frequency corresponding to the maximum value is within the first frequency interval, determine the first frequency as the target frequency;
[0119] S536: If the frequency corresponding to the maximum value is within a second frequency interval, determine the second frequency as the target frequency.
[0120] The amplitude-frequency relationship of a 50HZ power frequency signal is as follows: Fig.11 As shown, the amplitude corresponding to 50HZ is the maximum among all amplitudes. The amplitude-frequency relationship of the 60HZ power frequency signal is as follows: Fig.12 As shown, the amplitude corresponding to 60 Hz is the maximum value among all the amplitudes. Therefore, the frequency of the power frequency signal can be determined by the frequency corresponding to the maximum value in the second amplitude.
[0121] The first frequency interval and the second frequency interval are determined according to the frequency of the power frequency signal. The first frequency interval may be (f1-Δf, f1-Δf), and the second frequency interval may be (f2-Δf, f2-Δf), wherein f1 and f2 are the frequencies of the power frequency signal respectively, and Δf is the error.
[0122] For example, the first frequency interval can be (49, 51), and the second frequency interval can be (59, 61). If the frequency corresponding to the maximum value is within the first frequency interval, 50 Hz is determined as the target frequency, that is, the frequency of the industrial frequency signal is 50 Hz. If the frequency corresponding to the maximum value is within the second frequency interval, 60 Hz is determined as the target frequency, that is, the frequency of the industrial frequency signal is 60 Hz.
[0123] The first frequency interval and the second frequency interval have an error of ±1. If the error is increased to ±2, the first frequency interval can be (48,52) and the second frequency interval can be (58,62). The specific error setting can be set as needed. The smaller the error, the more accurate the determination of the target frequency.
[0124] In some embodiments, before obtaining the maximum value in the second amplitude and the frequency corresponding to the maximum value, the first frequency in the first signal and the second amplitude corresponding to the first frequency are deleted. Since the first frequency is zero and is the DC component in the first signal, it does not need to be considered, so it can be deleted, and starting from the second frequency, the maximum value in the second amplitude corresponding to the remaining frequencies and the frequency corresponding to the maximum value are obtained, which can save computing resources and reduce errors.
[0125] If the first signal is a piezoelectric signal with a duration of 11 seconds and a sampling rate of 400 Hz, the first signal includes 4400 data points. In order to facilitate the fast Fourier transform (because the fast Fourier transform usually requires the input signal to have 2N data points), the 4400 data points are intercepted and 4096 data points are intercepted. The 4096 data points can be recorded as signal Sig.
[0126] Perform fast Fourier transform on the signal Sig to obtain each frequency and the second amplitude corresponding to each frequency, store each frequency in the frequency array FreqArr, and store each second amplitude in the amplitude array MagArr.
[0127] Starting from the second position (because the frequency of the first position is zero, it is the DC component of the signal and does not need to be considered), traverse the amplitude array MagArr and find its maximum value magMax and its corresponding frequency freqMax of the frequency array FreqArr.
[0128] If the frequency freqMax is in the first frequency interval (49, 51), the target frequency is determined to be 50 Hz. If the frequency freqMax is in the second frequency interval (59, 61), the target frequency is determined to be 60 Hz.
[0129] In the embodiment of the present application, the frequency of the power frequency signal can be accurately determined so that the interference of the power frequency signal can be accurately removed subsequently.
[0130] S54, determining a notch filter according to the target frequency;
[0131] S55: Use the notch filter to filter out the power frequency signal in the first signal.
[0132] A notch filter is a special type of band-stop filter that suppresses signals of a specific frequency while allowing signals of other frequencies to pass through. This filter is very useful when specific frequency interference needs to be removed, such as removing frequency interference (such as 50Hz or 60Hz) from power lines in audio processing, or removing interference of specific frequencies in communication systems.
[0133] In the embodiment of the present application, a notch filter is used to filter the interference of the power frequency signal. The notch frequency of the notch filter is a specific frequency that needs to be suppressed, and the target frequency is the frequency of the power frequency signal. Therefore, the target frequency is determined as the notch frequency of the notch filter, so that the notch filter is used to filter the power frequency signal in the first signal to remove the power frequency interference.
[0134] In summary, the power frequency signal filtering method can determine the frequency of the power frequency signal according to the signal characteristics of the first signal, and then filter out the power frequency signal in the first signal, remove the power frequency interference, and improve the accuracy of subsequent anti-snoring operations.
[0135] It should be noted that in each of the above embodiments, there is not necessarily a certain order between the above steps. A person skilled in the art can understand, based on the description of the embodiments of the present application, that in different embodiments, the above steps may have different execution orders, that is, they may be executed in parallel, may be executed interchangeably, and so on.
[0136] As another aspect of the embodiment of the present application, the embodiment of the present application provides a power frequency signal filtering device. The power frequency signal filtering device can be a software module, and the software module includes a number of instructions, which are stored in the memory of the controller 32. The processor can access the memory and call the instructions for execution to complete the power frequency signal filtering method described in the above embodiments.
[0137] In some embodiments, the power frequency signal filtering device can also be constructed by hardware devices, for example, the power frequency signal filtering device can be constructed by one or more chips, and each chip can work in coordination with each other to complete the power frequency signal filtering method described in each of the above embodiments. For another example, the power frequency signal filtering device can also be constructed by various logic devices, such as a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a single-chip microcomputer, an ARM (Acorn RISC Machine) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components.
[0138] See also Fig.13 , Fig.13 An embodiment of the present application provides a power frequency signal filtering device, and the power frequency signal filtering device 900 includes a first acquisition module 91, an extraction module 92, a first determination module 93, a second determination module 94 and a filtering module 95.
[0139] The first acquisition module 91 is used to acquire a first signal collected by the sensor, wherein the first signal represents the pressure value of the anti-snoring pillow;
[0140] The extraction module 92 is used to extract the signal feature of the first signal, wherein the signal feature is a time domain feature or a frequency domain feature;
[0141] The first determination module 93 is used to determine a target frequency according to the signal characteristics, wherein the target frequency is the frequency of the power frequency signal in the first signal;
[0142] The second determination module 94 is used to determine the notch filter according to the target frequency;
[0143] The filtering module 95 is used to filter out the power frequency signal in the first signal by using the notch filter.
[0144] Therefore, the power frequency signal filtering device can determine the frequency of the power frequency signal according to the signal characteristics of the first signal, and then filter out the power frequency signal in the first signal, remove the power frequency interference, and improve the accuracy of subsequent anti-snoring operations.
[0145] It should be noted that, since the power frequency signal filtering device and the power frequency signal filtering method in the above embodiment are based on the same application concept, the corresponding contents in the above method embodiment are also applicable to the device embodiment and will not be described in detail here.
[0146] The present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by one or more processors, for example Figure 3 A processor 321 in the embodiment may enable the one or more processors to execute the power frequency signal filtering method in any of the above method embodiments.
[0147] An embodiment of the present application also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by the controller 32, the controller 32 executes any one of the power frequency signal filtering methods.
[0148] In summary, the power frequency signal filtering method can determine the frequency of the power frequency signal according to the signal characteristics of the first signal, and then filter out the power frequency signal in the first signal, remove the power frequency interference, and improve the accuracy of subsequent anti-snoring operations.
[0149] The above described device or equipment embodiments are merely illustrative, wherein the unit modules described as separate components may or may not be physically separated, and the components displayed as module units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network module units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0150] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the power frequency signal filtering method described in each embodiment or some parts of the embodiment.
[0151] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Under the concept of the present application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other changes in different aspects of the present application as described above, which are not provided in detail for the sake of simplicity. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for filtering power frequency signals, applied to a power frequency signal filtering device, characterized in that: The power frequency signal filtering device includes a sensor, and the sensor is used to collect the pressure value of the anti-snoring pillow. The method includes: Acquire a first signal collected by the sensor, wherein the first signal represents a pressure value of the anti-snoring pillow; Extracting a signal feature of the first signal, wherein the signal feature is a time domain feature or a frequency domain feature; Determining a target frequency according to the signal characteristics, wherein the target frequency is the frequency of the power frequency signal in the first signal; determining a notch filter according to the target frequency; The notch filter is used to filter out the power frequency signal in the first signal.
2. The method for filtering out power frequency signals according to claim 1, characterized in that: If the signal feature is a time domain feature, extracting the signal feature of the first signal includes: Performing band-pass filtering on the first signal to obtain a second signal, wherein a frequency interval of the band-pass filtering includes the target frequency; A midpoint value of the first amplitude of the second signal is obtained, and the midpoint value is used as the signal feature.
3. The method for filtering out power frequency signals according to claim 2, characterized in that: The determining the target frequency according to the signal characteristics comprises: Traversing the data points in the second signal, and determining the number of adjacent data points in the second signal that pass through the midpoint value; If the number is within a first numerical interval, determining the first frequency as the target frequency; If the number is within the second value interval, the second frequency is determined to be the target frequency.
4. The method for filtering out power frequency signals according to claim 2, characterized in that: The determining the number of the second signal passing through the midpoint value includes: If adjacent data points in the second signal are respectively a first data point and a second data point; Obtaining a first difference between a first data point amplitude corresponding to the first data point and the midpoint value; Obtaining a second difference between a second data point amplitude corresponding to the second data point and the midpoint value; If the product of the first difference and the second difference is less than zero, the number is increased by one, and so on, until the traversal of the data points in the second signal is completed.
5. The method for filtering out power frequency signals according to claim 2, characterized in that: Before obtaining the average value of the first amplitude of the second signal, the method further includes: The data of the second signal before the first preset time length is deleted.
6. The method for filtering out power frequency signals according to claim 1, characterized in that: If the signal feature is a frequency domain feature, extracting the signal feature of the first signal includes: Performing a fast Fourier transform on the first signal to obtain frequency domain features of the first signal, wherein the frequency domain features include each frequency of the first signal and each second amplitude corresponding to each frequency.
7. The method for filtering out power frequency signals according to claim 6, characterized in that: The determining the target frequency according to the signal characteristics comprises: Obtaining a maximum value among the second amplitudes and a frequency corresponding to the maximum value; If the frequency corresponding to the maximum value is within the first frequency interval, determining the first frequency as the target frequency; If the frequency corresponding to the maximum value is within the second frequency interval, the second frequency is determined to be the target frequency.
8. The method for filtering out power frequency signals according to claim 7, characterized in that: Before obtaining the maximum value of the second amplitude and the frequency corresponding to the maximum value, the method further includes: The first frequency and the second amplitude corresponding to the first frequency in the first signal are deleted.
9. A power frequency signal filtering device, characterized in that: The power frequency signal filtering device comprises: A sensor for collecting pressure values of the anti-snoring pillow; and A controller, the controller is communicatively connected to the sensor, the controller includes at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions are executed by the at least one processor so that the at least one processor can execute the power frequency signal filtering method as described in any one of claims 1-8.
10. The power frequency signal filtering device according to claim 9, characterized in that: The sensor is a piezoelectric sensor.
11. An anti-snoring pillow, characterized in that: The anti-snoring pillow comprises: a pillow body, a USB main control box and the power frequency signal filtering device as claimed in claim 9 or 10; The pillow body is provided with a USB interface, and the sensor is arranged in the pillow body; The controller is arranged in the USB main control box, and the sensor is connected to the controller by wired communication via the USB interface.
