# Magnet encoder accuracy problem

I am using a magnet encoder chip AS5147 and I chose to use SPI to read the output position of a gearbox connected to a motor. The position resolution is claimed to be 14-bit when using SPI reading. A button magnet was mounted on the output gear shaft with a plastic holder, and the sensor was mounted on a PCB and the sensor alignment and distance from the magnet was carefully adjusted according to the spec. When the motor was at standstill and I read the position value using SPI command, however, the value was not stable at all. The value variation is about 3bit, which actually made it to be 11bit encoder.

What I want to ask is, if anyone has ever used such magnet encoder before and is it actually so unstable in position reading? Or is it because the alignment or sensor distance from the magnet was not well adjusted?

• Resolution /= accuracy. As Transistor says, the noise spec seems close to your observations. Look at the statistics of this variability : if it's random, there may be some improvement possible through averaging. – user16324 Aug 28 '17 at 11:44
• You are right. Actually, AMS itself recommended averaging as well. However, the 3-bit error will make 14-bit resolution claim meaningless, isn't it? What's the point of using a 14bit resolution encoder whose position accuracy is only 11bit? – roTor-roTor Aug 29 '17 at 2:46
• If its resolution and accuracy were both 11 bit, you would have an 0.5LSB resolution error (quantization error) on top of 0.5LSB position uncertainty, doubling the actual error. You can do better than that by increasing the resolution (reducing the quantization step. – user16324 Aug 29 '17 at 10:25
• @BrianDrummond, I agree with you on the quantization error. However, in my case, the error seems to be caused by noise, which definitely overwhelmed quantization errors. In such a case, is higher resolution still helpful for better accuracy? – roTor-roTor Aug 30 '17 at 1:11
• See first comment. – user16324 Aug 30 '17 at 10:59

I know nothing about these chips but a quick look at the AS5147 datasheet bottom of page 8 shows:

Figure 1. AS5147 RMS output noise.

Assuming that 14-bits is 360° then 0.082° is $$\ \frac {0.082}{360} = 0.000228 \$$ or an error of 0.0228%. Note that this is the RMS noise value. You'll have to figure out how that relates to the max and min values.

Meanwhile you're seeing 3-bits noise on your 14-bit signal. Therefore 11 bits are remaining stable and the 12th bit is unstable. $$\ \frac {1}{2^{12}} = 0.000244 \$$ or an error of 0.0244%.

Someone will correct the details of my calculations here but it seems to me that you're running close to specification.

Analog Devices AN615 may help.

Figure 1 shows a typical histogram obtained from a sigma-delta ADC when the analog input is grounded. Ideally, for this fixed dc analog input, the output code should be zero. However, due to noise, there will be a spread of codes for a constant analog input. This noise is due to thermal noise within the ADC and quantization noise due to the analog-to-digital conversion process. The code spread is generally Gaussian in nature.The rms noise is calculated using the curve that results from the histogram, the width of the curve determining the rms noise. A Gaussian curve goes from –infinity to +infinity. However, 99.99% of the codes occur within 6.6 $$\ \times \$$ rms noise.Therefore, the peak noise is 6.6 $$\ \times \$$ rms noise.