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.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

stepper motor control with usb-6008

For a senior design project I am required to use a stepper motor.  I need to basically have a pulse train with a fairly high frequency (the higher the better, but around 10k would be great).  We have a USB-6008 DAQ board and I am currently running a while loop to a digital output in order to send pulses, which of course isn't going very fast.  There is no output counter on the device, so I can't do that.
 
My question is if there is any other way to send a high frequency digital (or analog between 5V) output using this DAQ.  If not, is there a way to run it straight to a serial port, like the printer port, and somehow use the clock from the computer to set up the pulses, and will they be fast enough?  Or is there not a way and we should be getting a different DAQ?  Any help would be greatly appreciated.
 
Thank you,
-Robbie
0 Kudos
Message 1 of 17
(5,183 Views)
Hi Robbie,

As you've seen by using a while loop to drive your digital output, this is not very tightly timed.  The digital input/output on the USB-6008 is software timed, so it will only change values when you call the digital write function in your program.  Typically, to drive something like a motor, you would want to use a counter to generate a pulse train to do so.  This is much more tightly timed and can output higher frequencies.  Unfortunately, with the USB-6008, the on-board counter is a simple event counter, and you cannot generate an external output signal from this counter.

If you're looking at another USB DAQ device to do this, a possibility something like the DAQPad 6015 or 6016.  The counters on these devices should be able to handle a pulse train output of 10 kHz pretty easily.  You may want to call in to speak with one of the NI technical representatives, as they can give you a good recommendation on what devices will fit any other needs you have for your project.

Thaison V
0 Kudos
Message 2 of 17
(5,169 Views)
What are you driving the stepper with? Have you created your own driver circuitry and need to feed it a pulse train to drive the transistors on and off in sequence? If you can use an off the shelf step motor driver (Compumotor drives come to mind) you could just use the AO of the 6006 to supply a DC control voltage to vary  the speed and direction of the motor.
 

Message Edited by Go With the Flo on 02-22-2006 11:29 AM

0 Kudos
Message 3 of 17
(5,163 Views)
Hey, thanks for the advice.  I just wanted to make sure I wasn't missing something we could do with our current DAQ.
 
We are driving the motor using a microstep driver off the shelf.  To use the AO, would I just generate a square waveform and output?  I know the AO on the usb-6008 only updates around 150hz, so I can't do it on that.
 
Money is kind of an issue for our senior design group (we spent most of it already) so I've been trying other things.  I am now generating pulses from a 555 timer chip with the frequency varying by changing the resistances in the circuit.  This gives plenty high frequencies, but there is little control.
 
We just heard we may be able to snag a DAQ from one of the other labs, with an onboard counter out.  This would solve our problem, but otherwise I am falling back on the 555 timer.  Any other suggestions would be great.  Thanks again,
-Robbie
0 Kudos
Message 4 of 17
(5,152 Views)

I'm trying to recall how I used the stepper drives before but I believe that there will be two control voltages. One is for direction and the other is for steps to move. There may also be travel limit inputs that can be connected. It may also depend on how the motor is used i.e step and direction or just velocity. Verify with the manual that came with the drive to determine how to control the motor in the mode you need. It sounds like you have got that part mostly worked out.

You may need a quadrature type control pulse trane to be able to control direction in step mode. Velocity mode is just a + or - voltage but you cant say how many steps to move in velocity mode. Chips are available that will take a regular square wave and produce a quadrature output. I dont know if NI has anything that will generate an output like that readily.

0 Kudos
Message 5 of 17
(5,132 Views)

Hi Everyone-

NI doesn't offer an application specific chip to produce quadrature-encoded outputs, but the entire operation could be controlled relatively easily using the counter outputs of another DAQ board if it is available.  The software-timed nature of the analog outputs on the USB-6008 means that it will be non-deterministic and the frequency will vary with system activity.  This situation is definitely not desirable if you're trying to precisely control the speed/direction of a motor. 

Robbie, if you can snag that other DAQ card it would be ideal.  Let us know if it's available and we can help with some suggestions of getting started with programming the onboard counters.

Hopefully this helps-

Tom W
National Instruments
0 Kudos
Message 6 of 17
(5,124 Views)
I wasn't implying that NI sold chips. Digikey or Newark would be good places to look for semis.
0 Kudos
Message 7 of 17
(5,115 Views)

Hi Go-

I didn't mean to imply that you were suggesting that NI could provide the chip-based solution- I just wanted to make it absolutely clear that we do not.  Regardless, it is a great suggestion- thanks for your inputSmiley Happy

Tom W
National Instruments
0 Kudos
Message 8 of 17
(5,109 Views)
Hey, thanks for the other info, but we have been able to borrow a nice daq from another lab, so now we are just using the counter output, which is controlling the motor fine.  However, I do have one more question.  We are also taking in some analog data and I was hoping to be able to match it up with the counter output relative to time.
 
I am taking analog data at 1000 Hz using a buffer and am not sure of the best way to compare that to the counter output.  Since my motor is running at a constant speed, I have just been taking the frequency of the counter and multiplying it by the total time.  So, if I ran it for 3 seconds at 2000 Hz, I would have 3000 analog points with the motor moving a total of 6000 steps.  So for each analog point, the motor moved 2 steps and I can make a table and plot this.
 
However, I assume there is probably a better way.  Can I take samples of the counter, like at 1000 Hz to match up with the analog data, so then I can instantly have a table with the number of motor steps and the analog data.  The DAQ board does have another available counter.
 
Thanks again for any help,
-Robbie
0 Kudos
Message 9 of 17
(5,082 Views)

Is this for a tachometer?

Since you seem to have a known step rate, your approach makes sense to me to be able to use as a positon/speed feedback loop. Assuming the type of encoder is analog and not digital. Such as a resolver. Speed would be represented in the frequency of the voltage and position would be the signed value of the voltage.

0 Kudos
Message 10 of 17
(5,076 Views)