07-19-2024 03:30 PM
I am using a quadrature encoder (CPR = 1024) to measure the rpm of a motor. For data acquisition, I use NI USB-6210. I am using one of the example VIs on LabVIEW to acquire signals from the encoder and have confirmed the physical location of the z-index. What I need help with is the way I am calculating the motor RPM. I use 'change in encoder angle per unit change in time' to give me the speed of the motor. This works fine except when the z-index resets the encoder angle to zero. How do I avoid this issue?
Thanks,
lza
Solved! Go to Solution.
07-19-2024 04:03 PM
If all that you need is rpm using a quadrature encoder, use the DAQmx CI Velocity Angular
It will readback the value in rpm, it would ignore the Z-index.
07-20-2024 10:15 PM
Thank you for your suggestion, Santhosh. But I need both the RPM and the z-index enabled. What changes can I make in the existing program to continuously get the correct values of RPM?
-lza
07-20-2024 10:36 PM
I misunderstood the comment initially, but I got it now. For reference, this page explains it well: https://forums.ni.com/t5/Example-Code/Measure-Angular-Position-and-Velocity-with-a-Single-Counter-an....
Thanks,
lza
07-20-2024 10:58 PM
@laz_2331 wrote:
Thank you for your suggestion, Santhosh. But I need both the RPM and the z-index enabled. What changes can I make in the existing program to continuously get the correct values of RPM?
-lza
I am not expert at counters, I would wait for Kevin to share his wisdom.
In the meantime, if possible, I will connect the encoder to two counters, and set up the first counter for angular position and the other for angular velocity. This way, you get RPM and position simultaneously, but use twice the resources.
07-22-2024 10:05 AM
The link that I shared in my earlier post explains acquiring the angular location (z-index enabled) and simultaneously calculating RPM using one counter. In my initial attempt, shown in the VI attached with the first post, I was able to do the same. However, the problem remains: whenever the z-index resets the angle from, say, 359 to 0, the change in angle (delta theta) is -359deg which creates an erroneous dip in the RPM value. I am planning to control the RPM using a PID controller. This dip/spike would create troubles there.
07-22-2024 02:16 PM
I am now using NI 9361 Counter Input Module with cDAQ 9178. For this module, the correct terminals for Ctr 0 are: A-PFI0, B-PFI4, Z-PFI-7, and those for Ctr 1 are: A-PFI1, B-PFI5.
I wrote two separate VIs, one for angle measurement (CI-angular-encoder) and the other one for rpm (CI-angular-velocity). When I run them separately, they work fine, but once I run the two tasks inside the same VI, I get an error: "Error -50103 occurred at DAQmx Start Task.vi:7220003. The specified resource is reserved. The operation could not be completed as specified."
What do I need to do differently?
07-22-2024 02:24 PM
@laz_2331 wrote:
I am now using NI 9361 Counter Input Module with cDAQ 9178. For this module, the correct terminals for Ctr 0 are: A-PFI0, B-PFI4, Z-PFI-7, and those for Ctr 1 are: A-PFI1, B-PFI5.
I wrote two separate VIs, one for angle measurement (CI-angular-encoder) and the other one for rpm (CI-angular-velocity). When I run them separately, they work fine, but once I run the two tasks inside the same VI, I get an error: "Error -50103 occurred at DAQmx Start Task.vi:7220003. The specified resource is reserved. The operation could not be completed as specified."
What do I need to do differently?
"Resource is reserved" means you don't have enough counters to setup two CI-angular tasks.
07-22-2024 02:39 PM
The spec sheet says that this module can be used for the velocity and position of the quadrature encoder. https://www.ni.com/docs/en-US/bundle/ni-9361-specs/page/specs.html
07-22-2024 03:44 PM
@laz_2331 wrote:
The spec sheet says that this module can be used for the velocity and position of the quadrature encoder. https://www.ni.com/docs/en-US/bundle/ni-9361-specs/page/specs.html
Absolute, you can, but it did not state that you can have two instances of them.
Let us consider this analogy: you have a car at home, and both you and your partner can drive the car, but not both at the same time because there is only one car, and resources are constrained.