How to hook up 8 wire differential wiring quadrature encoder

How to hook up 8 wire differential wiring quadrature encoder

Understanding Incremental Encoder Signals, differential wiring

The encoder I have is a 2000 ppr quadrature encoder with 8 wires.
6mm shaft, 38 mm body dia, 2000 ppr optical rotary encoder, 5v line driver

I'm trying to figure out how to connect the A-, B-, Z- wires.
If I understood the concept correctly, A+, B+, Z+ connect to interrupt pins on an Arduino or Teensy.
What do I connect the A-,B-, Z- wires to for differential wiring setup based on the article mentioned above? Do I connect them to ground?

I'm thinking of using the Teensy encoder library to try the encoder out.
encoder library pjrc forum

Also as a side question, does MCU speed make a difference in terms of the maximum frequency we can analyze from the encoder?

Please post a link to the manufacturer's data sheet for the exact encoder you have. It will have the required information.

Hi, @knightridar
You have GHS3806G2000BML5 ?

Product description

Size:2000PPR | Color:Line driver with 5V

The Incremental Rotary Encoder is designed to provide pulse feedback when the shaft is rotated. It is low cost yet compact, high quality and an incremental rotary encoder.
Widely used in Steel Industry, Textile Machinery, Port Machinery, Plastic Machinery, Lifting Machinery, Pressure Machinery, Glass Machinery, Printing Machinery, Wood Machinery, Packaging Machinery, Machine Tool, ogistics Machinery, Tire Machinery, Electronics and Solar, Elevator.

Color: Like the picture show
**power supply:**DC5-26V wide voltage or DC5V
Speed: more than 6000 r / min
Size: Shaft: 6mm Dia, Shell Size: 38mm Dia,
Output: Line Driver output with ABC A-B-C- signals ;Voltage out put ;Push-pull with ABZ 3 signals;NPN
When 3 channels: Red=VCC, Black = 0V, Green = A, White = B, Yellow = Z
When 6 channels: Red = VCC, Black = 0V, Green = A, White = B, Yellow = Z, Brown=A-, Grey=B-, Orange= Z
Note: If the encoder is not connected to the device can not be directly oscilloscope oscilloscope (open collector output without pull-up resistor when there is no voltage output) If you want the oscilloscope in AB two-phase output with two pull-up resistors. **Cable:**1meter cable side

What you have is
Red Vcc = positve supply
Black 0V = supply gnd
Green = A Signal A one of the quadrature channels.
White = B Signal B one of the quadrature channels.
Yellow = Z Sync signal, one pulse per revolution.
Brown = -A Inverted A signal.
Grey = -B inverted B signal.
Orange = -Z inverted Z signal.

Your encoder has line driver output, so you will not need pull-up resistors.

I not knowing what your project is, I can only guess you need;
Vcc, Gnd, A and B signals.
-A, -B, -Z and Z you can leave open circuit.

Can you please tell us your electronics, programming, arduino, hardware experience?

Can you please tell us your application, project?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

@TomGeorge the model number is correct. Thanks.

I not knowing what your project is, I can only guess you need;
Vcc, Gnd, A and B signals.
-A, -B, -Z and Z you can leave open circuit.

If I wanted to improve the noise issue based on the article mentioned above do I hook up the remaining 3 lines to ground? The cable I have is 1 meter long, but what if I ran a longer cable.

Differential wiring uses two wires per channel that are referenced to each other. The signals on these wires are always 180 electrical degrees out of phase, or exact opposites. This wiring is useful for higher noise immunity, at the cost of having more electrical connections. Differential wiring is often employed in longer wire runs as any noise picked up on the wiring is common mode rejected.

I've worked with open loop stepper motors sending pulses and signals and to have them rotate in specific 90,180,360 increments. Other experiences are just basic gps modules, and humidity/temperature modules and using them via already available libraries.

Some of the goals I want to try to accomplish with the encoder is to hook it up a dual shaft stepper motor via a motor coupling for closed loop feedback driven stepper motors for a gimbal or 3d printer.
This is the current board I'm looking into, their stepper drivers are pretty popular in the 3d printing hobby level world. Although this breakout board only takes in 3 wires for the encoder, I'm still wondering if it's possible to hook up the other 3 wires to avoid any potential noise issues.
trinamic 5160 bob


No you don't they are valid outputs in their own right, shorting those will damage the encoder, just leave them open circuit.
All the signals are positive with respect to ground.

A 1m cable should not have any noise pickup if you route it properly and if needed use shielded cable.
Does your encoder come with a suitably shielded and length cable.

What is the environment that your project will be in?

It sounds like you are planning, you may need to do some experimenting with hardware.

Tom... :smiley: :+1: :coffee: :australia:

From the looks of it it does look shielded, I hooked up the 8 cables to terminal blocks and will hook up wires on the other side of the terminal block to the motor controller and/or Arduino or Teensy 4.1.
The silver shielding is slightly sticking out of the black insulated wire.


Good, is very rare that the cable isn't shielded.
You can cut back some of the insulation and connect the shield to gnd.

The Teensy should be better than say a UNO, much higher speed so it will work better at high encoder pulse frequency.

Tom... :smiley: :+1: :coffee: :australia:

Thanks, I'll do that. Based on the research I've been doing I think it says to connect ground points to one common point and not daisy chain them because it can create different voltage potentials.
Encoder best wiring practices

Just curious, for the Teensy 4.1 it says:

Teensy 4.1

Special Timers
These extra timers allow delays, analog sample rate timing, carrier modulation, and other special timing tasks to be performed, without consuming any of the normal PWM-oriented timers.

    GPT1 - Generic 32 bit timer
    GPT2 - Generic Generic 32 bit Timer
    Quadrature Encoders - 4 special timers are meant for decoding quadrature signals. 

I'm assuming these are the quadrature encoder pins based on the PJRC site:

  • QuadTimer1 Module0 - Controls PWM pin 10.
  • QuadTimer1 Module1 - Controls PWM pin 12.
  • QuadTimer1 Module2 - Controls PWM pin 11.
  • QuadTimer1 Module3 - No pins accessible.
  • QuadTimer2 Module0 - Controls PWM pin 13.
  • QuadTimer2 Module1 - No pins accessible.
  • QuadTimer2 Module2 - No pins accessible.
  • QuadTimer2 Module3 - No pins accessible.
  • QuadTimer3 Module0 - Controls PWM pin 19.
  • QuadTimer3 Module1 - Controls PWM pin 18.
  • QuadTimer3 Module2 - Controls PWM pin 14.
  • QuadTimer3 Module3 - Controls PWM pin 15.
  • QuadTimer4 Module0 - No pins accessible. Used by OctoWS2811 library, ADC Library
  • QuadTimer4 Module1 - No pins accessible. Used by OctoWS2811 library
  • QuadTimer4 Module2 - No pins accessible. Used by OctoWS2811 library
  • QuadTimer4 Module3 - No pins accessible. Used by Audio for ADC timing, and ADC Library

Will hooking up to these specific pins as interrupt pins allow for faster signals / frequencies?
I don't know what are thes advantages of having these timers and seeing if anyone here does know what is so great about using them?


Yes, star rather than daisy.
I'm not familiar with Teensy I'm afraid, some other member will be more informative than I.

Tom... :smiley: :+1: :coffee: :australia:

1 Like

The standard circuit is to route the signals to a quad differential line receiver chip, being expressly designed for differential signals.

Failing that just ignore the -ve signals - the noise immunity is compromised of course, but it should work with short cables.

If you connect any of the signals to ground you'll risk damaging the driver.