Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

Help Using Labview 8.6 to send pulses to accelerate stepper motor motion profile

Hey everyone,

 

I am currently working on a research project that requires me to use Labview to send pulse signals to a stepper motor to cause it to rotate.  Ultimately, I need to create a motion profile in which the stepper motor accelerates to a constant speed and decelerates - this will be done by creating a profile on Labview that has increasing pulse frequencies.  Although I have browsed through a lot of posts, I am still unsure about how to start to set up my block diagram and successfully use the DAQ assistant in labview.

I am using a 5-phase stepper motor of PK564PMA and CRD5114P driver from Oriental Motors and NI PCI6229.

 

How would I begin set up a block diagram in Labview 8.6 to cause the stepper motor to rotate to fit my motion profile?

 

I am relatively new to Labview and any input would be greatly appreciated.  Thanks a lot!

0 Kudos
Message 1 of 6
(7,602 Views)

Hi theodyssey12,

 

Welcome to the NI Discussion forums! Is it a PWM signal that you need to send to the motor driver? Or is it a standard stepper signal pair (STEP and DIRECTION or CW/CCW) signal that you need to provide? In either case, I would recommend moving away from the DAQ assistant and coding with the DAQmx VIs directly, as the DAQ assistant sacrifices some code efficiency for user-friendliness. You can take a look at this example: http://www.ni.com/white-paper/2991/en to see how you can implement PWM, and if you just need to vary frequency and not duty cycle as well, the code in figure 2 should help you achieve this.

Message 2 of 6
(7,575 Views)

Thanks a lot - for now, I am just looking for a pulse width modulation signal so that I can see the motor rotate using Labview.  I have downloaded the block diagram code in Figure 2 and ran it, but I did not get the stepper motor to turn.  I also tried hooking it up to an oscilloscope and also did not see any results.  I think that there is a problem with how I am routing the commands in the task in/out and counter(s).

 

Using the block diagram in figure 2, I set the counter(s) to dev2/ctr0, frequency to 2 kHz, duty cycle to 0.50, idle state low, and 0 initial delay.  Using the lightbulb highlight feature, it appears that the block diagram flows and is OK, but there is still no ultimate output.  Could you please explain how I can configure the counters and route the task in/out to properly get an output signal to send to the motor for rotation?  Also, could you explain the application of MyDigitalOuttask and what is accomplished by setting up new MAX tasks?

 

Thanks a lot for your help!

 

0 Kudos
Message 3 of 6
(7,573 Views)

Which physical channel were you reading from? For your M-series PCI 6229 card, counter 0 is routed to PFI 8 by default (http://www.ni.com/pdf/manuals/371022k.pdf page 7-30). Did you probe this line with the oscilloscope and not see any signals?

 

What is "MyDigitalOuttask" referring to? Is this a task you defined in MAX under Data Neighborhood > NI-DAQmx Tasks? Tasks in MAX are an alternative way of setting up the task programatically in LabVIEW. In your case, step 1 of the "Pulse Train Gen" VI sets up the DAQmx task as a counter and assigns the physical channels and task-specific parameters (frequency, duty cycle, etc). Instead of doing this in LabVIEW, you can setup a task in MAX and reference the task in LabVIEW. Both approaches will result in the same behavior. 

Message 4 of 6
(7,560 Views)

Hey Joseph,

 

Thanks for your reply - actually, I have tried a different approach to rotating my stepper motor.  I have been using PFI8 and counter 0 and I set up a digital waveform (in attached file).  From here, I set up digital data using 1 channel and have been trying out binary sequences of 0's and 1's to create pulses.  I used a while loop to continuously send this digital waveform output through to my DAQ (I am using DAQmx.) 

 

When I hooked it up to my stepper motor, my motor does move in 1 direction however it jitters back and forth.  Usually when hooked up to a regular function generator, it doesn't have this problem.  So, when I hooked up my DAQ output to an oscilloscope, I noticed that there were two problems.  First, there was a lot of jittering between each consecutive pulse from my digital waveform.  Also, there was a huge gap between each set of pulses which was unaffected.

 

Is there a digital timer problem that causes the jitter between waves?  If so, how could I fix this problem?  If not, how could I change my programming in Labview to ensure that the pulses are steady?  Also, how can I address the huge gap between the set of pulses (changing dt didn't do anything to the output for some reason)?

 

As a side note, are there any ways to easily program a set number of pulses in a digital waveform so that I can have my stepper motor accelerate, move at a constant speed, and decelerate?

 

Thanks a lot - I really appreciate your help,

Mitchell N.

0 Kudos
Message 5 of 6
(7,556 Views)

Never mind - I found my problem and managed to fix it.  Attached is a working block diagram that outputs digital signals (I still have to put 0's and 1's in the digital array to get it to work).  However, I have encountered another problem. 

 

Now that I have a digital waveform output, how can I change the digital array using a program/algorithm to have the pulses get shorter in order to accelerate the stepper motor, have it move at a constant speed, and decelerate?

 

Any input would be greatly appreciated.  Thanks!

 

0 Kudos
Message 6 of 6
(7,547 Views)