Hi guys, I encountered a problem that as5600’s data jump back when I rotate my motor fast by hand.
If i rotate motors continuously by hand, the data would jump back all the time. but if i rotate motors slowly, it would not happen.
My main control is ESP32, and I have run the open loop test and close loop test, both they were ok(yes, voltage control close loop is ok). i use two I2Cs connecting to AS5600s, use dual bus example.
At first i suspected that my pull up resistors’ value are high, and i change the speed of I2c to 100K, and sitll not OK. i checked the rising edge of SCL and SDA with OSC, it’s about 650ns, and didn’t exceed 1000ns.
Is the cable for AS5600 too long?
Is there anyone has ever met that before? Even though I can run the close loop, but I still want to figure it out~
I have not seen this happen myself. But many people have problems with the AS5600 - it isn’t so accurate. There is at least one other forum post I have read in the past that describes the same problem as you have. Not sure it was resolved.
It seems like the issue is the algorithm in the
There we are counting the number of revolutions and calculating the angle of the motor more or less as:
angle_motor = number_of_rotations*2*PI + current_sesor_angle;
The tricky bit is knowing when to say that the rotation happened so for that we have a simple line of code line 88:
// tracking the number of rotations
// in order to expand angle range form [0,2PI]
// to basically infinity
float d_angle = angle_data - angle_data_prev;
// if overflow happened track it as full rotation
if(abs(d_angle) > (0.8*cpr) ) full_rotation_offset += d_angle > 0 ? -_2PI : _2PI;
0.8 means that if the difference in between current reading and the previous one differs
+288degrees) when we say that the positive revolution happened if its
-288degrees) then we say that the negative revolution happened. So
0.8 is an arbitrary number that worked fine with most of the testings we’ve done so far. But if the sensor is noisy maybe it is a bit too low/high. So you can try fiddling with this number to try to get rid of the jump.
But as you said, since for the FOC the only important part of the senor anlge is the relative one (0-2*PI) then even if the number of rotations is wrong the motor will not loose the alignment.
If you have time to test it out, we’d be very interested to know which value worked best for you!
Many Thanks for helping with my question~ I changed the value from 0.8 to 0.5 and 1, then i found both of them are disappointing. if you rotated the motor fast, they would give even worse data than 0.8
However, it would not impact the alignment, I’d better try to improve my hardware design to avoid the noise~
I also had data jumps from the AS5600 once! It was related to a magnet that came loose and misaligned. Only your hardware setup already looks great so I think it should not be the problem for you!
It is not necessary for SimpleFOC but from my own experience: many inconsistencies of the AS5600 went away when connecting the direction port to ground. It seems like not connecting this port can cause some disturbances.
Good luck with your project!