Magnet encoders


Many people have been asking about support of magnetic encoders. I surveyed the magnetic encoder offering from ams, RLS (Renishaw), MagAlpha, US Digital, and Posital.
My finding was that the ams AS5047P is likely to be the best candidate.

From what I understand from the datasheet, without any SPI configuration, the ABI incremental interface will be active with a resolution of 4000 CPR. Therefore we can add the drivers and config later, and try it out immediately.

I encourage someone to have a go!

Which Encoders to choose

Looks like a great little encoder. Note, however:

By default, the incremental interface is set to work at the highest
resolution 4096 step per revolution, or 1024 pulses per
revolution (ppr).

That’s for revision 1-01, 2016-Apr-28 of the datasheet.


Looks like a nice encoder. Will definitely try it out.

Any idea of a good place to buy this in qty 1? Also, does the magnet come with it? (Sorry I’ve never used magnetic encoders before outside of motors that’s came with them pre-installed.)


Magnet will not come with it. Easy to find on somewhere like digikey. I also have been trying to find the ams in stock to try it out. No luck all back ordered. Any leads @madcowswe?


I used the development board from mouser which comes with a magnet and although it says the default CPR is 4096 mine were all 4000.
I wasted quite some time trying to figure out what the problem was as the ODrive was holding position correctly at 0 and close to that but as I increased the position it stopped working because the difference between the actual position and the reported position increased


I think this devboard should be a good place to start, comes with magnet.


Ahh Dev board makes sense. I will be grabbing one soon.


Note that this almost surely needs to be a diametrically-magnetized magnet, not a standard axially-magnetized magnet! I can’t find in the datasheet anywhere that calls out using a diametrically-magnetized magnet, but it does state that “The AS5047P uses 4 integrated Hall sensors which produce a voltage proportional to the orthogonal component of the magnetic field to the die”. If a magnet is axially magnetized, the orthogonal magnetic field component will be near constant, and the sensor wouldn’t work well.

kjmagnetics is where I buy most of my magnets, and has a wide variety of diametrically magnetized magnets, including ones similar to the 8mm⌀ and 3mm height N35H magnets used to characterize the sensor in the datasheet. Since they sell in low quantity, their prices are very reasonable, and I’ve never had an issue with them or their magnets, I’d recommend using them.

Edit: the devboard does include this diametrically-magnetized magnet, which confirms my suspicions.


I’ve managed to order samples from AMS 3x AS5057P + 3 magnets, should arrive in a week or so, will report when I get them running.


first of all FYI the ams encoders chips are available on aliexpress with the magnets included for ~$10 ea. you will have to buy a breakout board for ~10 cents ea and just add 2 caps, that’s it. just know that TSSOP package requires skill to solder by hand. the 5048A is available as a ready-to-use module for $15 on aliexpress (used for brushless gimbals) it is a more expensive chip but it does not support ABI… just SPI.

second - do you intend to support this in the firmware? I used ams encoders (the cheaper as5600) with arduino but it seems intimidating to me to try meddling with firmware code. i would like to know there is some example code availble before jumping in.

third - I heard there are latency issues with these encoders when using I2C/SPI? . perhaps the I2C / SPI protocol is the bottleneck here. also when using an I2C encoder beware these encoders have a fixed I2C address so you may need an I2C multiplexer to use more than one at a time.

great product and forum… waiting for your comments!


Ah nice, thanks for the aliexpress link. My only worry is that the chips could be counterfeit, which does happen even with IC’s. Though of course it could just be genuine chips resold through some low-margin channel.

Using the ABI interface, I think nothing has to change in the firmware, it should just work. I’m sure someone in the community will add the SPI drivers to retrieve the absolute position also at some point: these encoders seem fairly popular.

Yes I can imagine that there is latency over SPI. This is why we should use the ABI interface, which I think should have basically zero latency. There is some latency in the magnet to position determination, but they have a latency compensation filter on-board that uses the speed of the rotor to compensate. So hopefully it should work pretty well.

Thank you!