07-21-2014 12:06 AM
I want to measure the rotational speed of a shaft, and I have below hardware:
1, a rotary encoder, with A,B,Z signals output;
2, PCI-E6363 card.
I do konw how to use such a encoder to measure the rotational angle by using the function "DAQmxCreateCIAngEncoderChan", but this time I need to measure the speed(rpm), as well as the dirction of the speed, which means a negative speed represent a CCW rotate direction.
More detail informations:
for the encoder, the A,B signal is 600ppr, and Z signal is 1ppr
the rotatinal speed is in range: -300 ~ 5000 rpm.
some one suggested me that I can use the "DAQmxCreateCIAngEncoderChan" task to measure the angle firstly and then do the differential analysis with the angle. but I have to enable the Z index function, and it's hard to calculate when the shaft speed is fast then 2500rpm.
Anyone can help me on this issue?
Thanks in advance!
07-21-2014 01:59 AM
To measure the speed from the encoder you can simply follow some of the frequency measurement examples that ship with DAQmx, considering that speed (rpm) is given by frequency (Hz) on one encoder output / 600 (ppr) * 60 (s->min) = frequency / 10.
Difficult is to add a sign to this measurement: frequency measurement gives you no information about sense of rotation, so I suppose you could perform two angle measurements to get the sense of rotation and then get the speed as above.
07-21-2014 08:12 PM
Thansk for your reply. You are right that measure frequency to get the speed is the best way, but it's hard to get the dirction at the same time. You suggest me that "perform two angle measurements to get the sense of rotation", but I'm not sure I catched what you mean about this. I try to understand your opinion like this: distribute the signals to 2 counters, and start 2 tasks, one for frequency, the other for angle which used for deciding the dirction?
And by the way, in my application, the counter is limited:
I'm using PCI-E6363, which have 4 counters totally, and I have to measure 4 different speed sensors at the same time, so that means only 1 counter for me to measure the speed and the dirction.
RobertoBozzolo 已写:
To measure the speed from the encoder you can simply follow some of the frequency measurement examples that ship with DAQmx, considering that speed (rpm) is given by frequency (Hz) on one encoder output / 600 (ppr) * 60 (s->min) = frequency / 10.
Difficult is to add a sign to this measurement: frequency measurement gives you no information about sense of rotation, so I suppose you could perform two angle measurements to get the sense of rotation and then get the speed as above.
07-22-2014 01:51 AM
What I was thinking of was to use a single timer with two tasks:
1. Start a task for position reading
2. Perform two readings and decide the sense of rotation based on results
3. Stop the task and start a new one (frequency)
4. Loop reading and calculating speed
This can work if the sense of rotation does not vary during this process.