Hello,
I am developing a position control system to move a linear stage back and forth using a stepper motor (file 1). The stage will ultimately need to follow the motion path set out in a function that I have defined (file 2).
I have been able to get the motor to move using a Big Easy Driver from Sparkfun (file 3), sending it a PWM signal from one myRIO pin, and setting another pin on the myRIO to high or low in order to establish the direction. From what I understand, each low-to-high transition in the PWM signal causes the motor to take one step (or microstep). Therefore the PWM frequency is equal to steps/second, the motor speed. Using timed loops along with this information, I am able to control how many rotations the motor performs at a constant speed.
However, I would like to be able to count steps, so that I can give the motor a position (number of steps to take from some defined "home") and it will go there, and vary speed accordingly to get there and ultimately follow my function. I will apparently need to implement some sort of PID control eventually, in order to accomplish this task. Right now I would just like to know how I can keep track of the position of my motor and control it that way.
I greatly would greatly appreciate any advice on how to implement this process.
Best,
E