LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Speed measurement using Incremental Rotary Encoders

Hi All,

 

I've gone through some discussions earlier and was not sure this reflected anywhere. Possibly due to the ease of carrying this out 😛

 

Now I have an Incremental Rotary Encoder coupled to a Motor. I want to measure the speed (or velocity every revolution).

 

I am using a NI USB 6211 for DAQmx. I have tried using CI Angular Encoder in DAQmx but the output doen't look good.

 

I think I am supposed to put the output to a DAQ Read and the n display the data bit. But no results.

 

I have also tried to divide the output by a Sampling Clock, elapsed ime, counter pulses, etc. But no satisfactory results.

 

Couls someone please help with a .vi of some sort?

 

Thanks a Lot!

Srisagar

0 Kudos
Message 1 of 11
(7,703 Views)

You can create a timed buffer quadrature encoder task and then calculate the derivative to get velocity.  Another

approach is to setup a pulse width measurement using just one of the encoder channels and convert to velocity in your code.  Unfortunately DAQmx scales do not do reciprocal  type scaling so you need to handle that yourself.  One cool possibility is to write to a TDMS file which does support cascaded scales of this type.

 

http://zone.ni.com/reference/en-XX/help/371361G-01/glang/tdms_create_scalinginfo/

Message 2 of 11
(7,697 Views)

Would be you be kind enough to elaborate on the buffer-derivative method?

 

Thanks!

0 Kudos
Message 3 of 11
(7,683 Views)

Basically, you will sample the count at a constant rate and can then do post-processing to figure out your derivative.  I've attached a VI that shows this.  The idea is that we use one counter to generate a new sample clock so that we can control the rate at which we sample the position (Otherwise we are sampling using the internal clock, which is way too fast for this). You will probably want to smooth out the position signal you receive because the value will always be a whole number, so you'll never get a smooth derivative without some sort of filtering.  

 

Jon S

Applications Engineer
National Instruments
0 Kudos
Message 4 of 11
(7,662 Views)

Here is another example of buffered pulse width measurement

 

https://decibel.ni.com/content/docs/DOC-12399

 

If the velocity is stable then just do a best linear fit on a section of the data and use the slope as your derivative.

0 Kudos
Message 5 of 11
(7,657 Views)

Hi

 

Now, this link does not work. Could you please show the example anagin? Thanks!

0 Kudos
Message 6 of 11
(127 Views)

Hi Zhangfy,

 


@Zhangfy wrote:

Now, this link does not work.


After 13 years links tend to get broken.

(Even more so in the LabVIEW board due to several re-designs.)

 


@Zhangfy wrote:

Could you please show the example anagin?


Did you look for counter examples in the example finder? There are a lot of examples for DAQmx!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 11
(119 Views)

Hi GerdW

Thank you very much! I found the examples in the following link.

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000004B6mSAE&l=de-CH

0 Kudos
Message 8 of 11
(108 Views)

The Sound and Vibration Toolkit also ships these VIs:

dsbNI_0-1730670723639.png

 

dsbNI_2-1730670770018.png

 

If you have the SV Toolkit installed or your organization has a license for it, I would suggest using the toolkit VIs. They handle the basic calculation as well as common issues that arise when using counters (such as missing pulse or counter rollovers when using event count).

Doug
NI Sound and Vibration
0 Kudos
Message 9 of 11
(98 Views)

Hi dsb@NI

 

I have checked the Sound and Vibration toolkit in my NI packet manager. It has not been installed. I will try it.

Before I install it, I want to ask you.

Can I use it for the incremental encoder with Signal A, Signal B and Signal Z for the absolute position measurement?

0 Kudos
Message 10 of 11
(83 Views)