Can one use the PFI0 and PFI1 counter inputs pins of USB 6001/2/3 for measurement of quadrature encoder pulse inputs?
The quadrature encoder under consideration is having following details :
Type : Incremental encoder, Single turn 2500 ppr. 5V signal.
Interface signals : A, B and Zero.
Thanks & Regards
No, not really. Those devices have a single counter with very limited functionality -- only capable of counting up on each edge of a single signal at either PFI0 *OR* PFI1, not both at once. Also, all DIO is software timed, which is very unliikely to be sufficient for an encoder of that resolution.
It is at least *conceivable* that you might be able to capture the encoder signals as AI channels if you can sample at a high enough rate. Then you'd need to work out the quadrature and z-indexing algorithms as a software post-processing step. So it might be possible, but it isn't particularly desirable.
Thanks Kevin for the reply,
One more thing which I forget to mention is that:
Can one use the USB 6211 modules PFI0 and PFI1 pins for the measurement of the A and B pulse signals? OR which other DAQ card can be used for this signal measurement?
Thanks & Regards
The USB-6211 is definitely the better choice for an encoder interface. It has 2 counters that are each capable of handling A,B, and Z inputs simultaneously and doing all the quadrature decoding right in the hardware. It also has more flexibility for signal routing, allowing you more options for which PFI pins to wire up.
In general, *any* USB-based device will be a worse choice for a control system than a corresponding desktop device. Windows is also not ideal for a control system, but if you only need to change occasional setpoints for the servo drive to lock onto, you may be ok.
Could you perhaps explain capturing the pulse with an AI channel with a sample rate, or point me in the right direction? I bought the USB-6001 before realizing I needed 2 counters. I'm also using DAQexpress and completely new to this. Can I set a certain sample rate in DAQexpress?
I am trying to read the rotational speed of a roller via an encoder. I would probably be fine with just 1 channel. The frequency would be at most 300 counts per second.
1. Find a shipping example for continuous AI acquisition. Make sure you can capture both A & B channels from the encoder.
2. If your encoder signals are clean, you can simply compare whether each channel of AI data is > 1.5 V or thereabouts. That'll produce a boolean array that's T when the encoder signal is high, F when low.
3. You now have a time history of boolean states for encoder channels A & B. You'll need to implement a software quadrature decoding algorithm. It needs to remember previous quadrature state (using a feedback node or unitialized shift register) as well as previous cumulative count.
4. I'd recommend sampling at ~10x the post-quadrature encoder count rate. If channel A cycles at 300 Hz, counts will increment at 1200 Hz, and you should sample at around 12000 Hz.
5. A typical way to get samples from a continuous task is to get 1/10th sec worth at a time. You could do this by requesting 1200 samples per loop iteration. Then pass that data into your thresholding operation and your quadrature decoding routine.