LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling a stepper motor with LabVIEW?

A cheap and sleazy way to control a stepper motor is
to use the parallel port to directly output pulses to
a stepper motor amplifier.  The amplifier is actually
4 amplifier legs.  The lowest level of this is to use
4 port lines to produce the counting pulses directly
and output through a set of four amplifiers to the
stepper motor windings directly.  I slightly higher
performance solution would be to output pulse and
direction signals (only 2 lines per stepper) to a
driver circuit and amplifier. 

This driver circuit can be a complex micro-stepping
device like the allegro 3977 device which can output 2.5
amps per phase at up to 35 volts, can do micro-stepping,
and is a surface mount.  A less elegant solution could be
a PIC micro controller that takes in step and direction
and outputs the count for the amplifiers
(see:  http://www.dakeng.com/hardware.html). 
The brute force method would be to create the counts from
step and direction using 7400 series logic. 

The downside to this technique is that windows is not a
real-time OS and you have no real determinism to speak of
on when your pulses will actually make it out the parallel
port.  You might get a cluster, then a gap while the OS is
busy starting your screen saver or checking your mail, then
another bunch of pulses etc.  Depending on your speed
requirements and pulse train period, this can work pretty
well.  But this technique drives the stepper motor in “open
loop” which means that you really have no idea if the motor
actually moved when you asked it to.  So you really have no
idea (only faith) that the stage is in the positions you told
it to be in. 

The lack of feedback with this technique is why no serious
motion control systems use open loop control.  To do your
problem the “right way” you’d have an encoder on the back of
your stepper motor and use the output from the encoder to
control the stepper motor using an actual motion control board. 
But that is serious $$$ compared to the sleazy way I've described
above.  There’s no free lunch.

That said, I have a small bench-top CNC milling machine that runs
open loop stepper motors being driven by allegro chip drivers and
I’ve milled many parts to very tight tolerances with no skipped
steps.  FYI, here’s what I’ve done with steppers on the little
mill:

http://quadesl.com/albums/taig/taig_done.html
http://quadesl.com/albums/stepper.html

Sheldon

Technical geek, engineer, research scientist, biodegradable...
Message 11 of 15
(1,931 Views)

Excellent post Sheldon!

I have a Smithy where my plans are what you have accomplished.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 12 of 15
(1,917 Views)
>I have a Smithy where my plans are what you have accomplished.
 
 
I was hesitant to talk too much about what I've done here because it's really not LabView or NI oriented.  I use TurboCNC in DOS 7.0 to control the steppers (on an HP 486 laptop).  DOS is so simple that it's damn near a real-time OS and I can get away with driving steppers.  The allegro chips are really amazing little devices (and they are very liberal with engineering samples), I designed my own boards based around them and etched them myself. 
 
An important thing about running open loop steppers is to make sure you have beefy steppers and run them a lot slower than they CAN go.  Torque falls off as speed increases, and frictional drag increases with speed.  So at some speed, the steppers start to skip steps and even stall.  The trick is to never get near that point even during rapid moves.  The other important point is that open loop steppers are really cheap to get CNC up and running, but it's a sleazy way to go.  Servos and encoders are the REAL way to do it if you can afford it. 
 
To keep this LabView oriented, I have written CNC "G-code" previewers in labview, and I've done come G-code loop unrollers and code generating utilities.  Nothing ready for prime-time, but lots of useful stuff.  I had brief thoughts of doing the controller itself in Labview, but I quickly put that out of my mind due to the problem with the parallel port under windows.  I could do it with a DIO board, but if I had the $$$ to buy a DIO board for this project, I probably would be using servos... 🙂
 
Sheldon 
Technical geek, engineer, research scientist, biodegradable...
Message 13 of 15
(1,900 Views)
I have done a few applications which controlled a steppers in the past, where labview served as the motion control and interface to a stepper motor system. 
 
 
Does anyone have a good program or suggestion on how to start making a program to control a series of stepper motors through a Anaheim Automation controller that has three axis?
 
I have looked at the site and I cant really find much on how to start--does anyone recommend a good basic labview starting point?
 
I know that I have motioncontrol and labview 7. I know that the hardware is complete and works well, but I have no idea how to control it through labview...
 
Would i want to use a VISA or something?
 
Thanks,
 
NM

Message Edited by Nicholas on 07-28-2005 02:29 PM

0 Kudos
Message 14 of 15
(1,886 Views)

From what I've seen on the Anaheim Automation web site, the controllers they sell are step and direction input or serial port units.  Is your controller a setp and direction unit or a serial port unit?  The serial port ones will work a whole lot better for you.

Yes, in either case, you will most likely be using visa.  The step and direction ones will use the parallel port baring any other hardware (A DIO or motion control board would be better).  The serial ones will be using the serial VI's.

 

Sheldon

Technical geek, engineer, research scientist, biodegradable...
0 Kudos
Message 15 of 15
(1,878 Views)