02-08-2010 04:20 AM
Hi,
I am trying to measure the angular velocity of motor shaft with an angular encoder connected to counter input of BNC 2120.
I found this vi file in the forum in a discussion by macabe and duy.
I am trying to do it similarly..and i am getting some values as data; but please can anybody help me as i dont understand what degree or radians the position data is in and the velocity too if it is in rad/sec or deg/ sec etc...
the encoder iam using gives 3600 pulses /revolution.Is there any way to graphically view the position / velocity data while the vi is running .
regards,
ruser.
Solved! Go to Solution.
02-09-2010 05:08 PM - edited 02-09-2010 05:11 PM
Hello,
A better approach on determining the angular velocity is using the the 2nd counter of your NI device that is attched to the BNC 2120, to generate a clock for the first counter. This will provide a deterministic amount of time between sampling the count. The example attached subtracts the counts (i.e. current count minus the previous count) on every loop iteration. By using a sample clock, the exact time between each sample can be determined, hence the RPM can be calculated.
The example provides feedback on the Number of Revolutions, Position in Degrees (an indicator can be connected to the position output for viewing e.g a Gauge indicator, set it to 0-360) and the RPM (rotations per minute). Mathematical manipulation of this output (RPM) can provide you with the angular velocity in radians per second or rps (rotations per second).
Additionally, if you wish to use only one counter, please refer to the following community example:
1. http://decibel.ni.com/content/docs/DOC-6834
Regards,
Ali M
Applications Engineer
National Instruments
02-09-2010 10:55 PM
Hi,
Thanks a lot for the sugeestion..
i have only labview 8.5 in my computer hence i could not view the files u sent coz they are in labview 9.0 version..
i have connected a.b and z phases of the encoder..( to counter 0 ..PFI 8,2 and 9 respectively) do u mean to connect the b phase to counter 1 while a phase is connected to counter 0?
it would be great if u can provide a screen shot of the vi u sent me...
thanks again..
regards,
fesmi
02-10-2010 05:17 PM
Hello Fesmi,
No changes are required for counter 0/connections to your encoder. You will use Counter 1 of your NI device as the Sample Clock Source i.e. /DeviceName/Ctr1InternalOutput. LabVIEW 8.5 version of the example has been attached.
Regards,
Ali M
Applications Engineer
National Instruments
02-16-2010 03:31 AM
Hi,
Thank you for the program, i tried it and it works great...
i am not sure how to mark the mail as the answer.. though,...
😮
now that i have the speed data iam trying to use the data for a feedback PID controller with the experimental set up..
however , when i try to run the program , i get an error which says to increase buffer size or the number of samples..
i have attached my vi file here..
should i put the getting velocity and doing the PID feedback in two flat sequences , is the error due to the manner in which the program is working?
i tried by doing the PID feedback inside and outside the while loop..
the same error comes...
i have also put the sample rate as 1000 Hz in the front panel..
any suggestions?
thanks again ,
regards,
fesmi
02-16-2010 08:14 PM - edited 02-16-2010 08:20 PM
Hello,
If you are using the NI USB-9219 (device name saved in your DAQ Assistant), please make sure that the sample settings are within the device specifications. Since the NI-9219 module, has a maximum sampling rate of 100 samples per second per channel for simultaneous inputs, or 50 samples per second per channel for thermocouples; a good recommendation would be to reduce the sampling rate of the application; if the NI USB 9219 is not the device you are using, please look into the documentation of your device to implement changes that would reflect those requirements.
1. How to set the sample rate of the NI-9217/9219:
http://digital.ni.com/public.nsf/allkb/1015F4182FB8A805862572D1006B4CC1?OpenDocument
Regards,
Ali M
Applications Engineer
National Instruments
02-17-2010 12:36 AM
Hi
iam using PCI 6251 which has a sampling rate of 1.25MS/s...
.....?
fesmi
02-17-2010 02:08 AM
Hi,
i tried sequencing the vi with flat sequence, i am attaching the new vi...
the error still comes.. i have also pasted the error..
any suggestions??
fesmi.
02-17-2010 12:26 PM
Hello,
This error is caused by the DAQmx Read VI (not the sequence of the code). Due to the calculations/software architecture of the example I posted, the DAQmx Read VI is set to read only one sample at a time; hence running the code at very high rates would cause the samples to be overwritten by the DAQ card; which in turn would display the DAQmx Read Error -200279. One way to resolve this error would be to reduce the Sample Rate of the Clock Generation Task on the Front Panel to be between 5Hz-60Hz. If you wish to make changes to the code to accomodate higher rates, changes to the DAQmx Read would need to be made (i.e. Counter>Multiple Samples>U32). This approach will require you to change the overall design of the code accordingly. Below is a link that provides additional information regarding DAQmx Read Error -200279.
1. http://digital.ni.com/public.nsf/allkb/AB7D4CA85967804586257380006F0E62?OpenDocument
Regards
Ali M
Applications Engineer
National Instruments
02-24-2010 08:09 AM
Hi,
Thanks for the last reply.. i changed the sample rate to 30 Hz and its working fine now.. alhamdulillah..
due to changes in the project i had to fix one more such rotary encoder so i fixed it to a new bnc 2120 , coz when i tried to connect them both to same bnc couter 0 and counter 1 ,inputs an error always shows up...it asks to either increase sample rate or get ext clock.. both i didnt understand..
anyway now iam tryiong to get the speed data from two encoders simultaenously and trying to do pid feedback..
i put everything inside while loop , coz outside while loop wasnt working well..errors again.. however now i get very high rpm readings which are wrong !!!..
pls can u have a look at my vi and inform the mistake??
thanks
regards,
fesmi.