Offset compensation for zero-crossing detection
09658295 ยท 2017-05-23
Assignee
Inventors
Cpc classification
G01R19/2509
PHYSICS
G01R19/2506
PHYSICS
G01R33/0029
PHYSICS
G01R23/02
PHYSICS
International classification
G01R23/02
PHYSICS
G01D5/244
PHYSICS
Abstract
There is described a device for removing an offset from a signal, the device comprising (a) a frequency estimation unit (260) for estimating a frequency of the signal, (b) an offset estimation unit (222) for estimating the offset in the signal by applying an adaptive low pass filter to the signal, wherein a cut-off frequency of the adaptive low pass filter is determined based on the frequency of the signal estimated by the frequency estimation unit (260), and (c) a subtraction unit (230) adapted to subtract the offset estimated by the offset estimation unit (222) from the signal. There is also described a filter unit comprising the device. Furthermore, there is described a corresponding method of removing an offset from a signal as well as a computer program and a computer program product for performing the method by means of a computer.
Claims
1. A device for removing an offset from a signal outputted by a sensor, the device comprising an output port of a comparator unit; a frequency estimation unit configured to estimate a frequency of the signal; an offset estimation unit configured to estimate the offset in the signal by applying an adaptive low pass filter to the signal, wherein a cut-off frequency of the adaptive low pass filter is determined based on the frequency of the signal estimated by the frequency estimation unit, wherein an input to the frequency estimation unit is coupled to the output port and an output of the frequency estimation unit is inputted to the adaptive low pass filter; and a subtraction unit adapted to subtract the offset estimated by the offset estimation unit from the signal wherein an input to the adaptive low pass filter is coupled to a first input to the subtraction unit and an output of the adaptive low pass filter is inputted to a second input to the subtraction unit and an output of the subtraction unit is coupled to the output port.
2. The device according to claim 1, wherein the offset estimation unit is adapted to set the cut-off frequency of the adaptive low-pass filter to the frequency of the signal estimated by the frequency estimation unit divided by a constant k.
3. The device according to claim 1, wherein the comparator unit is coupled to an output of the subtraction unit and is adapted to generate a rectangular wave alternating between a positive value and a negative value in dependency on the sign of the signal received from the subtraction unit.
4. The device according to claim 3, wherein the frequency estimation unit is adapted to estimate the frequency of the signal by measuring a pulse width of the rectangular wave generated by the comparator unit.
5. The device according to claim 1, wherein the frequency estimation unit comprises an internal clock adapted to generate a clock signal having a predetermined clock frequency fcik, and wherein the frequency estimation unit is adapted to measure a pulse width of a rectangular wave generated by the comparator unit by counting the number of clock pulses M of an internal clock signal during a pulse of the rectangular wave generated by the comparator unit.
6. The device according to claim 1, wherein the frequency estimation unit is adapted to estimate the frequency of the signal as f.sub.clk/(2*M).
7. The device according to claim 5, wherein the frequency estimation unit is adapted to set an initial value of the estimated frequency to equal a predetermined maximum frequency of the signal.
8. A magnetic sensor unit, comprising a magnetic sensor adapted to generate a sensor output signal in response to an external magnetic field, and a device according to claim 1, the device being adapted to receive the sensor output signal generated by the magnetic sensor and to remove an offset from the sensor output signal.
9. A method of removing an offset from a signal outputted by a sensor, the method comprising estimating, by using a frequency estimation unit, a frequency of the signal at an output port of a comparator unit; estimating, by using an offset estimation unit, the offset in the signal by applying an adaptive low pass filter to the signal, wherein a cut-off frequency of the adaptive low pass filter is determined based on the estimated frequency derived at the output port, of the signal; and subtracting, by using a subtracting unit, the estimated offset from the signal and outputting the subtracted signal to the output port, wherein an input to the adaptive low pass filter is coupled to a first input to the subtracting unit and an output of the adaptive low pass filter is coupled to a second input the subtracting unit.
10. A non-transitory computer readable media comprising computer executable instructions which when executed by a computer causes the computer to perform the steps of the method according to claim 9.
11. A device for removing an offset from a signal outputted by a sensor, the device comprising a frequency estimation unit configured to estimate a frequency of the signal; an offset estimation unit configured to estimate the offset in the signal by applying an adaptive low pass filter to the signal, wherein a cut-off frequency of the adaptive low pass filter is determined based on the frequency of the signal estimated by the frequency estimation unit; a subtraction unit adapted to subtract the offset estimated by the offset estimation unit from the signal; and a comparator unit, wherein the comparator unit is coupled to an output of the subtraction unit and is adapted to generate a rectangular wave alternating between a positive value and a negative value in dependency on the sign of the signal received from the subtraction unit.
12. The device according to claim 11, wherein the offset estimation unit is adapted to set the cut-off frequency of the adaptive low-pass filter to the frequency of the signal estimated by the frequency estimation unit divided by a constant k.
13. The device according to claim 11, wherein the frequency estimation unit is adapted to estimate the frequency of the signal by measuring a pulse width of the rectangular wave generated by the comparator unit.
14. The device according to claim 11, wherein the frequency estimation unit comprises an internal clock adapted to generate a clock signal having a predetermined clock frequency f.sub.clk, and wherein the frequency estimation unit is adapted to measure the pulse width of the rectangular wave generated by the comparator unit by counting the number of clock pulses M of the internal clock signal during a pulse of the rectangular wave generated by the comparator unit.
Description
BRIEF DESCRIPTION OF THE DRAWING
(1)
(2)
(3)
DETAILED DESCRIPTION
(4) The illustration in the drawing is schematic. It is noted that, unless otherwise indicated, similar or identical elements in different figures are provided with the same reference signs or with reference signs, which differ only within the first digit.
(5)
(6) The sensor unit 101 comprises a magnetic sensor 110, a low pass filter 120, a subtraction unit 130, and a comparator 140. As shown in
(7) Now, the design of the low pass filter 120 is described. Assuming that the system 101 is working in the steady state and that the low pass filter 120 is a first-order filter with pole at frequency .sub.p, the sensor signal 115 s(t) and the offset estimate 125 V.sub.OS,est(t) can be written as:
s(t)=A sin(2t+)+V.sub.OS
V.sub.OS,est(t)=A sin(2t++)+V.sub.OS
(8) where A is the amplitude of the sensor signal 115, is the frequency of the sensor signal 115, is the phase of the sensor signal 115, V.sub.OS is the sensor offset, is the attenuation of the filter 120 and is the phase-shift of the filter 120. The two latter are given by
(9)
(10) where f.sub.p is the pole frequency of the filter 120.
(11) The error on the zero-crossing can be found by imposing V.sub.OS,est(t)=s(t). In a typical application, the error e is often expressed as a fraction of the signal period T, i.e.
(12)
(13) From this, e.g. by plotting the relative error e (not shown), it can be found that the pole frequency .sub.p of the filter 120 must be a factor k lower than the signal frequency in order to limit the error, i.e.
(14)
(15) In this way, it can for example be derived that the absolute error |e|<1% for k>16.
(16) The abovementioned limitation for .sub.p ensures that the system 101 shows a low error on zero-crossing detection at steady state. However, when starting up the system, an additional source of error comes from the settling of the filter. Under the approximation that the filter 120 attenuates the AC component down to a negligible level (i.e. the filter 120 is sized as previously described), the settling can be approximated as an exponential settling during which the offset estimation of the system 101 in
|V.sub.OS,est(t)V.sub.OS|=|V.sub.OS,est(0)V.sub.OS|e.sup.t/<A sin(2.Math.DC)
(17) where is the time constant of the filter 120. The required settling time would then be:
(18)
(19) The last inequality holds if the initial state of the filter is set so that V.sub.OS,est(0)=s(0), i.e. by assuming the value of the signal at start-up as initial offset estimate. Note that under this assumption the worst case settling can be obtained for example for an initial signal phase of =/2.
(20) To compute the worst-case settling time, it should be considered that the system 101 must work over a specified range of input signal frequency, from .sub.min to .sub.max. The upper bound for the pole of the filter is fixed by the minimum frequency, i.e.
(21)
(22) The maximum number of signal cycles N.sub.max that are required for proper settling (for a fixed duty-cycle error) is instead determined by the maximum frequency:
(23)
(24) With typical parameters (e<1%, DC<10%, .sub.max/.sub.min>1000), N.sub.max>1350.
(25) Thus, if a wide range of input signal frequencies must be accommodated, a large number of cycles are required for settling in the worst case. In many applications, N.sub.max is not even allowed to be more than 1, such that the system 101 cannot be used. However, the present invention provides a solution to this problem as described in terms of the following embodiment.
(26)
(27) The sensor unit 202 comprises a sensor 210, a subtraction unit 230 and a comparator 240 respectively corresponding to the sensor 110, the subtraction unit 130 and the comparator 140 of the sensor unit 101 shown in
(28) At start-up, the output of the adaptive filter 222 is initialized to the value of the signal 215 at start-up. In other words, the offset estimate 225 is initialized to the value of the signal 215 at start-up. Since the offset superimposed on the time-varying signal can be even larger than the amplitude of the time-varying signal itself, this ensures that at start-up the error in offset estimation is limited to less than the signal amplitude.
(29) The bandwidth of the low-pass filter 222 is estimated as follows: The frequency estimation unit 260 comprises an internal clock signal generator (not shown) with predetermined frequency .sub.clk. Furthermore, the frequency estimation unit 260 comprises processor and memory (not shown) for handling two internal variables labeled N and M that are used to count and store an estimation of the duration of a half cycle of the output signal 250 in terms of internal clock cycles.
(30) At start-up, N is initialized to
(31)
(32) Then, after each cycle of the internal clock signal, N is incremented by 1 if the sign of the output signal 250 has not changed during the cycle. Otherwise, i.e. if the sign of the output signal 250 has changed during the cycle, N is reset to 1. Also, if the sign of the output signal 250 has not changed during the cycle and NM, M is left unchanged. Otherwise, if the sign of the output signal 250 has not changed during the cycle but N>M, M is set equal to N. Similarly, if the sign of the output signal 250 has changed during the cycle, M is set equal to N (irrespectively of the current values of N and M).
(33) At any time, i.e. after each cycle of the internal clock signal, the estimated frequency 265 is set to f.sub.est=f.sub.clk/(2*M). Then, upon receiving the estimated frequency 265, the adaptive filter 222 dynamically adjusts its bandwidth (i.e. cut-off frequency) to .sub.est/k, where the constant k is selected in line with the above discussion of the same with regard to the non-adaptive case shown in
(34) It is noted that the above described embodiment may be varied in various ways as required by specific implementation requirements. For example, the frequency estimation unit 260 may, instead of outputting an estimated frequency 265 to the adaptive filter 222 as described above, directly output the bandwidth .sub.est/k to the adaptive filter 222 such that the latter does not have to perform the corresponding calculation.
(35)
(36) In the simulation illustrated in
(37) Further simulations for other signal frequencies (below 10 kHz) have shown similar behaviour, i.e. that the steady-state is reached in approximately six cycles of the input signal. In case of a fixed-bandwidth system with similar performance, the settling time would (as discussed above in conjunction with
(38) It should be noted that the term comprising does not exclude other elements or steps and that the use of the articles a or an does not exclude a plurality. Also elements described in association with different embodiments may be combined. It should also be noted that reference signs in the claims should not be construed as limiting the scope of the claims.