Seeed-Studio / Seeed_Arduino_AS5600

The library comes with AS5600. Through this library, we can realize read the angles 、get magnetic from a magnet underneath the sensor.

Repository from Github https://github.comSeeed-Studio/Seeed_Arduino_AS5600Repository from Github https://github.comSeeed-Studio/Seeed_Arduino_AS5600

Unstable raw readings with static position.

ieb opened this issue · comments

commented

I am using a Seeed Studio AS5600 with a 6x4mm diametrically magnetised magnet on a 3.3v Arduino Mini Pro and I am getting unstable raw reading when the position is stationary. Below is the output I see.

The readings are approximately 100ms apart. Readings take about 10ms to complete.
magnetStrenght = getMagnetStrenght() ie status register 0x0b.
AGC = 0x1a register (8 bits)
magnitude = 0x1b and 0x1c register (12bits)
angle = raw angle 0x0c and 0x0d registers (12bits)

The pattern is similar with different positions always cycling between high an low values. It does get worse if the magnet is weaker (ie stats = 1, agc=100, magnitude < 1000) but I have never managed to get the readings stable.

Any ideas. What am I doing wrong. The loop simply reads the I2C. I can't see a bug in the library perhaps there is some init I need to do. Sorry I know this is probably hardware but any pointers would be really appreciated, like are these chips susceptible to interference or harmonics.

ms,magnetStrength,AGC,magnitude,raw reading
6730,2,88,2123,3701
6849,2,88,2122,3701
6968,2,88,2124,3643
7086,2,88,2123,197
7204,2,88,2123,395
7323,2,88,2123,395
7441,2,88,2125,395
7560,2,88,2122,395
7678,2,88,2123,395
7797,2,88,2123,395
7915,2,88,2124,395
8033,2,88,2123,207
8152,2,88,2124,3701
8271,2,88,2123,3701
8390,2,88,2124,3701
8509,2,88,2123,3701
8627,2,88,2123,3701
8746,2,88,2124,3701
8865,2,88,2124,3701
8983,2,88,2124,3593
9102,2,88,2124,3939
9221,2,88,2123,139
9339,2,88,2124,395
9458,2,88,2123,395
9576,2,88,2124,395
9694,2,88,2123,395
9813,2,88,2125,395
9931,2,88,2123,395
10050,2,88,2125,453
10168,2,88,2125,4056
10287,2,88,2123,3701
10406,2,88,2123,3701
10525,2,88,2122,3701
10644,2,88,2123,3701
10762,2,88,2124,3701
10881,2,88,2122,3701
11000,2,88,2123,3701
11119,2,88,2124,3741
11237,2,88,2124,197
11356,2,88,2124,395
11474,2,88,2124,395
11592,2,88,2123,395
11711,2,88,2123,395
11829,2,88,2125,395
11948,2,88,2123,395
12066,2,88,2123,346
12185,2,88,2123,108
12303,2,88,2123,3701
12422,2,88,2124,3701
12541,2,88,2124,3701
12660,2,88,2124,3701
12778,2,88,2123,3701
12897,2,88,2123,3701
13016,2,88,2124,3701
13135,2,88,2124,3642
13253,2,88,2123,197
13371,2,88,2123,395
13490,2,88,2123,395
13608,2,88,2123,395
13727,2,88,2123,395
13845,2,88,2123,395
13964,2,88,2123,395
14082,2,88,2122,395
14201,2,88,2123,157
14319,2,88,2124,3701
14438,2,88,2121,3701
14557,2,88,2123,3701
14676,2,88,2123,3701
14795,2,88,2124,3701
14913,2,88,2123,3701
15032,2,88,2122,3701
15151,2,88,2123,3642
15269,2,88,2122,247
15388,2,88,2125,395
15506,2,88,2124,395
15624,2,88,2123,395
15743,2,88,2123,395


#include <Wire.h>
#include <AS5600.h>

AMS_5600 ams5600;

void setup(){
 Serial.begin(115200); 
 Wire.begin();
}
void loop() {
    Serial.print(millis());
    Serial.print(",");
    Serial.print(ams5600.getMagnetStrength(),DEC);
    Serial.print(",");
    Serial.print(ams5600.getAgc(),DEC);
    Serial.print(",");
    Serial.print(ams5600.getMagnitude(),DEC);
    Serial.print(",");
    Serial.println(ams5600.getRawAngle(),DEC);
    delay(85);
}
commented

Moving the magnet closer seems to make the readings more stable, but there are still periodic blips. The period between blips is constant. I have am checking with the chip manufacturer to see if this is a known issue.

3987919,2,52,2113,3753
3988039,2,52,2112,3753
3988158,2,52,2113,3753
3988277,2,52,2111,3753
3988397,2,52,2113,3753
3988516,2,52,2113,3753
3988636,2,52,2112,3753
3988755,2,52,2112,3753
3988875,2,52,2112,3796
3988994,2,52,2112,3796
3989114,2,52,2111,3839
3989233,2,52,2112,3625
3989352,2,52,2111,3881
3989472,2,52,2113,4010
3989591,2,52,2112,4010
3989711,2,52,2112,3924
3989830,2,52,2112,171
3989949,2,52,2113,3883
3990068,2,52,2112,1
3990187,2,52,2112,427
3990306,2,52,2112,343
3990425,2,52,2112,427
3990543,2,52,2113,84
3990663,2,52,2112,4009
3990782,2,52,2113,3753
3990902,2,52,2112,3753
3991021,2,52,2111,3753
3991141,2,52,2112,3753
3991260,2,52,2111,3753
commented

Found the problem.

The dir pin on the chip (pin 8) was floating due to a faulty direction switch on the board.
Soldering clockwise pads together has fixed it.

commented

The dir pin on the chip (pin 8) was floating

This solved my issue, thank you!

@ieb Thanks for posting your solution, this issue caused me lot of headache until I found this!