LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Connect Non-TTL rotary encoder to USB-6356 (preferably counter)

Solved!
Go to solution

I have a rotary encoder with complementary outputs (datasheet). Its maximum output frequency is 125kHz.

 

Because I don't understand how to appropriately use and size pull-up/down resistors, I'm unable to get this to interface nicely with LabVIEW code and DAQmx. (The crucial point being, I suppose, that the input voltage is 12..24V (I have 17V since the power supply is also controlling some load cells/amplifiers requiring 14..24V) and the output seems to be around 12V high and ~350mV low with no external resistors pulling in any direction).

 

Ideally, I would like to (using as few additional hardware components as possible for a good solution) connect my encoder output to my NI USB-6356 DAQ board and then have it count edges using DAQmx.

 

Currently, I have to use an AI Voltage channel, after connecting PFI8 (the Counter0 terminal) and the AnalogComparisonEvent, then a separate CI Cnt Edges read. This isn't too terrible, but it's quite a bit more to set up (boo-hoo) and more importantly, requires the use of an AI. The speeds make it more challenging for me to get reliable results (perhaps because my code is bad) when using a comparitively slow AI, instead of the very fast digital counter inputs.

 

What should I be doing here?


GCentral
0 Kudos
Message 1 of 5
(3,232 Views)

Hi cbutcher,

 

Because I don't understand how to appropriately use and size pull-up/down resistors,

You really should. It's just basic electrics with Ohm's law and Kirchhoff rules!

Which encoder do you use? Your datasheet lists several options…

 

as few additional hardware components as possible for a good solution)

3 resistors (pull-up, pull-down, input) and a Z-diode (5.1V) to protect the DI pin…

 

According to the datasheet of the USB6356 you could even connect your encoder directly to the DIO pins, but I would prefer some external protection circuit to be an the safe side! (It already mentions an internal pul-down resistor you just need an input resistance with a Z diode…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(3,193 Views)

 


GerdW wrote:

Which encoder do you use? Your datasheet lists several options…

The CWZ5GH - a small functional circuit diagram is given on the first page. It consists of a pair of transistors (one PNP, one NPN, each being connected to the appropriate power line (+ve, gnd) by a 7.5 Ohm resistor, with that in series with a 24 Ohm resistor to output.) Simulation with LTSpice and reading on wikipedia give me a basic understanding of pull-up/down but it's unclear how I would size a pull-down to get a 5V high for arbitrary input voltage. I could size it for 17V, but then if I change to 16V for some reason, my resistor would need changing (Perhaps this is just how it is, without a comparator circuit?). Seemingly a pull-up resistor will make my high level be the same as the power +ve rail, which will be far too high to be recognised as a 5V TTL for LabVIEW.

 

Your description of components needed makes me think I should have the output connected to both +ve and gnd with a resistor each, then connected using the diode to prevent voltages greater than 5.1V being passed as a digital input - I suppose that this neatly avoids having to size the pull-up resistor too carefully to the power supply, but I imagine you didn't mean for me to use it as a voltage regulator.

 


GCentral
0 Kudos
Message 3 of 5
(3,187 Views)
Solution
Accepted by topic author cbutcher

Hi cbutcher,

 

the encoder uses a push-pull output which simplifies the design. The internal pull-down of the USB6356 makes it even easier:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 5
(3,183 Views)

Thanks. Was trying to preview the last post, then thought some more - seemingly accidentally posted it, and then was editing when email let me know you posted again.

 

Will think more before posting lots, but at least I understand your answer now.

 

Thank you again


GCentral
0 Kudos
Message 5 of 5
(3,181 Views)