AS5047U vs AS5047P

Greetings fellows…its been a while.

Just out of curiosity who here has been using the AS5047P variant mag encoder and have you had any luck with it? Or anything special I might need todo. It seems to have the same angle read register setting so I thought it would be just good to go

I’ve mounted one up today with the same setup board I use the U variant but its not seeming quite happy yet.

With the U I get consistent results but with the P I get fluctuations in the output in the serial monitor of 6.28/6.29
9.03
9.03
9.03
15.31
9.03
9.03
9.03
15.31
15.31
15.31
9.03
9.03

Cheers
Adam

@Antun_Skuric @David_Gonzalez @Owen_Williams Were you guys using the P variant? I sourced mine from Aliexpress as I found them for 3 euros each for 10 and couldn’t help try my luck.
But as you can see the output is crap. I am using the same MCU and swapping out the mag encoder on the back with the same code. The AS5047U runs great and is stable. I have tried 2 of the AS5047Ps I got and either they are factory seconds that are rejected because of instability or the P variant needs something a little additionally to get it to run.

Is this spi?

Are you saying it jumps 2pi? I would guess that is fixable and or is a software bug. These sensors are 14bit (16384). I wonder if the code that spots the rollover (from 0 to 16383 or vice versus) is doing something weird.

Maybe you can print out what the raw values are doing from the read register when it’s misbehaving.

@Owen_Williams 2pi…yes your right:) and yes I am using SPI. I could print out raw values…Im a bit rusty to find where todo that so any hints would help and I can report back here with the data:)

Here:

Also have a look at the next few lines that decide whether a 2pi rotation has occurred.

1 Like

Thanks @Owen_Williams

so raw using the given spi example looks like

228
227
228
227
228
225
226
228
226
225
225
227
228
224
225
227
226
224
228
226
227
226
228
228

and here is a shot of the plotter

i also updated my foc lib as it had been some months. so slightly different results now

The raw results look good - it seems to be fluctuating ± 0.1 degrees (which could be easily smoothed further). It doesn’t explain the ± 2PI jumps. Can you print raw_data next to angle - so we can see when the jumps happen in relation to the raw_data.

It might also be worth spinning the motor 360 and looking to see what the raw_data does. It’s possible they’ve done something weird like change it to 12bit or the bits are coming back with a different endian.

1 Like

the 2pi error was with lib version 1.6
the current reading is from lib version 2.1
velocity, raw, angle below

227 raw
0.09 angle
0.00 vel
225
0.09
0.00
229
0.09
-0.49
225
0.09
0.46
227
0.09
-0.25
228
0.09
0.70
225
0.09
-0.25
227
0.09
-0.70
226

@Owen_Williams - 2.1 library resolves my problem…cheap chips means $$$$ saved yay.
By cheap I mean around €3.5 each. The same version from mouser when you buy ten is 6,46 € plus VAT.
Anyway thanks again

1 Like

Perhaps you can link to the aliexpress link. I might buy some! Did they come with magnets?

@Owen_Williams sent you a pm