LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stepper position control with myRIO

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

0 Kudos
Message 1 of 3
(2,673 Views)

Hi E,

 

How are you implementing PWM with the myRIO? Are you just using the myRIO express VI or are you writing your own code?

 

Also, just as a heads up, the Academic Hardawre Products page is a little more specific to the myRIO and is monitored by NI Developers who work with that device. If you post this question there, you may get a better response.

Ryan K.
Product Manager, ATCA and BEEcube
National Instruments
0 Kudos
Message 2 of 3
(2,628 Views)

Hi Ryan,

 

I am using the myRIO express VI.  I was thinking of a way to implement what I want if I was able to write my own code for the PWM, but as someone new to LabVIEW I wasn't totally sure how to go about doing that.  

 

Also, thank you for the suggestion.  I shall make the post on that page and discontinue it here. 

 

E

0 Kudos
Message 3 of 3
(2,607 Views)