Next Article in Journal
Node Distribution Optimization in Positioning Sensor Networks through Memetic Algorithms in Urban Scenarios
Previous Article in Journal
Detection of Hotspots and Performance Deteriotations in PV Modules under Partial Shading Conditions Using Infrared Thermography
Order Article Reprints
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Proceeding Paper

Computationally Efficient Magnetic Position System Calibration †

Silicon Austria Labs GmbH, Europastraße 12, 9524 Villach/St. Magdalen, Austria
Infineon Technologies Austria, Siemensstraße 2, 9500 Villach, Austria
Infineon Technologies AG, Am Campeon 1-15, 85579 Neubiberg, Germany
Author to whom correspondence should be addressed.
Presented at the 7th Electronic Conference on Sensors and Applications, 15–30 November 2020; Available online:
Eng. Proc. 2020, 2(1), 72;
Published: 14 November 2020
(This article belongs to the Proceedings of 7th International Electronic Conference on Sensors and Applications)


Properties such as high resolution, contactless (and thus wear-free) measurement, low power consumption, robustness against temperature and contamination as well as low cost make magnetic position and orientation systems appealing for a large number of industrial applications. Nevertheless, one major practical challenge is their sensitivity to fabrication tolerances. In this work, we propose a novel method for magnetic position system calibration based on the analytical computation of the magnetic field and on the application of an evolutionary optimization algorithm. This scheme enables the calibration of more than 10 degrees of freedom within a few seconds on standard quad-core ×86 processors, and is demonstrated by calibrating a highly cost-efficient 3D-printed 3-axis magnetic joystick.

1. Introduction

1.1. Background

Magnetic position and orientation (MPO) sensor systems generally consist of permanent magnets that move relative to magnetic field sensors, which allow for the motion to be determined from the sensor output. They are widely used in the industry to track movements in mechanical systems, having typical motion ranges of a few millimeters up to several centimeters [1,2]. Applications include linear position detection in gear shifts, gas and brake pedals [3], hydraulic and pneumatic cylinders [4], angular position sensing for shaft rotation and wheel speed (in the gear box or for transmission [5]). They can also be employed for joystick position detection [6], as well as for more complex motion tracking of six degrees of freedom [7], which is exploited, for instance, in medical diagnostic applications [8].
Magnetic position sensing principles are remarkably competitive. The non-contact operation makes them practically wear-free and results in long lifetimes, extending up to decades. Magnetostatic field propagation through media such as water, oil dust and dirt makes MPO systems very robust for application in harsh environments like machinery without the need for expensive contamination controls [1]. Combined with the cheap and available fully CMOS-integrated sensor technology [9], MPO systems can provide high resolutions at unmatched cost-efficiency.

1.2. Problem and Motivation

The development of MPO systems is an ongoing theoretical and experimental effort dealing mostly with stray field robustness [10], system fabrication tolerances and combining the signals of multiple sensors with sophisticated algorithms [7]. While such complex implementations can achieve a high level of precision and stability, they often neglect the production cost factor, which is a critical aspect for industrial applications. In this context, the Mini-Drive system was proposed to detect the motion of a 3-axis joystick using only a single 3D-sensor and a single magnet [11,12]. However, like with most MPO systems, the major drawback lies in the difficulty to cope with system fabrication tolerances: a high-precision device manufacture would indeed immediately cancel the cost advantage.
In this paper, we extend previous works [13] to show that—despite imprecise fabrication and cheap sensing technology—Mini-Drive-based position systems can be effectively realized by applying a user-friendly, fast and computationally inexpensive calibration algorithm, thereby successfully addressing the industrial demand for maximal cost-efficiency.

2. Methods

2.1. The Mini-Drive Implementation

The Mini-Drive represents a specific implementation of a novel concept for a continuously moving 1-sensor 1-magnet 3-axis joystick referred to as MJ113 [14]. In the original theoretical proposal [11], the motion of a joystick lever that can rotate about its own axis is detected, thereby combining 2D tilt motion with a rotation degree of freedom. Similarly to the BMW iDrive system [15], only 5 discrete tilt states are detected, namely the central position and the full tilt in each of the four directions.
A one-to-one correspondence between the mechanical states and the sensor output is achieved by fixing a magnet at the end of the joystick lever with a lateral displacement with respect to the rotation axis and with its magnetization perpendicular both to this sideways displacement and to the lever axis. A 3D-magnetic field sensor is placed centrally below, as outlined in the system sketch in Figure 1. This unique arrangement is patented by Infineon Technologies [12]. For each tilt state, a full mechanical rotation of the lever corresponds to a closed loop in the magnetic state space (see Figure 1c). The specific system layout ensures that these loops are maximally separated from each other and that their corresponding field amplitudes can be measured by the sensor below [11].
While continuous detection of the system rotation state is in principle possible, in this work, we are only interested in measuring reasonable steps of 2/3/5/10 degrees, corresponding to 180/120/72/36 states per loop, respectively. The original BMW iDrive system is limited to 28 states per loop.

2.2. System Fabrication

The mechanical components of the Mini-Drive are manufactured using a high-resolution 3D Systems HiQ + HS industrial 3D printer and a polyamide-based powder (PA2200) as printing material, which makes the fabrication very cost-effective. The design follows the original proposal by [16].
Figure 2 shows the individual components as well as the assembled device from different perspectives. The joystick lever is endowed with a center ball which defines the center of tilt and allows for full rotation of the lever about its axis. A cross-shaped cavity in the upper half of the device housing limits the possible tilts to four discrete directions only. The center ball is pressed into a circular cavity of the lower housing by a “hat”. The force is generated by printed springs in the upper housing such that the lever recovers its zero-tilt position as soon as the user releases it. An off-the-shelf cubical NdFeB permanent magnet is embedded in a cavity at the bottom of the lever. Finally, an Infineon XMC2Go test board [17] is integrated in the system in such a way that its TLV493D-A1B6 3D Hall magnetic field sensor [18] is located directly below the magnet and lies on the axis of rotation of the joystick lever. The low-cost 3D Hall sensor features a small PG-TSOP6-6 package ( 2.9× 1.6× 1.1 mm 3 ), low power consumption, various digital signal compensations, 12-bit data resolution in each direction and a measurement range of ±130 mT.

2.3. Read-Out

While it is relatively easy to compute the magnetic field generated by a permanent magnet in a given position in space, the inverse problem—i.e., determining the magnet position starting from a magnetic field measurement—is often mathematically ill-posed and computationally demanding [19,20]. One of the biggest challenges of MPO system design is to solve the inverse problem within milliseconds to enable real-time measurement and interaction. To make things even more difficult, there are generally no computation resources available beyond the sensor ICs or microcontrollers. Most state-of-the-art systems solve this problem by approximating the field with simple functions that are easily invertible, as for instance the a r c t a n 2 -function in linear position applications [3,4]. Such approximations are only suitable for systems with few degrees of freedom, whereas more sophisticated systems perform direct numerical inversion on 3D approximations of the field, that are based either on analytical solutions of permanent magnet problems or on simple look-up tables [7,8].
The Mini-Drive read-out is based on a look-up table, which is highly efficient thanks to the small state space (only five loops with 36 to 180 rotation states each, see Section 2.1). The inversion is computed by direct comparison between the measurement and the look-up table, which takes only a few milliseconds on the XMC-1100 microcontroller.

2.4. Calibration Procedure

Several system tolerances arise from the cheap Mini-Drive fabrication, including variations in the position and orientation of magnet and sensor and inaccuracies in the joystick positioning, rotation and tilt. Moreover, imprecise magnetization of the magnet also affects the system, along with variations of the sensor characteristics or environmental disturbances. In order to eliminate the influence of the major tolerances, we propose a simple procedure in which the user is asked to provide four well-separated measurement points for each magnetic loop. As the absolute rotational positions are not required, such calibration data are easily generated via four consecutive 90 rotations, each followed by one tilt in all directions. A detailed description of the user calibration scheme is reported in [21].
The calibration task consists of fitting the magnetic loops onto the calibration data by variation of the system tolerances. Our implementation combines a differential evolution optimizer [22] with an analytical computation of the field of cuboid permanent magnets [23]. The cost function to be minimized via least squares fitting is based on a badness value, which is defined for all states as the ratio of the distance from the correct loop to the distance from the nearest incorrect loop. This cost function choice ensures that the correct tilt states are favoured over the incorrect ones.
The fields are computed using the Magpylib toolbox [24], which provides a user-friendly Python interface, specifically designed for dealing with MPO systems. Comparison to finite element computations shows that the relative error of the Magpylib analytical solution is less than 1%. One of the main reasons for choosing a cuboid permanent magnet is that the analytical solution for the field is a closed-form expression and a vectorized implementation of its results is achieved within effective computation times of a few microseconds on standard ×86 CPUs [24]. The fast computation times granted by this approach are necessary to feed the evolutionary optimizer which, in turn, can draw additional performance from multi-processing. This implementation can compute 8–12 tolerances within few seconds on simple mobile hardware like an Intel core i5-8365U.
The calibration yields a set of tolerances that can then be used to compute the five magnetic loops for the creation of a look-up table of arbitrary rotational discretization. It is critical to note that curve fitting based on more calibration data is not a viable option, as the rotational states are not equally spaced on the magnetic loops and the calibration data have no absolute rotational position.

3. Results and Discussion

3.1. Measurements

Figure 2a shows the main geometrical parameters of the Mini-Drive: the distance from the center of tilt d C o T (measured between the upper surface of the magnet and the geometrical center of the centerball), the magnet lateral displacement x d i s p l (defined as the distance between the lever axis and the vertical plane cutting the magnet in a half), the airgap Δ (namely the distance between the magnet lower face and the sensitive area of the TLV493D-A1B6 sensor, located 0.65 mm below its packaging [18]) and the maximum tilt angle θ m a x . A batch of 15 Mini-Drives was 3D-printed with the following nominal features: d C o T = 6.3 mm, x d i s p l = 3 mm, Δ = 3 mm and θ m a x = 10 . The corresponding uncertainties are δ d C o T = 0.3 mm, δ x d i s p l = 0.1 mm, δ Δ = 0.3 mm and δ θ m a x = 0 . 2 , respectively (as inferred from repeated length measurements performed on the devices). The side length of the cubical magnet is l = 5 mm with an error δ l = 0.1 mm (as provided by the supplier).
In order to gain an insight into the influence of the fabrication tolerances, for each device the magnetic field components were recorded 200 times for every individual tilt state, while manually rotating the joystick lever around its axis. The points in Figure 3b refer to a single Mini-Drive, whereas Figure 3a displays the measurement output from all the joysticks: due to the fabrication tolerances, large variations can be observed among the states of the various devices in the magnetic field space.

3.2. Calibration

The result of a calibration which includes magnet position (3 degrees of freedom, DoFs), magnet magnetization (3 DoFs), tilt angles (4 DoFs) and sensor position (3 DoFs) is shown in Figure 3c. For each tilt state, 50 magnetic field measurements are recorded and their distance to the respective theoretical loops is displayed in mT. Cross markers correspond to the uncalibrated states, while circular markers refer to the calibrated ones after the application of the 4-point procedure outlined in Section 2.4. The orange region marks the nearest incorrect tilt state. As many uncalibrated states lie above this false-tilt threshold, the uncalibrated system would yield incorrect outputs. The calibrated states, on the contrary, lie much closer to the correct loops (<8 mT) than the wrong ones (>17 mT), thereby making their exact identification a simple task.
Still, it seems that the calibrated states can lie quite far (3–8 mT) from their designated circles, see e.g., the yellow peaks between position 150 and 200 in Figure 3c. This is due to both the cheap mechanics and to the fact that the user moves the joystick by hand to collect the data. The result of a full calibration where all the 250 measurement points are used in the algorithm instead of only 4 per loop is indicated by the black solid line and the gray region. By comparison, we can conclude that the 4-point calibration is surprisingly efficient, as the best possible result is mostly achieved. The use of less than 4 points proved unstable for the calibration, while the employment of more points did not bring any significant improvement.

4. Conclusions

In this work, we reported on the successful application of a novel scheme based on analytical methods for the calibration of a 3-axis magnetic joystick—the Mini-Drive—manufactured via 3D printing. This calibration method makes use of the analytical solution for the magnetic field and—taking advantage of the fast analytical field computation—applies a differential evolution algorithm to solve a multivariate optimization problem that includes multiple relevant fabrication tolerances. The calibration procedure requires the measurement of only four points for each tilt with unknown rotational position, which is easily and quickly carried out by an end-user.
This novel scheme enables the calibration of more than 10 degrees of freedom within a few seconds on conventional PCs, thereby making it possible to cope with the fabrication tolerances without the need to resort to a high-precision manufacture that would nullify the cost-efficiency of the system. Ongoing work is devoted to study the potential of this method for the design and calibration of innovative, exotic and inexpensive magnetic position systems.

Author Contributions

M.O. and D.S. developed the initial idea of “one magnet-one sensor” joystick system. S.L., M.O., D.S. and S.Z. contributed to the further development of the Mini-Drive design. S.L. collected the experimental data. S.L. and M.O. carried out the data analysis. M.O. conceived the novel calibration scheme. M.O. and P.M. developed the code for the calibration of the devices. S.L. and M.O. wrote the paper. All authors have read and agreed to the published version of the manuscript.


This project has been supported by the COMET K1 centre ASSIC Austrian Smart Systems Integration Research Center. The COMET (Competence Centers for Excellent Technologies) Program is supported by BMVIT, BMWFW and the federal provinces of Carinthia and Styria.

Conflicts of Interest

The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript, or in the decision to publish the results.


  1. Treutler, C.P.O. Magnetic sensors for automotive applications. Sens. Actuators A Phys. 2001, 91, 2–6. [Google Scholar] [CrossRef]
  2. Granig, W.; Hartmann, S.; Köppl, B. Performance and technology comparison of GMR versus commonly used angle sensor principles for automotive applications. SAE Trans. 2007, 116, 29–41. [Google Scholar]
  3. Ortner, M.; Ribeiro, M.; Spitzer, D. Absolute Long-Range Linear Position System With a Single 3-D Magnetic Field Sensor. IEEE Trans. Magn. 2018, 55, 1–4. [Google Scholar] [CrossRef]
  4. Hohe, H.; Sauerer, J. Robuste Positionsmessung in Hydraulik-und Pneumatikzylindern. Mechatronik 2008, 11, 60–63. [Google Scholar]
  5. Ausserlechner, U. Magnetic Angle Sensors. In Magnetic Sensors and Devices: Technologies and Applications; Poletkin, K., Francis, L.A., Eds.; CRC-Press: Boca Raton, FL, USA, 2017; pp. 201–250. [Google Scholar]
  6. Marshall, S.; Alexander, A.J.; Ashraf, M.M. Joystick Controller Using Magnetic Position Sensors and a Resilient Control Arm with Sensor Used to Measure its Flex. U.S. Patent 5,831,596, 3 November 1998. [Google Scholar]
  7. Cichon, D.; Psiuk, R.; Brauer, H.; Töpfer, H. A Hall-sensor-based localization method with six degrees of freedom using unscented Kalman filter. IEEE Sens. J. 2019, 19, 2509–2516. [Google Scholar] [CrossRef]
  8. Popek, K.M.; Schmid, T.; Abbott, J.J. Six-degree-of-freedom localization of an untethered magnetic capsule using a single rotating magnetic dipole. IEEE Robot. Autom. Lett. 2016, 2, 305–312. [Google Scholar] [CrossRef]
  9. Kejik, P.; Schurig, E.; Bergsma, F.; Popovic, R.S. First fully CMOS-integrated 3D Hall probe. In Proceedings of the 13th International Conference on Solid-State Sensors, Actuators and Microsystems, Seoul, Korea, 5–9 June 2005; Volume 1, pp. 317–320. [Google Scholar]
  10. Huber, S.; Burssens, J.-W.; Dupré, N.; Dubrulle, O.; Bidaux, Y.; Close, G.; Schott, C. A gradiometric magnetic sensor system for stray-field-immune rotary position sensing in harsh environment. Multidiscip. Digit. Publ. Inst. Proc. 2018, 2, 809. [Google Scholar]
  11. Ermakova, A.; Ribeiro, M.; Spitzer, D.; Ortner, M. Analytical Development of a Four-Axis Magnetic Multimedia Control Element. IEEE Sens. J. 2018, 18, 7819–7825. [Google Scholar] [CrossRef]
  12. Ortner, M. Magnetic Multimedia Control Element. U.S. Patent 10,048,091, 14 August 2018. [Google Scholar]
  13. Ortner, M.; Malagò, P.; Lumetti, S.; Spitzer, D.; Zaruba, S. Analytic Method for Magnetic System Calibration. SMSI Sens. Instrument. A1 Magnet. Sens. 2020, 41–42. [Google Scholar]
  14. Malagò, P.; Lumetti, S.; Herzog, S.; Pellegrinetti, A.; Ortner, M. Realizing a magnetic 3-axis joystick with a single sensor. Sensors 2020. submitted. [Google Scholar]
  15. Suchy, J.; Paces, P. BMW iDrive automotive hid device in EFIS control. In Proceedings of the 2014 IEEE/AIAA 33rd Digital Avionics Systems Conference (DASC), Colorado Springs, CO, USA, 5–9 October 2014; pp. 2D3-1–2D3-11. [Google Scholar]
  16. Da Silva, A.H. Implementação de um Joystick Magnético de Três Eixos e Software de Demonstração Gráfica. Master’s Thesis, Instituto Federal Santa Catarina, Santa Catarina, Brazil, 2019. [Google Scholar]
  17. Infineon 3D Magnetic Sensor 2 Go evaluation Kit. Available online: (accessed on 30 November 2020).
  18. Infineon TLV493D-A1B6 3D Magnetic Sensor Datasheet. Available online: (accessed on 30 November 2020).
  19. Bablan, A.L.; Bakhvalov, Y.A.; Denisov, P.A. Review of methods for solving inverse problems in identifying permanent magnets of executive elements in dynamic devices. MATEC Web Conf. 2018, 226, 04022. [Google Scholar] [CrossRef]
  20. Bruckner, F.; Abert, C.; Wautischer, G.; Huber, C.; Vogler, C.; Hinze, M.; Süss, D. Solving large-scale inverse magnetostatic problems using the adjoint method. Sci. Rep. 2017, 7, 40816. [Google Scholar] [CrossRef] [PubMed]
  21. Available online:. Available online: (accessed on 30 November 2020).
  22. Storn, R. On the usage of differential evolution for function optimization. In Proceedings of the North American Fuzzy Information Processing, Berkeley, CA, USA, 19–22 June 1996; pp. 519–523. [Google Scholar]
  23. Camacho, J.M.; Sosa, V. Alternative method to calculate the magnetic field of permanent magnets with azimuthal symmetry. Rev. Mex. Fis. E 2013, 59, 8–17. [Google Scholar]
  24. Ortner, M.; Coliado Bandeira, L.G. Magpylib: A free Python package for magnetic field computation. SoftwareX 2020, 11, 100466. [Google Scholar] [CrossRef]
Figure 1. (a) Schematics of the Mini-Drive structure. (b) Sketch of the Mini-Drive mechanical implementation. The five colored dots correspond to the five discrete states that the system is able to detect. (c) Magnetic field at the sensor position for a 360 rotation for each tilt state. The color code for the system states is the same as in (b).
Figure 1. (a) Schematics of the Mini-Drive structure. (b) Sketch of the Mini-Drive mechanical implementation. The five colored dots correspond to the five discrete states that the system is able to detect. (c) Magnetic field at the sensor position for a 360 rotation for each tilt state. The color code for the system states is the same as in (b).
Engproc 02 00072 g001
Figure 2. (a) Cross section and exploded view of the Mini-Drive. (b) Pictures of the assembled and disassembled Mini-Drive taken from different perspectives.
Figure 2. (a) Cross section and exploded view of the Mini-Drive. (b) Pictures of the assembled and disassembled Mini-Drive taken from different perspectives.
Engproc 02 00072 g002
Figure 3. (a) Magnetic loop measurements of all 15 devices projected onto the ( B x , B y ) plane. Uncalibrated theoretical predictions in black. (b) Magnetic loop measurements of a single device projected onto the ( B x , B y ) plane. Theoretical predictions for uncalibrated (dashed) and calibrated (solid) system in black. (c) Analysis of the 4-point calibration in terms of distance of the measurement from the theoretical loops for 50 random measurements per tilt. Distance to the nearest incorrect loop in orange and distance to the best possible 50-point calibrated loops in black.
Figure 3. (a) Magnetic loop measurements of all 15 devices projected onto the ( B x , B y ) plane. Uncalibrated theoretical predictions in black. (b) Magnetic loop measurements of a single device projected onto the ( B x , B y ) plane. Theoretical predictions for uncalibrated (dashed) and calibrated (solid) system in black. (c) Analysis of the 4-point calibration in terms of distance of the measurement from the theoretical loops for 50 random measurements per tilt. Distance to the nearest incorrect loop in orange and distance to the best possible 50-point calibrated loops in black.
Engproc 02 00072 g003
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Lumetti, S.; Malagò, P.; Spitzer, D.; Zaruba, S.; Ortner, M. Computationally Efficient Magnetic Position System Calibration. Eng. Proc. 2020, 2, 72.

AMA Style

Lumetti S, Malagò P, Spitzer D, Zaruba S, Ortner M. Computationally Efficient Magnetic Position System Calibration. Engineering Proceedings. 2020; 2(1):72.

Chicago/Turabian Style

Lumetti, Stefano, Perla Malagò, Dietmar Spitzer, Sigmund Zaruba, and Michael Ortner. 2020. "Computationally Efficient Magnetic Position System Calibration" Engineering Proceedings 2, no. 1: 72.

Article Metrics

Back to TopTop