LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Incremental Encoder Velocity VI Help

Howdy Everyone,

 

I am currently working on a project that requires me to get the velocity of an incremental encoder with 2 channels A and B. I already have the counts for A and position but I still did not find any VI that calculates velocity. I am currently using a Wireless Data Aquistion System "WLS-9163" with NI-9215 module.

 

Any help would be really appreciated.

 

Thanks.

Mechanical Engineer
0 Kudos
Message 1 of 11
(2,688 Views)

Can you record a timestamp each time you record the position from channel A? With that information you could easily compute speed. As for velocity, does your device record direction or just counts? If you don't know the direction your device is traveling, then I don't see how you will get velocity. However, I do see how you can get speed with a timestamp coupled with your counts data.

0 Kudos
Message 2 of 11
(2,683 Views)

 

Velocity is:

 

Actual Sample - Previous Sample / Sampling Rate.

 

1.Create Channel: CI - Position Linear Encoder

 

2. The sample rate can be set using the Sample Clock Vi. One of the inputs is Rate.

 

3.Use Counter 1DBL 1Chan N Samples in order to set the number of samples read.

 

 

 This way you'll get an array with "position values" sampled using the specified rate (at 2.). So you have to compute:

pos[i] - pos[i+1] / rate  =>> velocity

 

Paul

 

PS: Sorry for VIs in German but I think it's easy to find them also in English, in DAQmx

0 Kudos
Message 3 of 11
(2,680 Views)

Have you looked at this Knowledge Base article?

http://zone.ni.com/devzone/cda/tut/p/id/4623

 

 

______________________________________________________________________
0 Kudos
Message 4 of 11
(2,677 Views)
Re: Incremental Encoder Velocity VI Help

Can you record a timestamp each time you record the position from channel A? With that information you could easily compute speed. As for velocity, does your device record direction or just counts? If you don't know the direction your device is traveling, then I don't see how you will get velocity. However, I do see how you can get speed with a timestamp coupled with your counts data.

 

Yes, I can record the time when each position measurement is taken. My VI records counts as well as direction of rotation and counts up/down based on that.

Mechanical Engineer
0 Kudos
Message 5 of 11
(2,672 Views)

Getting velocity from timestamps may not be all that accurate, unless the encoder signals are slow (ie milliseconds).

How fast is each encoded signal?  ie time between peaks..

 

If you need accuracy, you may need to look at alternatives..

 

BTW, did you mention which OS you are using?  We all think people develop in WIndows...  often we're wrong 😉

______________________________________________________________________
0 Kudos
Message 6 of 11
(2,663 Views)

It depends on what RPM the wheel chair is moving on. I am using Windows OS currently.

Mechanical Engineer
0 Kudos
Message 7 of 11
(2,658 Views)

Hi "Student",

 

I don't know why you search for complicated solutions.

 

You can use a counter configured for Reading Incremental Encoder.

This way you can get everything you need:

 

1. direction: check two consecutive samples:

- if Sample[n] > Sample [n-1] then positive direction

- if Sample[n] = Sample [n-1] then not moving

- if Sample[n] < Sample [n-1] then negative direction

 

2. speed: you must specify the sampling rate for Reading Incremental Encoder. You can say for example 10kSamples/second. If Sample[n] = 110 increments and Sample[n-1] = 100 increments. Then you have: 10 increments * 10k / second. 100k increments / second. If an increment is 0.001mm you have 100mm/second.  <<<--- See my previous post. Use Sampling Clock vi.

 

Don't use timestamps for something like this. There are software delays, the 1ms of the labview loop and many other stuffs than cannot be taken into account. If you use a Sampling Rate the acquired data are stored in the hardware buffer and there is no way to make mistake.

 

Paul

Message 8 of 11
(2,652 Views)

Follow Paulie's advice..

 

Is this the same issue as discussed in your other thread?

 

http://forums.ni.com/t5/LabVIEW/2-D-Path-Road-Help/m-p/1528102#M568660

______________________________________________________________________
0 Kudos
Message 9 of 11
(2,640 Views)

No, it is a different issue. I will try Paul's advice and see if it works.

Mechanical Engineer
0 Kudos
Message 10 of 11
(2,628 Views)