01-02-2024 05:19 PM
Hey everyone.
I'm trying to control a stepper motor using a cDAQ module. The objective is that I want it to run an actuator forward some distance and back the same distance when I run the program.
This means that when I run the program, I want the motor to ramp up to a certain speed (let's say 10 RPM), run at that speed, ramp down to zero, ramp back up in the opposite direction, run for the same time and then ramp back down and stop.
I tried using counter output to create a simple program that would let me control the frequency during the run.
The two issues I'm facing are:
1. If the motor has to go from rotating in the clockwise direction to rotating in the counter clockwise direction, I'll need the motor to stop at some point during execution when I can flip the direction. But the counter output does not accept zero value for the frequency.
2.I'm trying to sync two motors for the motion profile I need, which means I need the motors to run at the same time. Right now, I'm finding a significant delay between motor start and program start.
Any suggestions would be appreciated. Thanks
01-02-2024 06:47 PM
Instead of reinventing the wheel, you're better off using dedicated motion controllers - checkout the ones from TENET https://www.tenet-tech.co/geco-motion
Read this blog post - https://www.tenet-tech.co/blog/top-5-reasons-why-you-need-motion-control-in-labview
01-02-2024 08:11 PM
A Stepper motor runs on digital pulses (I didn't know this six months ago, but then I learned about Stepper motors and have learned to control them using an NI USB-6212). To run it at a constant speed, you need to send out pulses at a constant frequency. To get it to stop, you stop putting out pulses. To change the velocity of rotation, change the frequency of the pulses.
Are you really using a Stepper motor? What hardware are you using? Is there a chip like the A4988 in the circuit? Are you using an Arduino? Do you know how a Stepper motor works? How there are (typically) 4 wires to the motor (not just two) and how a single "step" pulse gets converted into multitple signals to those two sets of motor wires (by, say, an Arduino or a stepper motor driver chip)?
There is a lot "missing" from your very simple LabVIEW code. Where does the pulse that apparently comes out of a Counter-Timer (what DAQ device are you using?) going? Are you only generating a single Pulse signal? Do you have a schematic diagram showing where this output goes relative to the Stepper Motor?
Have you discussed this with someone (perhaps a EE or ME student) who knows about motors?
Bob Schor
01-02-2024 10:15 PM
A controller could make things easier. I am definitely leaning in that direction now.
I thought of just going with LabVIEW because the idea is simple: just adjust the frequency of the pulse train and you can adjust the speed. And besides, I had written a code in the past to make a stepper motor oscillate back and forth, but that was years ago so I don't remember the logic I used; I lost that code to a hard disk crash. ☹️
One of the grad students in my current lab made it work for a servo motor (albeit in a roundabout way) but he had a controller as well.
01-02-2024 11:09 PM
@Aryce wrote:
A controller could make things easier. I am definitely leaning in that direction now.
I thought of just going with LabVIEW because the idea is simple: just adjust the frequency of the pulse train and you can adjust the speed. And besides, I had written a code in the past to make a stepper motor oscillate back and forth, but that was years ago so I don't remember the logic I used; I lost that code to a hard disk crash. ☹️
One of the grad students in my current lab made it work for a servo motor (albeit in a roundabout way) but he had a controller as well.
If all that you want to do is to control the motion of stepper motors from LabVIEW, the GECO Motion would be the easiest way and comes with easy to use LabVIEW APIs and Express VIs.
01-02-2024 11:14 PM
Just to iterate, as I mentioned, what I'm looking for is a synchronized motion of two or more motors, with variable acceleration profile as well as velocity profiles. Is that possible using that controller?
Also, my motor comes with an embedded controller, and the driver has a closed-loop option. Does that mean that I can use this controller to operate it in closed loop?
01-04-2024 06:58 AM
Hello Aryce,
This is John Wu, CEO of TENET Technologies, chiming in here. 😀 Yes, our motion controller can support synchronized motion of 2 or more axes, such as XY or XYZ coordinates. And yes, you can define the velocity profile as well as the acceleration profile of your motion movement. Both of these features are very hard to implement on a generic DAQ device, but these are standard with our motion controller. Typically you'll need these features for precision movements in a multi-axis stage or robotic setup.
If your motor driver already has closed-loop control, that's great! From the motion controller side, there's no need to implement another closed-loop. The motion controller will send commands to your driver via pulse signals, and the closed-loop control on the driver will compensate for any positioning error.
For more information, feel free to leave an inquiry from our website. One of our experts can help you access if your current NI hardware is sufficient for your needs. If not, we'll be happy to provide a solution for you.
BR
John
Add motion to LabVIEW in 30min or less - TENET EMotion
Finding it hard to source NI hardware? Try NI Trading Post