TECHNICAL FIELD

The present invention relates to a method of determining an absolute angle of a magnetic field. The invention also relates to a digital signal processor for carrying out the method.

BACKGROUND OF THE INVENTION

A typical system for detecting an angle of a magnetic field uses at least two magnetic sensors to detect two orthogonal components Bx and Bz of the magnetic field. The analogue magnetic field signals are converted in an analogue-to-digital converter (ADC) into digital signals (samples) before digital processing in a microcontroller. The microcontroller typically uses a formula arctan(Bx/Bz) for calculating the angle. However, using the arctan equation is problematic as the signals of Bx and Bz involve measurement errors, which have a strong effect on the resulting angle. To mitigate this problem, the signals Bx and Bz have to be encoded in high number of bits, which is also not optimal. This would also mean that the ADC would require a long conversion time or complex implementation. Furthermore, implementing the arctan computation is complex.

SUMMARY OF THE INVENTION

An object of the present invention is to overcome at least some of the above shortcomings of the existing solutions of determining the angle of a magnetic field.

According to a first aspect of the invention, there is provided a method of determining an absolute angle of a magnetic field, the method comprising the following steps carried out by a digital signal processor:receiving a first digital measurement value of a first magnetic field component, referred to as Bx, indicating intensity of the magnetic field along a first axis,receiving a second digital measurement value of a second magnetic field component, referred to as Bz, indicating intensity of the magnetic field along a second axis, orthogonal to the first axis,determining absolute values for the first and second magnetic field components, anddetermining the angle of the magnetic field with respect to the first or second axis, wherein the angle is determined so that the angle is derivable from the value of arcsin of Bz or of its approximation, when the absolute value of Bz≤ the absolute value of Bx, and derivable from the value of arccos of Bx or of its approximation, when the absolute value of Bz> the absolute value of Bx.

The proposed solution has the advantage that it minimises the impact of measurement errors contained in the samples on the final angle by avoiding a division of Bx/Bz (propagation of measurement errors). The present invention also reduces the number of bits required to encode the magnetic field components Bx and Bz. In many existing solutions, the magnetic field components Bx and Bz must be represented with enough bits to cover the values for 0 to 359 degrees. In the present invention, it is possible to consider the magnetic field components Bx and Bz only for limited intervals of degrees. The number of bits needed to encode the samples Bx and Bz (precision) may thus be reduced compared to existing angle determination solutions. This reduces the digital signal processor (DSP) parallelism or computational needs. Moreover, if the entire system in which the DSP is instantiated is considered, it leads to a relaxation of the requirement for the ADC in terms of complexity and/or conversion time. The use of the samples that have the smaller absolute value reduces further the impact of the measurement errors (trigonometrical reasons).

Furthermore, if the present invention uses one or more lookup tables (LUTs) for the angle determination, then the proposed solution simplifies the computations needed for the angle determination. It is to be noted that most of the existing solutions rely on the complex implementation of the arctan function. In other words, the existing solutions require a lot of on-chip area and greater power consumption. Instead, the proposed solution leads to reduced power consumption and area needed on chip by exploiting the optional lookup tables instead of implementing arcsin or arccos arithmetic blocks. The LUT based solution may have a relatively small number of entries in the table: depending on the application, at most 90 entries or more, even though often 45 are enough. This reduces further the occupied area on chip and reduces the time to perform the search in the LUT(s).

According to a second aspect of the invention, there is provided a digital signal processor for determining an absolute angle of a magnetic field, the digital signal processor comprising means for:receiving a first digital measurement value of a first magnetic field component, referred to as Bx, indicating intensity of the magnetic field along a first axis,receiving a second digital measurement value of a second magnetic field component, referred to as Bz, indicating intensity of the magnetic field along a second axis, orthogonal to the first axis,determining absolute values for the first and second magnetic field components, anddetermining the angle of the magnetic field with respect to the first or second axis, wherein the angle is arranged to be determined so that the angle is derivable from the value of arcsin of Bz or of its approximation, when the absolute value of Bz≤ the absolute value of Bx, and derivable from the value of arccos of Bx or of its approximation, when the absolute value of Bz> the absolute value of Bx.

According to a third aspect of the invention, there is provided a system comprising the digital signal processor and further comprising a first magnetic sensor for measuring the first magnetic field component, a second magnetic sensor for measuring the second magnetic field component, and an analogue-to-digital converter for converting analogue measurements signals of the first and second magnetic sensors to the first and second digital measurement values.

Other aspects of the invention are recited in the dependent claims attached hereto.

