Motion Control and Motor Drives

Showing results for 
Search instead for 
Did you mean: 

Using USB-6008 for closed loop motor control

Using USB-6008 for closed loop motor control

Hi all,

I'm having problem designing a PID closed loop dc motor control. I was told that the NI USB-6008 is not good for this application, but this is the only DAQ card i can work with.


I wanted to use analog input for rpm measuring and analog output for PWM signal, there's an encoder sensor for rpm measuring.


I'm having hard time to understand the timing for this project,  the dt(s), dt out(s), and the DAQ timing, i wanted to know how to set these values.


When i split the VI i'm able to measure the motor's rpm, the problem is on the pwm output part. Below is the VI i'm working on, please help me figure what problem is in my VI.





0 Kudos
Message 1 of 12

Re: Using USB-6008 for closed loop motor control



I guess, you are using a USB-6009, as a USB-6008 doesn't provide analog outputs. As you have stated correctly, this device is anything but ideal for control tasks. Here are some reasons:


  • The maximum AO rate is 150 S/s, which is pretty slow for control tasks
  • You only can use this device under Windows, which results in non-deterministic timing and in many cases to unstable control behavior

Still, if you want to give it a try, better use a counter on the device for the PWM generation, as this allows a much better timing resolution.

For help with the tuning process, please refer to this document. Please note, that this document is written for NI motion control products, but you still can learn a lot about the impact of the PID terms.

Again, please note, that there is a great chance, that you end up with a lot of work and a poor solution with your current setup. Please have a loot at these related links (1, 2) and at


Kind regards,

Jochen Klier

National Instruments



0 Kudos
Message 2 of 12

Re: Using USB-6008 for closed loop motor control

Uups, someone replied already!
Message Edited by Krisna Wisnu on 12-15-2008 02:29 AM
Certified LabVIEW Developer (CLD)
Certified TestStand Developer (CTD)
Using LabVIEW 8.5.1 (2008) to LabVIEW 2016
0 Kudos
Message 3 of 12

Re: Using USB-6008 for closed loop motor control



Thanks for the reply. I'm sure that this is the USB-6008 because there is no counter I/O in this DAQ. Then i found 2 AO port here at the analog side of the DAQ. My question is how i'm going to design the program so that it will be able to use AO port to output PWM signal, please give me some direction on what VI i can use or a sample VI. Basically the program flow like this, duty cycle is the output from, then it will be converted to PWM and send to DAQ. If possible please take a look at the VI i attached earlier(


Maybe the solution is poor but please provide me more info on doing this. Thanks for those who read this.



0 Kudos
Message 4 of 12

Re: Using USB-6008 for closed loop motor control

Hi Choong,


sorry, I mixed up some things. You are right. The 6008 provides 2 AOs, but the counter can't output a pulse train. Still these outputs provide a maximum update rate of 150 S/s. This is not enough for any reasonable kind of PWM signal that I could think of. E. g. if you generate a 50 Hz PWM signal, the timing resolution allows you to vary the PWM in exactl 4 discrete steps (0%, 33%, 66% and 100%). This doesn't sound like a reasonable approach to me.


Sorry, but this is really the wrong hardware for your application.




0 Kudos
Message 5 of 12

Re: Using USB-6008 for closed loop motor control



Can i know how to set an initial PV because when the motor not running my RPM is infinity.


0 Kudos
Message 6 of 12

Re: Using USB-6008 for closed loop motor control

Hi Jochen,


I'm interested in the same problem. If the 6008 is unsuitable for this application, then kindly suggest a suitable device for this problem. Thanks in advance.

0 Kudos
Message 7 of 12

Re: Using USB-6008 for closed loop motor control

For closed loop servo motor control you could use a motion control board like the PCI-7342. This board runs the control algorithm in realtime on board and provides an easy to use API.


There are several other options but the key takeaways should be, that a) USB DAQ is not a valid solution for motion control tasks and b) deterministic realtime control is mandatory in most cases.


If you need further advice, please provide more specific information about your application requirements.



0 Kudos
Message 8 of 12

Re: Using USB-6008 for closed loop motor control

I seemingly have a similiar design problem to these other users, and for me, my application is very cost sensitive.  The 6008 unit costs $169 whereas some of the other mid-range options cost nearly 10x the $ amount. I noticed the one you quoted for instance is $1200.


Perhaps there is some link/guide/info somewhere that you might know of to help newer Motion control users like myself weigh the capabilities/limitations of the lower cost options to the capabilities/advantages of the higher cost options to figure out the absolute minimum cost needed for our applications?






0 Kudos
Message 9 of 12

Re: Using USB-6008 for closed loop motor control

Unfortunately I don't know a general decision matrix, that would help to select the most cost effective solution for a given set of requirements, but if you could post a description of your application and your motion control requirements here, I could provide at least some advice.


Please try to provide comprehensive information about what you are trying to accomplish. For the pure motion control part, please provide information about the following topics:


  • Motor type (servo, stepper, piezo,...)
  • Number of axes
  • Motor power and load inertia
  • Mechanical stage (rotational, lead screw,...)
  • Control type (position, velocity, torque)
  • Maximum velocity (rpm)
  • Required accuracy
  • Axis synchronisation (coordinated moves, gearing, camming,...)

There are many more parameters in this equation but I think you should get the idea, so please add whatever information could be relevant.


Depending on your requirments we might be able to find a low budget solution but it's very likely not a USB-6008, which is really by far the most improper NI product for motion control tasks.




0 Kudos
Message 10 of 12