Stepper Motors in Arduino

I have set up a camera to track the position of a laser. I plan to use a mirror attached to a stepper motor with an rotary encoder to be able to move the mirror so the laser is at the centre of the reflected image.

If I have the information from the encoder transformed into an angle which I will be using to move the motors to go back to the desired position. But the position of the laser will be continuously moving around and I have to redirect the mirrors constantly.

so my questions are:

[1] Do I use a PID loop for the stepper motor using arduino?

[2]How do I continuously take information from the transformed encoder information and move the motors?

  1. You could. It's not normally necessary. If the commanded position is more than one step away from the current stepper position, then take a step in that direction.

  2. Yes. Good idea.