Nema 17 closed loop stepper motor using a magnetic rotary encoder AS5048B

Hello. I can make the motor work in open loop and I can also read data with the encoder, but I cant do that simultaneously.

I'm using the encoder libraries from GitHub - sosandroid/AMS_AS5048B: Arduino Lib for AMS AS5048B I2C - 14-bit magnetic rotary position sensor. I'm using an Arduino UNO board with a CNC shield and the driver for Nema 17 is A4988.

Can someone help me with some guidance on what I have to do to integrate closed loop control on the Nema 17? First of all i would like to be able to make the motor spin and in the same time to receive information from encoder on I2C communication. Thx

Welcome to the forum.
Could you please post your code in code-tags as per forum guidelines?
And also a circuit diagram of your setup?

Just as a side note:
Firstly, using a stepper should help avoid the need for the position feedback, unless you are worried about overdriving the capabilities of the stepper.
Secondly, closed loop stepper solutions are available if you so choose, but at the cost of needing a driver that can receive motor feedback.

1 Like

I2C is way too slow to read a rotary encoder reliably.



Uploading: WhatsApp Image 2022-sss06-03 at 4.28.18 PM.jpeg...

Im receiving good informations from sensor from I2C

If you were then why are the numbers wrong?

What evidence do you have that the information is good?

And where is this? What you just posted was in no way code or a schematic. It was a photograph of random parts.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.