Posted by Zan on 30/11/2019 21:58:59:
…
” I used a 1024-pules (4096 count) encoder (Omron E6B2-CWZ6C).
Choose an encoder that runs on 5VDC with open-collector outputs.
…
To add to Michael's answer, the CWZ6C is the NPN Open Collector version. If you want PNP Open Collector, buy the CWZ6B. (Can't think of a good reason for buying PNP as the PNP encoder has reduced performance.)
Open Collector is an output convention that expects the attached controller to hold its input line at logic HIGH. This is typically +5Vdc provided by a connecting a high value resistor (>1k) from the input pin to supply. An open collector encoder signals by pulling the input line down to logic LOW by shorting the computer's input pin to ground.
NPN and PNP switch in the opposite sense, thus NPN HIGH is PNP LOW and vice versa. The microcontroller can be programmed to work with either, but, if building a project with someone else's code, easier to follow their instructions!
The same encoder is available in a form that signals by outputting a positive voltage rather pulling the line down to zero. (CWZ3E). Again, the microcontroller can be programmed to work with this convention, but small code and circuit changes would be needed.
Similarly, the CWZ1X signals in RS-422A, which is designed to drive long twisted pair cable – an unnecessary complication in an ELS project.
All the models come in a range of different resolutions making it necessary the check the specification carefully before buying. The lowest is 60 pulses per revolution, the highest 2000. Look for mention on the label or sales literature first for the encoder ID, "E682-CWZ6C" and then find its pulse rate. This will be a number like 1000P/R, 1024P/R or 2000P/R and may not be immediately obvious. The encoder has several makers. I don't think it matters.
Datasheet here
Dave
Edited By SillyOldDuffer on 01/12/2019 13:07:19