The ability to monitor the position of a moving object and provide feedback to a microcontroller improves mechanical precision and adds to the overall utility and quality of any mechanism. Depending on the motion being tracked and the format of the system feedback, a variety of sensing options are available.
When Hall effect sensors are used for this purpose, position encoding becomes a contact-free solution capable of detecting motion of objects moving freely in almost any environment.
Of particular interest, 3D Hall effect sensors offer a unique ability to provide information about the complete magnetic field, which enables absolute position detection for any 3D movement. This makes these devices particularly valuable for a wide variety of position sensing applications such as joysticks, linear position modules in automated systems, and gear shifters as a few examples.
When considering a 3D Hall effect sensor, the immediate thought is that any magnet moving in free space about the sensor could be easily detected and monitored. If we consider that there is often symmetry of the magnetic field about the pole of a magnet, then we can quickly deduce that there might be multiple positions that could produce the same input condition. As a result, this function does require careful planning in order to successfully determine absolute position.
Any dipole magnet might be used for this purpose, and efforts to manually position the magnet around a sensor will produce changes along each axis. The challenge, however, is ensuring that the change in magnetic flux density can be used to distinguish the motion of the magnet.
Inspecting the vector lines closely, two relative positions appear to solve this challenge. Placing the sensor centered on the axis of polarization provides an input to the sensor which is easily identified and unidirectional regardless of distance to the magnet. Similarly, placement coplanar with the pole boundary will produce this same effect. At this location, the vector will be parallel to the face of the magnet irrespective of the range to the sensor.
These two locations are most easily aligned to the sensor and therefore provide the simplest means to demonstrate this concept.
In the case where the sensor is oriented along the axis of the cylindrical magnet, we might then determine the proximity to the magnet by examining the magnitude of the input field and calculating distance using Equation 1
Similarly, this might be done using a block magnet using Equation 2
Based on these calculations, we can now determine the magnetic flux density anywhere along a line following the polarization of the magnet. This relationship can be used to track the magnet position as it moves away from or towards the sensor. The one requirement will be, however, that the pole of the magnet is always oriented towards the sensor. When the magnet is perfectly aligned to the z axis of the sensor, this orientation is typical to what might be used with a one dimensional sensor. In many instances it is necessary to add a second degree of freedom. Rotating the magnet about the sensor at a fixed distance will maintain a fixed magnitude of magnetic flux density, but the vector will now be pointing in another direction. Placing the magnet anywhere along the surface of an imaginary sphere about the sensor with the pole directed radially inward will result with a constant magnitude vector when measured using a 3D Hall effect sensor.
The total magnitude of magnetic flux density is shown in Equation 3
Calculating backwards using Equations 1 and 3 it is possible to determine the radius,r, from the sensor. We can also use the relative magnitudes of X,Y,and Z components of the B field to determine both φ and θ to complete the position calculation in a spherical geometry as depicted in Figure 1-3. This can also be transformed to a Cartesian reference as needed.
As a demonstration of this motion, consider the orbital joystick pictured in Figure 1-4. Here the magnet may be mounted to a sliding screw which can be turned to adjust the range to the sensor. The slider will guide the magnet up and down the curved arm in the θ direction. Additionally, the arm is able to rotate about the sensor 360° in the φ direction.
As an example, we can capture data as the magnet is rotated about the sensor and produce a plot of magnet location about the sensor. Figure 1-5 is a 3D plot showing the locations of samples captured as the magnet is moved about the sensor based on the input magnetic flux density. Slight variations in radius can occur due to mechanical flex of the plastic and assembly tolerances. Allowing for these variations, position of the magnet is simple to extract from the output data in order to provide position tracking across a wide range of motion.
This attachment was designed to connect to the TMAG5170 EVM and 3D design files are available at Orbital Design Files.
Hall effect sensors are similarly suitable to adapt to a joystick function. A 4-position joystick might be designed using a magnet at the end of a pivoting shaft shown in Figure 1-6. A simplistic design for this control can be setup using a Hall effect switch, such as DRV5032, for each position in order to detect the tilt of magnet.
When carefully placed, each sensor will only receive enough input magnetic flux density when the magnet is tilted in its direction. This way, each joystick position will correlate only to a single sensor. The significant benefit of this over electro-mechanical systems is that the Hall effect sensor is contact-free and reduces the total number of mechanical fail points.
A drawback of this configuration is that the position information is binary in nature. With each position either on or off, it is impossible to determine the degree of tilt. To maintain the 4 direction joystick, but to add magnitude as well, it is possible to replace each of the DRV5032 switches with a DRV5055. DRV5055 is capable of producing a linear output with respect to the magnitude of the magnetic field input. With this change, each sensor will now produce a variable output which might be used to determine how far the joystick has been rocked in any of the four directions.
To expand this concept further, a single TMAG5170 is capable of determining both tilt and angle. If the magnet was switched to a spherical shape, it would now be possible to minimize the overall design size by using the magnet itself as a mechanical pivot. See Figure 1-7 for an example of how this is done.
With the pole of the magnet directed down towards the sensor, the field will be directed entirely along the z-axis. Then as the magnet tilts any direction, there will be a resulting portion of the vector with x and y components. Here we can determine the magnitude of the tilt by calculating magnitude using only the X and Y components.
Additionally the angle might be calculated using the arc-tangent function using both the x and y components as inputs.
The further that this magnet is tilted, the greater the resulting magnitude for these axes will be. The end result is a very simple mechanism which quickly and easily determines tilt magnitude and angle.
This attachment was designed to connect to the TMAG5170 EVM and 3D design files are available at Joystick Design Files.
|DRV5055||Commercial (Automotive) single axis bipolar linear Hall-effect sensor with Analog output available in SOT-23 and TO-92 packages||Analog outputs are subject to electrical noise and calculations require MCU computations. Single axis sensitivity constrains the ability to track movement in free space.|
|DRV5056||Commercial (Automotive) single axis unipolar linear Hall-effect sensor with Analog output available in SOT-23 and TO-92 packages||Analog outputs are subject to electrical noise and require MCU computations. Positive value sensitivity on a single axis greatly constrains the ability to track movement in free space.|
|DRV5057||Commercial (Automotive) single axis bipolar linear Hall-effect sensor with PWM output available in SOT-23 and TO-92 packages||PWM outputs require conversion, but are less susceptible to coupled noise. Single axis sensitivity constrains the ability to track movement in free space.|
|DRV5032||Unipolar or Bipolar single axis Hall-effect switch available in SOT-23, TO-92, or X2SON packages||Hall-effect switches are useful for discrete position tracking, such as the 4 direction joystick function. This device is a low power Hall effect sensor ideal for battery powered applications.|
|TMAG5170-Q1||Automotive grade linear 3D Hall-effect position sensor with SPI interface available in 8 pin DGK package|
Complete magnetic vector senstivity. This device is able to track a wide range of magnet positions, though careful planning is still required to ensure all input conditions map to a unique position.
|TMAG5273||Linear 3D Hall-effect position sensor with I2C interface available in 6 pin SOT-23 package||Similar to the TMAG5170, but operates over I2C with wider sensitivity tolerance specifications.|
|Linear Hall Effect Sensor Array Design||A guide to designing sensor arrays for tracking motion across long paths|
|Intro to linear Hall effect sensors: Achieve contactless accurate position sensing||A discussion on the differences between a linear output and switched output Hall effect sensors.|
|What is a Hall-effect sensor?||A discussion about the Hall-effect and how it is used to create magnetic sensors|
|Angle Measurement With Multi-Axis Hall-effect Sensors||A guide to monitoring absolute angle position using a 3D Hall effect sensor|
|TMAG5170 EVM||GUI and attachments incorporate angle measurement using a precise three dimensional linear Hall-effect sensor|
|TAMG5273 EVM||GUI and attachments incorporate angle measurement using a three dimensional linear Hall-effect sensor|
|TI Precision Labs - Magnetic Sensors||A helpful video series describing the Hall effect and how it is used in various applications|