Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

How can i use USB 6009 with a quadrature encoder for measuring angular speed?


      I want to measure instantaneous angular speed using a quadrature encoder and a USB 6009. I have come across discussion threads on this question but no satisfactory answers. Request any possible assistance. Even if I can get angle measurements at regular intervals of time, that should solve the purpose. I am using a HEDS 5540 incremental encoder. Would appreciate an early reply..

0 Kudos
Message 1 of 8

Hi Vikrant and welcome to NI's discussion forums!


The 6009's counter does not natively support encoder measurements. This counter supports only basic edge counting (falling-edge) so you may be able to implement a scheme for measuring one direction angular position. Using two or three analog inputs, you could possibly create a bi-directional angular position application.


Neither of these implementations are recommended and I recommend using a device that is more applicable. These have counters with more functionality and which include native driver support for angular encoder applications. These devices include the M-Series line of products or the Counter/Timer boards.


KB 47B5TIMK: Can I Use an Analog Input for a Count Edges or Encoder Task Using DAQmx?


This document is about programming an FPGA but contains good information about the logic required in developting your own angular position app:


Quadrature Encoder Velocity and Acceleration Estimation with CompactRIO and LabVIEW FPGA

Message Edited by PBear on 09-11-2008 04:20 PM
Message 2 of 8

Hi PBear,

    First of all, thanks for the prompt response. If it is not possible for me to get the angular speed from the set up, is it possible to get a time stamped angle measurement for rotation? is it possible for me to use the onboard clock for counting pulses? I was working on the PCI 6221 before this for speed measurements. I developed two VIs , one for generating the pulse train and the second for counting the pulses. I switched over to the 6009 for mobility...... as I had to carry out my expts elsewhere. What i did with 6221 was to get angle measurements at the sampling time that I wanted(  I am looking at sampling frequencies in the range of 2000-3000Hz) and subsequently analyze the data in MATLAB 7.   So even if i can get a reliable database of angle measurements at fixed periods of time(say every .0005 sec) i should be able to do the job. Please help me if you can on this aspect.



0 Kudos
Message 3 of 8

Hi Vikrat,


The USB-6009 is a very limited device and all angular measurements will be difficult to implement. Your technique on the 6221 will not pan over to the 6009 as it's a very different device. We do have a USB 6221 and also some bus powered M Series devices as well. The 6009 has one counter so generating a pulse train and counting it are not possible. You'll need to create the implementation for angular position yourself using the above ideas.

0 Kudos
Message 4 of 8

Hi PBear,

       Been a while..... i had a few queries and was hoping you could answer them. I am now using a PCI 6221 M-series DAQ card with an HEDS 5540 encoder (500  counts/rev) for measuring the Instantaneous Angular Velocity. I'll explain the setup in brief....... I have  connected counter1-out to counter0- gate and one channel of the encoder to counter0 - source. I am using the generate pulse train and the measure angular position buffered finite from the Labview Examples, for measuring the angular positions at the specified sampling time. Now i'm writing the data from the second vi onto a spreadsheet file and manipulating this spreadsheet in MATLAB to give me the instantaneous angular velocity at the specified sampling time. Having found the frequency spectrum corresponding to this data, i found the results unsubstantiated and inconsistent. My questions are

       a) Is this a correct and optimum method for measuring the Instantaneous angular velocity?

       b)   Is the input from the encoder channel being compared with the pulse train being generated by the first VI or is it being compared with the onboard 1Mhz clock pulse for giving the angular measurement?
       c)   When i specify a sampling rate, does it mean that the angular position being indicated is at each multiple of  the sampling time?
       d)   When the angular position is being measured, is it a continuous process or are there any speed pulses which are getting skipped in between?
       e)   I am using the data output and storing it in a spreadsheet using the write to spreadsheet vi. I am now using the spreadsheet in MATLAB to give me the instantaneous angular velocity by simple subtraction of two adjacent data points and dividing by the sampling time. Is this a correct procedure?
       f)  I am using an HEDS 5540 encoder having 500 CPR. What is the minimum value of angular speed/variation in angular speed that I can measure? (each pulse would correspond to .72 degrees ..... i guess). Would it be correct to say that the factors affecting this would be the encoder resolution, the sampling frequency and the clock speed? 
I ask these questions because i have been getting inconsistent spectral data from the measurements. It is quite possible that the method I have adopted is wrong and therefore the inconsistent results. I hope you could provide an early reply. Please excuse the numerous repititions.... i wanted to provide you as much data as i could so that u could provide some useful insight.


0 Kudos
Message 5 of 8

Hi Vikrant.


The answer to your questions are as follows:


a) Yes ,this is a correct and optimum method

b) It is being compared to onboard clock


d)If your sampling speed is not too high,it is a continous process.

d) Yes it is. 

e) Yes ,these are the factors being affected.

0 Kudos
Message 6 of 8

every time I read these threads I cant help but nottice National instrument reps forcing users to buy another product / always trying to sell me something else and will not support a product unless you recently purchased it. A $20 arduino board and the world of arduino users are eager to see me get to the ends without spending on the means... NI needs to try to help people who already purchased thousands of dollarrs of equipment and update software repetadly or we will go elsewhere. all VIs that were contributed by users in the past are now becoming NI pproprietary VIs in new versions... thats theft!

-Mark Pasieka

0 Kudos
Message 7 of 8

Yes, you can, but using a cuadrature clock converter, as LS7084, that gives you a clock output that you can connect to NI6009 digital input (speed or count) and a UP/DOWN signal, to connect to other NI6009 digital input (increment/decrement counter or direction)


0 Kudos
Message 8 of 8