Stepper motor with HMC5883L three axis sensor

Dear All,
Have a nice day,

I am driving stepper motor using CNC shield with(A4988 ) driver and arduino Mega and also I am using HMC5883L compass . HMC5883L is mount on the stepper motor shaft

I am reading HMC5883L to detect the angle and base on the angle will decided the rotation direction

My Question is

when I read the HMC5883L sensor it will take long time hence stepper motor speed become very slow, Please advice to overcome this issue

Please advice
Thanks in advanced

It's a stepper motor - you already know the angle, because you sent it there.

PA3040:
when I read the HMC5883L sensor it will take long time hence stepper motor speed become very slow, Please advice to overcome this issue

one drawback of using a stepper motor is its position is unknown at startup. limit switches are one approach to determining position

but once you know the position of the stepper and knowing the number of steps per rotation, you can drive it to any new location.

you just need to read the "compass" once at startup.

gcjr:
you just need to read the "compass" once at startup.

And I suspect that using a limit switch to establish the HOME or ZERO position would be a lot simple and perhaps more precise.

...R