Precise position sensing is an essential form of feedback to ensure consistent and reliable robotic motion control. Moving elements in robotic arm and autonomous mobile robot applications may experience problems such as system damage, manufacturing yield loss, and downtime if they cannot determine position at power up or they don’t receive feedback about the absolute motor position.
Thus, it’s important to ensure the existence of controls that can aid with position tracking. Magnetic sensors track the angular position of a motor shaft without being directly coupled to the motor shaft. Instead, a magnet fixed to the rotating shaft provides input to a nearby sensor.
As discussed in my previous article, mechanical misalignments and placement offsets may cause system-level errors such as wobble or eccentricity that can produce phase errors and angle nonlinearity. It was shown that device adjustments to correct for sensitivity and offset are important first steps to ensure reliable angle detection using magnetic sensing technologies.
In addition to mechanical challenges, other signal-chain-related factors such as sensitivity matching and offset can impact how the magnetic sensor processes the input magnetic field, which impacts end system accuracy. These errors influence the required calibration procedures for any particular sensor and should be considered appropriately.
Aside from offset and sensitivity errors, there are other signal-chain-related errors that affect overall system accuracy. These include noise, quantization errors, propagation delay, temperature drift, hysteresis, and crosstalk. Studying each of these will provide insight needed to help select the most appropriate sensor for an application.
As I mentioned in the first installment, the inputs must have matching amplitudes when using the arctangent to find the angle. Otherwise, the result would be similar to trying to map circular behavior using an ellipse. In Figure 1, we can observe the difference between an ideal circular input composed of X and Y components with equal magnitude. In contrast, an unequal amplitude results in an ellipse, which when used for angle calculations will produce a nonlinear result.
Figure 1 Comparison of an ideal input to input with unequal amplitude underscores the importance of matching amplitudes. Source: Texas Instruments
Even when placing the sensor in an ideal location, some variation in amplitude is still possible, perhaps resulting from sensitivity matching of the two sensor channels used to capture the magnetic field. Discrepancies in the actual sensitivity gain from the nominal case will result in some degree of angle error.
Hall-effect sensors such as TMAG5170 are capable of applying adjustments to the sensitivity of any axis. If not integrated to the sensor itself, the microprocessor controlling the system would need to manage this correction.
It’s also important to consider input-referred offset. The rotating magnet and surrounding environment might be configured in a way that creates a small measurable offset for one or both axes, resulting in a perfect circle not being centered about the origin, and will likewise result in angle error.
Figure 2 demonstrates the effect of such an offset on the y-axis input as compared to the ideal circular pattern.
Figure 2 Comparison of ideal input and input with an offset demonstrates the importance of input-referred offset. Source: Texas Instruments
Device-level offsets will produce the same effect. Regardless of the source, you should address this offset either through programmable register settings, available through Hall-effect sensors, or by storing and calculating the correction in the microprocessor used to calculate the absolute angle.
When considering the accuracy of any angle measurement, it’s important to realize that measurement noise will directly affect the quality of the angle calculation. Assuming a predictable amount of noise in the system, the easiest approach to limiting noise-related measurement errors is to maximize the signal-to-noise ratio (SNR). As the SNR increases in any measurement, the worst-case angle error for any sample will follow the trend shown in Figure 3.
Figure 3 Angle error vs. input SNR highlights the vital role of SNR in limiting noise-related measurement errors. Source: Texas Instruments
One approach to reduce SNR is to increase sampling. Oversampling and averaging have the benefit of effectively attenuating the observed noise by √n. For example, when averaging four measurements with an equivalent input signal, the effective root-mean-square noise of the measurement will be reduced by one-half. Oversampling can be difficult to implement in systems with high rotation speeds, since the motor angle will be different during each sample. The increased propagation delay will result in a fixed offset to the calculated system angle.
Another approach to address SNR is to increase the input signal magnitude, which you can accomplish in a number of ways with a magnetic sensor. The magnetic flux density from any permanent magnet is inversely proportional to the square of the distance from the magnet. Changes in air-gap distance between the sensor and magnet can have a significant effect on the input magnitude. Make sure to avoid saturating the sensor inputs, however. Hall-effect sensors typically have a maximum linear input range, and any signal outside of this region will result in severe distortion at the output of the sensor.
It’s also possible to increase the magnetic flux density by changing the magnetic material grade. If using an N35-grade neodymium magnet, for example, consider an N42- grade or N52-grade magnet.
Some sensors use a ferromagnetic structure known as a concentrator to help channel the magnetic field toward the sensing element. Using this structure to direct a larger amount of magnetic flux through the sensing element makes it possible to detect a greater input signal than otherwise possible at a similar range.
Quantization errors are the result of converting an analog signal to a digital format. The number of bits available in the data converter will have a direct impact on measurement accuracy. Consider Figure 4a and Figure 4b which show the outputs of 8-bit and 16-bit converters. For any given sample, the maximum error is approximately one-half least significant bit (LSB), which yields some uncertainty in the final measurement. The error estimations in Figure 4 assume the use of a full-scale input to calculate the resulting angle, and demonstrate the significance of quantization as a best-case scenario.
Figure 4 Effect of quantization error are shown while using 8-bit (a) and 12-bit (b) conversions. Source: Texas Instruments
Higher-bit-count conversions will result in a pronounced decrease in uncertainty during angle calculations and ultimately yield higher accuracy motor control.
The propagation delay of any sensor will influence the real-time accuracy of magnetic field conversion. A sensor must respond to the input stimuli to produce a useful result for the microcontroller. As the motor speed increases, the propagation delay will result in an angular error proportional to the speed of the motor. Applying this delay with the known motor speed to predict angular position can help the controller act in time to avoid unnecessary overshoot in the final driven position.
An important characteristic of any magnet is temperature drift. It’s a well-known phenomenon that the magnetic field of a magnet will weaken as the temperature increases. The degree by which this change occurs can vary with magnetic material. Table 1 lists some typical values.
Table 1 Temperature coefficients are shown for common magnetic materials. Source: Texas Instruments
To counter this diminished magnetic field strength, it’s helpful to use a sensor with temperature compensation equal in magnitude to this effect, but in the positive direction. For instance, Hall-effect sensors such as TMAG5170 and TMAG5273 have programmable temperature compensation settings of 0%/°C, +0.12%/°C and +0.2%/°C, which can help offset the drift of the magnet and help stabilize the system across all operating temperatures.
Magnetic hysteresis is an effect that results in output signal-magnitude variance based on the rotational direction of the magnet. While a magnetic concentrator has an advantage of gathering more magnetic flux for the sensing element, it also tends to experience a negative impact from this effect. It’s caused by the temporary magnetization of the concentrator itself, as might be described by the magnetic hysteresis loop which is commonly referred to as a B-H curve and is depicted in Figure 5. The B-H curve describes the remanence of a ferromagnetic material when exposed to a changing external magnetic field.
Figure 5 An example B-H curve is shown for a ferromagnetic material. Source: Texas Instruments
For materials affected by magnetic hysteresis, some of the magnetic dipoles within the material can retain the alignment caused by the presence of an external magnetic field, which influences the observable input at the sensor based on the previous state of the rotating magnet. Tunnel magneto-resistive and giant magneto-resistive sensors are prone to magnetic hysteresis, given the complex internal structures involved with each technology.
Hysteresis often requires calibration measurements, taken by rotating the magnet both clockwise and counter-clockwise to establish a proper correction for either direction.
Cross-axis sensitivity errors
Cross-axis sensitivity errors are device-level errors in which the input from one data channel couples into the nearby circuitry of an adjacent sensor channel, resulting in nonlinearity of the sensor inputs. Cross-axis sensitivity errors are of particular concern in sensors with multiple sensing elements in a single package with parallel sensing structures. Any distortion of the sinusoidal input will result in a cyclical angle error. Additionally, sensors that use magnetic concentrators also tend to suffer from an increased amount of crosstalk.
Sensors that interleave channel measurements effectively eliminate this effect by multiplexing measurements through a single converter for a serial result. The trade-off of this approach is increased propagation delay. Sensors that sample simultaneously should be designed to minimize any channel-to-channel interactions. Otherwise, it becomes necessary for the end user to characterize the crosstalk observed in the sensor output measurements by applying complex correction algorithms that predict the influence each input channel will have on the other field components.
Planning around errors
Understanding the various sources of error when configuring an angle encoder for robotic control or other motorized functions can help you reach early success. Planning around errors inherent to measurement systems enables you take actions that help reach optimal position tolerances at all times. Additionally, taking steps to prevent excess noise or quantization errors will improve resolution of absolute position calculations for more repeatable and robust robotic control.
I also recommend conducting thermal testing to confirm reliable operation in all working conditions. For systems that cannot support a complex calibration routine, selecting components that are not prone to crosstalk or hysteresis will simplify the steps needed to achieve peak performance. For all angle-sensing systems, carefully assessing signal-chain errors at the beginning of the design process can help you establish a successful project flow.
Scott Bryson is applications engineer for position sensing designs at Texas Instruments.
- Magnetic Sensors for Motion Control
- What About Reliability of Magnetic Position Sensor?
- Magnetic position sensing for precision control in robotics
- Miniaturized position sensor aims to replace potentiometer
- Position sensor for contactless magnetic field measurement