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.
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.
04-18-2011 11:09 AM
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.
04-18-2011 11:26 AM
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.
04-18-2011 11:39 AM
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
04-18-2011 11:41 AM
04-18-2011 12:21 PM
04-18-2011 11:26 AM
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.
04-18-2011 01:17 PM
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 😉
04-18-2011 02:46 PM
It depends on what RPM the wheel chair is moving on. I am using Windows OS currently.
04-18-2011 03:25 PM - edited 04-18-2011 03:30 PM
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
04-18-2011 07:33 PM
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
04-18-2011 10:44 PM
No, it is a different issue. I will try Paul's advice and see if it works.