AS5600 I2C magnetic sensor not received through SimpleFOCShield

Hi everyone,

I am having trouble with two SimpleFOC Shields and the AS5600 sensor. Some weeks ago I ordered 3 Shields of the SimpleFOC project, 2 of which I ordered from one place (Simplefoc Shield V2.0.4 V1.3.3 Development Board for BLDC Servo Drive of Mechanical Dog), and the other one I ordered from another place (Aliexpress).

I did some open_loop examples testing and the three were doing fine, until I hooked up the AS5600 encoder to the shield. The board I was using was the Arduino Uno, no stacked shield. The AS5600 has a total of 7 pins, 5 of which I connected to the shield according to the guide on the document website, that is: VCC to 5V on shield, GND to GND on shield, DIR to GND on shield, SCL to SCL on shield, SDA to SDA on shield, GPO and OUT pins are left unconnected. Then I loaded up the example sketch in the utils for the AS5600, which would look like this:

#include <SimpleFOC.h>
MagneticSensorI2C sensor = MagneticSensorI2C(AS5600_I2C);


void setup() {
  // monitoring port
  Serial.begin(115200);

  // configure i2C
  Wire.setClock(400000);
  // initialise magnetic sensor hardware
  sensor.init();

  Serial.println("Sensor ready");
  _delay(1000);
}

void loop() {
  // iterative function updating the sensor internal variables
  // it is usually called in motor.loopFOC()
  // this function reads the sensor hardware and 
  // has to be called before getAngle nad getVelocity
  sensor.update();
  
  // display the angle and the angular velocity to the terminal
  Serial.print(sensor.getAngle());
  Serial.print("\t");
  Serial.print(sensor.getVelocity());
  Serial.print("\t");
  Serial.print("SCL: ");
  Serial.print(analogRead(SCL));
  Serial.print(" SDA: ");
  Serial.println(analogRead(SDA));
}

Now, with the 2 shields I got from the link above installed, the Uno does not seem to be able to properly get the data from I2C sensor. It always shows a fixed number of 12.60 for angle, and 0.00 for speed. I tried migrating the SDA and SCL to A4 and A5 on the lower left corner but there was no difference. Sometimes, when the shields are installed, the Serial mornitor in the Arduino IDE stops completely and indefinitely, requiring a restart of the application to be able to work again.

However, with the Aliexpress shield I got, the sensor worked flawlessly, and angles and velocity were read as how they should be. With this problem, I tried removing the shield from the Uno and connecting the I2C pins directly onto the board, which worked just as expected. So at this point, only by using the Aliexpress Shield or Directly connecting SCL and SDA could the sensor be read.

Please, do you have any idea what I was missing, or if the 2 shields required something else for the sensor, or should I RMA the 2 shields that were not accepting the sensor? Thank you in advance.

Edit: I did try the 2 shields with some other boards, one by one, not stacked. I attaching them to the Arduino Mega 2560, same result, did not work. I tried with an ESP32 board that is shields compatible, same result, worked when connected directly but not when shield installed.

IDK, but a very common problem is the pull-up resistors. I would measure both boards with a VOMM, maybe one has the pull ups and one does not. I think most as5600 boards have pull ups but not all of them.

Hi Anthony,

So yeah, I’m actually an idiot, and it was indeed a pull-up-related problem, but not with the AS5600. The Aliexpress one I got actually came with 0-Ohm resistors pre-soldered to the Pull-up I2C and Hall Enc, as seen on the right hand side board. But the other 2 shields that I thought were not accepting I2C didn’t have these connected. I soldered some tin to bridge the 2 and they are working flawlessly now.

Thank you for your time.