From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

Stepper position control with myRIO with a trapezoidal velocity profile

Hi,

I am currently controlling the NEMA 17 stepper motor using PWM express VI(for steps), DIO(for controlling the direction) from myRIO and a big easy driver.

Currently, I ramp the frequency by manual controlling it. What I am looking for is to extend this to a position control block which takes the distance as the input from the user and moves the required distance from the home position.

I can keep the frequency(steps/sec) constant and solve this. Keeping the frequency constant has two issues:

1) If it is less, it takes a longer time to reach the destination.

2) If it is high, it generally doesn't work as steppers need a ramp (slowly change to higher values).

 

I was going through the following link which talks about velocity profile (accelerate, constant and decelerate) https://forums.ni.com/t5/Academic-Hardware-Products-myDAQ/Stepper-position-control-with-myRIO/m-p/29...

 

I can calculate the time to reach a constant velocity and also the time to reach zero from constant velocity. I am lacking ideas on how to get the velocity profile based on the input distance in LabVIEW?

0 Kudos
Message 1 of 4
(3,477 Views)

Hi nku1991,

Maybe I am misunderstanding your question. Why do you need the velocity profile as a function of the input distance? Ideally you'll have a distance you need to move, and a velocity profile that's based on the kinematics equations of your stepper motor. You can then set the rates of acceleration, deceleration, and constant velocity of that profile to reach your specified distance. Could you provide some more context regarding your application? I'm sure I am misunderstanding your question, but more detail would be helpful. 

0 Kudos
Message 2 of 4
(3,433 Views)

Hi walker.p,

I am not sure if you are talking in the context of using a soft motion module.

I am controlling the stepper position using myRIO and from my search found out that soft motion module (which has the settings you mentioned) cannot be used with myRIO.

So in my application, I have to position a soft tube(attached to a lead screw) in and out of a 30 cm long rigid tube. I am using a stepper motor with a lead screw to achieve this.

I am using PWM express vi as of now with a fixed duty cycle and user control frequency for generating the pulses to drive the stepper motor. I can fix the frequency to a certain number (for example 500) but in some scenarios, it takes close to 20 seconds to move 30 cm. If I fix the frequency at a higher number (for example 2000), the motor doesn't move due to sudden change.

I was wondering if I can achieve the acceleration to 2000 from 500 and then deceleration using software from myRIO.

 

I looked at alternatives of using sequential structures and digital out pin for generating the steps, but I am currently limited by the minimum wait time of 1 ms.

0 Kudos
Message 3 of 4
(3,421 Views)

hey Nku,

did you solve the problem? i have the same issue

0 Kudos
Message 4 of 4
(1,548 Views)