AS5600: i2c reading gets stuck sometimes

Hi, thanks so much for this library!

As you mentioned “Please share your experiences.”, I figured I post here about an issue I’m having.

Every now and then (about once every half minute on average) the reading code blocks and stops for 1002ms. I put this in my loop:

long readAngleTime = millis();

  rEncoderRaw = rAs5600.readAngle();

  if (millis() - readAngleTime > 1){
    Serial.print("angle time: ");
    Serial.println(millis() - readAngleTime);
  }

And it outputs 1002 every now and then.

This is especially problematic as my sensor is on a shaft that spins up to about 3800rpm, and multiple revolutions may pass in this 1 second so I have lost track of the amount of full revolutions it has made.

I am using the sensor on a wiper motor, from this tutorial: https://hackaday.io/project/187675-strong-servo-motor-with-a-wiper-motor And the code runs on an ESP32.

I am clueless why readAngle() times out, nor do I have any idea on how to reduce the timeout time.

I will attempt to solve this issue by switching to pwm output, as suggested to me on the Arduino discord, but perhaps someone can look into this to help others in the future!

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (15 by maintainers)

Most upvoted comments

I agree! Thanks so much for your time, and I’ll let you know if I learn more.

Thanks for doing the tests.

So conclusion is that the problem is (1) outside the library scope, and (2) the library cannot fix it as far as we know. Think that implies this issue can be closed.

(although I am still interested when a working solution pops up)

Think I found a possible cause here https://github.com/espressif/arduino-esp32/issues/5934

If this is the cause you should check the connection

  • wires
  • soldering
  • pull up resistors Vibrations can (and will) disturb loose wires.