# Robotics-Running two stepper motors

Hi
I am working with LIFA (labview interface for arduino) to run two stepper motors to create a special (simple) path on XY plane. The example code (Arduino Stepper Motor.vi) works fine with one motor, but I don't know how I can modify it so that two motors can move with one time pushing the button, one after another while taking turns. Any Ideas?
The motion plan is as follows: 1. Motor 2 is stationary and motor 1 moves the load for 100 steps in X direction, then it stops and motor 2 starts to move the load for 70 steps in Y direction.
2. The same as 1, only the direction of motor 1 motion is reversed, and motor 2 moves 85 steps instead of 70 in the same direction.
3. Repetition of 1 and 2 for 4 times with different number of steps at each level.
I have twe big easy drivers, and one Arduino Uno.
Best,
Ashkan

You could create a state machine.
You could create a movement recipe where you enter in each sequential movement, and the code steps through the recipe one movement at a time.
You could create some combination of 1 and 2.
How do you want it to work? Are these steps going to remain constant, or do you want to be able to change them from one run to the next? How much do you know about LV? Have you any code that you wrote? What is the long term goal -- are you building towards something specific or just learning for the sake of learning?
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

### Similar Messages

• Running two stepper motors at the same time from one port

Hello,
I have to run two motors at the same time - one used to move a linear ball screw and one to turn a grip. I am doing tension and torsion testing on small wires, but tension and torsion have to be done at the same time. I also have to build in the ability for each motor to take multiple steps, ie. have a motor take x number steps at y velocity and then move x number of steps at z velocity. Both motors need to be able to do this. However, I am having problems getting the motors to run at the same time and to take all the steps. The motors are connected to two RMS Technologies R356 controllers. Both of the controllers are then connected to one RS485 to USB converter card, and that card is connected to one of the USB ports in the computer. Currently, I pass an array of commands to two for loops each containing VISA read and writes. I've attached the vi to look at. All of the timing stuff in the code is because a new command cannot be sent to the controller before the motor is done executing the previous command. If commands are sent right after one another, the controller will only execute the first command and then return with an error.
Does anyone have a suggestion as to what I am doing wrong?
Thanks in advance for any help.
Solved!
Go to Solution.
Attachments:
Motor Controller (Sub VI 3).vi ‏41 KB

I'm not too clear on exactly what you are trying to accomplish or some of the details.
Are there equal number of torsion and tension steps?
Is there a pairing between a torsion and tension?  For example, you want to tension and torsion simultaneously, but those two together make a complete step?
Do you want to wait until both the torsion and tension have completed before moving on to the next torsion/tension pair?
Is there any time delay you want to hold at before moving on to the next step.
When working with state machines, it is important not only to define the states, but also the logical stepping from one state to the next, or alternatives based on conditions.  It could be flowchard, but sometimes people call them state charts.
Right now your latest posting has goes to "Write to Motor" event though and will wait there forever because there is nothing in the queue to write out through the VISA port.
Let's assume your first state would happen to be Enqueue Tension (in order to get something in the queue), you will actually queue up all your tension commands at once with the For loop.  Then i will be 1 less than the size of the array it always will be because for an array size n, i will go from 0 to n-1 on each iteration.  So your false case will run and you will go to "Write to Motor".  Write to Motor will run and dequeue the first command then go to Waiting for Response.  Waiting for response will iterate through the while loop until 66 or 67 comes back.  I assume only 66 will come back for tension since you have yet to write a torsion command.  Once that comes back, it will go to Enqueue Tension again and insert a whole other series of commands.  Then go back to write Motor and will take out the 2nd queue element from the first set of commands your wrote.  It will stay in a Tension mode and the Queue will grow endlessly putting in a whole new series for each element that you dequeue.
A state machine is the way to go, but I can't really sketch one out for you because I'm not sure exactly how your applications is supposed to work.  If a tension and torsion command are paired together,  perhaps you should just queue them together and write them out at once.   But the key thing is to sketch out on paper your application and flowchart exactly how the program should progress from step to step.
PS:  One other thing, make sure you wire the queue reference wire through all states.

• How do I establish serial communicat​ion using LabView to two stepper motors using a motor controller​?

I currently use an off the shelf motor controller to run my two stepper motors. It already has integrated a firmware software that sends commands to operate each motor. I would like to create an interface where I can send these commands using LabView. If someone can point me in the right direction I would appreciate it.

Look at the examples for the serial VISA vi.  Something like Basic serial write and read.vi is a good starting point.
Have you searched for a LabVIEW driver  at the NI LV driver network?   Asked the vendor?
If you write your own driver with the serial VISA vis remember to open and configure the port only once at the beginning and close it at the end of your program.
Message Edited by Henrik Volkers on 07-13-2009 04:21 PM
Greetings from Germany
Henrik
LV since v3.1
“ground” is a convenient fantasy
'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

• Running 2 stepper motors with LabVIEW using RMV ST400-NT controller and driver

Hello, I am new to programming as well as motors in general so please bare with me in my attempt to explain myself. I have a project involving laser therapy and I am attempting to control two stepper motors from Falhauber, Type AM2224-R3-AV-4.8. I will be using a RMV ST400-NT controller and driver. Original plan was to use 3 stepper motors for control in 3 axis but realized 2 axis is complicated enough. My power source is an Agilent E3630A. I am new to this whole thing and from what I have read form examples and other posts is that NI drivers seem to work best for these applications. I've written simple programs from examples, reading and watching videos. I want to know whether it's possible for these to work together using LabVIEW and also a nudge to help me get started would be much appreciated. Can someone please help guide me in the right direction, I feel a bit lost when it comes to all this. Thank you for your time and consideration.  Also, I will be using Windows 8 laptop with Labview 8.5. I have attached pics of components I will be using.
Justo T.
Attachments:
photo 1.JPG ‏1150 KB
photo 2.JPG ‏987 KB
photo 3.JPG ‏1085 KB

Hi jtarula,
I want to preface this response by saying that I am mre familiar with NI controller and driver rather than the one that you have. I am assuming that you are using the dll provided by the manufacturer here:
With these, you should be able to interface with LabVIEW using the call library function node. What the controller is capable I am uncertain of. I am certain that you should be able to since another user has commented on the use in LabVIEW before in another forum post.
I also want to let you know that LabVIEW 8.5 is not supported on Windows 8, which means that you may run into some compatibility issues. Here is the compatibility chart.
Paolo F.
National Instruments
Applications Engineer

• Control two stepper motors with PCI 7332 for sinusoidal movements

Hello,
I am now using two stepper motors of RK566BAE (Oriental motor). I connected those two motors with UMI-7764 and PCI-7332. I designed to have independent sinusoidal movement of each motor. The first motor is wired to Axis 1 and the second to Axis 2 (of UMI-7764).
I want to use Ni-Motion to create  a single VI in LabVIEW which helps to control both motors. But I have not figured-out how to obtain the movement I desired.
Thank you so much.

There are two ways to do elliptical arc moves:
Use arc moves in combination with gearing (shipping example). This requires three axes.
The 7332 doesn't support contouring and gearing and it doesn't provide a third axis, so there is no way to use this board for this type of moves. The cheapest NI board that supports elliptical moves in contouring mode is the PCI-7342. As the second option requires three axes, at least a PCI-7344 is required for this method.
Here is a link to a feature comparison table for all NI 73xx motion control devices.
Kind regards,
Jochen Klier
National Instruments

• Elliptical Motion of Two Stepper Motors with PCI 7332

Greetings,
I am trying to move two stepper motors on a 2d elliptical arc using LabView and PCI 7332 controller board. The 2D ellipse example in the LabView library does not work with the 7330 series. Is there any other easy way to perform such a motion with PCI 7332? Thank you in advance.

There are two ways to do elliptical arc moves:
Use arc moves in combination with gearing (shipping example). This requires three axes.
The 7332 doesn't support contouring and gearing and it doesn't provide a third axis, so there is no way to use this board for this type of moves. The cheapest NI board that supports elliptical moves in contouring mode is the PCI-7342. As the second option requires three axes, at least a PCI-7344 is required for this method.
Here is a link to a feature comparison table for all NI 73xx motion control devices.
Kind regards,
Jochen Klier
National Instruments

• How to run a stepper motor for an amount of time determined by a feedback?

Hi,
I'm using labview 8.6 and I'm trying to use a ORIEL sterppermike with a 20025 controller.
I have implemented a VI that has a stack of commands in a for loop. Every loop has the following sequence of commands:
command 1) start the stepper
command 2) wait for feedback to reach a certain number
command 3) stop the stepper
command 4) wait a certain time before starting again
To start the stepper I use a subvi from the example folder:
C:\Program Files\National Instruments\LabVIEW 8.6\examples\DAQmx\Counter\generate pulse.llb
--> Gen Dig Pulse Train-Continuous.vi
I don't understand why the sequence get stuck at command 1 and never gets to command 2.
I attach the vi for completeness.
Thanks to anyone that will help,
Matteo
Attachments:
SRL Matteo2.vi ‏121 KB

Hi, I'm not sure whether this is the right place for asking this question or not and if not, then please guide me to the right place for asking such question. Thanks.
I have a stepper motor with the Vector Network Analyzer Anritsu MS4623B. I got it up and running with the LabWindows/CVI. I need to sync the motion of the stepper motor with my data acquisition. Basically, I have to acquire the data in a way that in the start the motor will come back to home position wherever it was and then I want to move it to the specific position to do the measurements (For Example, I want to measure the 40 GHz channel between 1m to 3m movement of a stepper motor on a linear positioning system (ball-screw)). I've interfaced the VNA with the PC using LabWindows/CVI and I've controlled the clockwise and anti-clockwise movements of the stepper motor using LabWindows/CVI but I'm unable to sync the system in a way that whenever I run the code, the motor will run back to the home position and then move to a specific measurement start position and move till the end position and in between do the increment and stop and acquire the data. Is there any one to help me please? It's really urgent please and I'm doing this thing first time so please guide me in a proper way. I shall really apprecaite that and will be highly obliged with you. Thanks for your time and concern.
Thanks and Regards.
Attachments:
VNA & Motor Control User Interface.jpg ‏199 KB
VNA & Motor Control User Interface.jpg ‏199 KB
VNA & Motor Control User Interface.jpg ‏199 KB

• I want to run a stepper motor using FPGA card 7851r with 9474 driver C rio 9151 is it possible or can i do in LABVIEW CVI

Hello i want to run Stepper with 7851 R FPGA card with 9474 driver of crio chasis but i am not able to understand how to proceed .Or can opt this option by using lab view CVI
Solved!
Go to Solution.

Hi SHV,
actually I don't know in which context you want to use your existing hardware for your stepper motor.
1. The hardware, which you describe, is/was used for which application? ( data acquisition, controlling a system, etc)?
2. Did you buy the hardware especially for the motor application?
3. You don't know how which signals are required for your stepper motor.
Here are some basics from NI about motor control
Fundamentals of Motion Control
http://www.ni.com/white-paper/3367/en
NI Motion Control Technical Library
http://www.ni.com/white-paper/3054/en
4. Why do you get the idea the digital output module 9474 is suitable for the stepper motor?
I would recommend to talk directly to the customer support, so we can figure out in detail your aims about
the application. Contact your local NI office or request
a service request on following website:
Service Request Manager
Kind regards,
RupiDo

• Write a Labview program to control both speed and direction of stepper motors

Hello,
I am currently undertaking a project in University. As part of it I have to run two stepper motors at varying speeds, and one of them in forward/reverse. The motor I have for the project is a RS 191-8334 (V9728) and the controller is a RS 240-7920 (v10900). I have no experience of using Labview, and the version I have on my laptop is Labview 10. Any help would be greatly appreciated.
Ideally I would want a program to do both full/half steps, forward/reverse, have speed control and be able to control the number of steps.

Hi Wef,
What inputs does the stepper motor controller require and what hardware are you using to supply the required signals to the motor.
Best regards,
Stephen C
Applications Engineer

• MAX does not run stepper motor

I am an abosolute novice at NI Motion and cannot get MAX to move a stepper motor. I'd be very grateful for any help.
The system consists of a PXI-7340 Motion Controller card installed in a PXIe-1065 chassis. The PXI-7340 is connected by means of a SHC-68-C68-S cable via the Motion I/O port to the Motion I/O port of an UMI-7774 board. The UMI-7774 board is supplied with a 24Vdc power supply as well as an isolated 15Vdc power supply to its power terminals. Two stepper motors are to be controlled using this UMI, which has 4-axes capability. The Axis 1 and Axis 2 sections on the UMI are connected to a Danaher Motion P70530 Stepper Drive each by means of a D-Sub to D-Sub cable via the Control port on the UMI and the J4 Command port on the P70530 Drives. The P70530 drives are supplied with 65Vdc power from a bench top DC power supply capable of 70V, 15A. Each P70530 drive is connected to a Pacific Scientific Powerpac stepper motor (N33HRHJ, 65V, 5A).  (Thus, two P70530 drives and two stepper motors are connected tothe UMI.)
I am trying to get MAX to turn the motor. In the listing in MAX, under NI Motion Devices/PXI-7340/Default 7340 Settings/Axes 1/Axes Configuration, all limits were disabled, settings saved and initialized.
However, in the 1-D Interactive window, when the Target Position is set to a value, e.g. 2000 steps, and the Start button is pressed, the motor does not move.
But, the LED on the P70530 blinks until the Kill button on MAX is pressed.
Can anyone tell me why the motor does not move?
Where does one go to learn more on MAX? Why are all the manuals at NI made for experts who already know what they are doing and not for beginners? The Help is no help at all really.
Regards,
PKP

I called in to NI and talked with "Vivek" and he helped me set the MAX settings and the DIP switches on the P70530 motor drive (amplifier) to get the motor to run. He pointed me to the "Getting Started P7000 Series Stepper Drives" 28 page manual, which for some reason was not included in the CDROM that came with the P70530 drive or with the pre-installed manuals in the PXI chassis. (You would think to include all the relevant manuals on the CDROM, but nope.) The manual showed how to "Change Settings" for the PXI-7340 inside MAX and set it to the 7340 Settings for P7000 Drives.
Under Axis 1/Axis Configuration/ Stepper Settings tab, set the Stepper steps per revolution to 5000.
Under Axis 1/Motion I/O Settings, all the filters, switches and the "Inhibit Output Settings" has to be disabled.
Now the motor runs. Yay!
But there is one teeny-weeny thing.
Under  Interactive/1-D Interactive, when the velocity is set to 100 rpm or more, or the Acceleration is set to over 20 rps/s, the motor whines and does not rotate.
When V=0 to 95 rpm, Acc=10 rps/s, the motor runs for a given Target position value (such as 200, 2000, 20000, etc.)
Here is another weird observation. When the Velocity is set to say 60 rpm, the actual motor speed measured with a tachometer and a stroboscope is found to be  about 1440 rpm, i.e., 60 x 24 rpm. (I measured the rpm using the two different devices and both tend to agree.)
Is the "rpm" unit a typo? Should it be something else?
What am I missing? Why is the stated rpm different from the actual measured rpm?
Thanks for any help.
Regards,
PKP

• Can I get a stepper motor to work useing an AO channel on a DAQ card?

Can I get a stepper motor to work useing an AO channel on a DAQ card? I know its a very low currentl coming out, but what Im going to be using the motor for is very weak. Has anyone tried this before? I certinaly dont want to spend 2,000+ on somthing that will be basicly moving a string on some pullys back and forth.
Thanks,
-Mark

Greetings, Mark
You can certainly use the A0 as a driving signal, but you need to amplify the current considerably to run a stepper motor. Additionally, most stepper motors require multiple phase driving signals to work properly. If I understand your application, I believe a stepper motor is a bit of overkill...you only want to use them when precise positioning and repeatability is an issue. You might look at some of the linear actuators available.
Eric
Eric P. Nichols
P.O. Box 56235
North Pole, AK 99705

• Stepper motor and sequence

There are stepper motor vi and sequence vi at the attach file. I want to control stepper motor via sequence vi. When I run the stepper motor vi, it can not be reached part of enter position. How can I integrate sequence vi into the stepper motor vi.
Attachments:
Stepper motor.vi ‏24 KB
Return Code Insertion.vi ‏14 KB

Sequence vi.
Attachments:
Sequence.vi ‏10 KB

• Running two servos simultanio​usly on myRio

I am having trouble running two servo motors on myRio at a time.
I have been working with the NI myRio (1900) Mechatronics Kit (March 2014) and run the servo motor with the provided project ('servo demo') without any problem, different PWM channels work fine as well.
Then I copied the essential blocks (like 'PWM channel', 'Open.vi' and 'Set duty cycle and frequency') and tried to run a second servo by itself using different pins and channels.This worked as well.
However when both servos are being used at the same time, they seem to hinder each other:
Sometimes the servos works perfectly fine together, sometimes they don't move at all (and just humm), sometimes they both move in a very weird way.
When I disconnect either power or ground cable on one motor, the other servo is getting back on track, but as soon as both are wired, the problems return. I tried using multiple pins and channels and they all work fine individually but never totally with the two parallel motors.
How can I control two servo motors simultaniously using the myRio-module?
(I am using the same type of servo that was in the mechatronics kit: S03N STD)
Kind regards.

Many DIO, especially high speed ones, do not have much current capability.  I can't find a current rating for the servo, but you are likely on the edge of how much current the myRIO can put out for the DIO with jus a single servo.  If you got lucky and had your pulses set to only one on at a time, you might be able to control both.  But I would highly recommend using an external supply for controlling the servos.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines

• Stepper motor case structure

Hey everyone
I am currently a physics student and for my final year project I am building a mini CT scanner which involves the use of two stepper motors. I currently have a program working which controlls the motors but i am having difficulty in reversing the rotation. Unlike conventional CT scanners, I must rotate the sample. Would anyone be able to help me figure out how to automatically change the case structure form true to false in order to reverse the stepper motor and without stopping the program.
Many thanks
John
Attachments:
motor.vi ‏48 KB

From this point, it is just a matter of figuring out what logic you want to be in place of that control.
You can go by the number of iterations and switch if you go beyond a certain count.  You could go by your rotations completed.  It is just a simple comparison.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines

• Controlling Stepper Motor

Hi All.
I am pretty new to Labview, and am looking for some advice in controlling a set of two stepper motors.  I have some experience with controlling stepper motors, but previously I used Matlab to create a binary script that was read into Labview to create a motion that I desired for the two motors.  Now I am hoping to control the motors using coordinates read in from another system (not an encoder, but a completely different system).  I basically just want the motors to follow the X and Y coordinates as they are read into Labview from the other system.  Any ideas are appreciated.
Thanks!
Jacob

By LabVIEW driver I'm ssuming you mean the DAQ drivers and I'm also assuming since you're using a DAQ to control the motors you don't have an actual motor controller which means you will have to write the code to perform the function of a physical motor controller.
Since it sounds like you're starting with a pretty low-level interface, I would say the next step is to write a wrapper that lets you input a) Step Direction and b) No of Steps to make in the direction
Then you could use that function within what will ultimately be your "motor controller" which will keep track of where the motor currently is based on previous steps, and use that to enable the use of an absolute position your high level input.

### Maybe you are looking for

• Aperture 3.0.2.

• Missing tools in tool pane

i need to remove a link that keeps taking me to an ancient site full of dead links literally everytime i click anywhere to move. I've tried turning off all the settings, blocking it through the trust manager, and even turning off external weblinking

• After upgrading iOS to 7.0.4, I could not transfer:pdf files from email to ibooks ???

Help anyone ??? After upgrading iOS to 7.0.4, I could not tranfer pdf files from email to ibooks. Previously, i would see a message asking for tranfering my word doc to pdf file and pdf file to store in ibooks...

• Save common formats of image

Hi experts, i have developed this code in servlet to save user's uploaded image. bis = new BufferedInputStream(item.getInputStream());                         BufferedImage bImg = ImageIO.read(bis);                         BufferedImage buffImg = new

• 参照Service Contract, 创建Follow-up Service Contract

参照Service Contract (BUS2000112) , 创建Follow-up Service Contract (BUS2000112)这个功能在标准功能里是没有的.例如:一个service contract quotation 其实也是一个service contract, 它的 business object type 是BUS2000112, 那你如果点击 follow up  button 去查找service contract transaction type,那你是找不