Bought a CNC jog wheel on Ebay and cant get it to work,

I have been using the encoder.h library for years and works great for me. I only used it with the little knobs that also have a push button on the top,

One day I wanted a more pulses per rotation encoder so I bought this.

I connected the Arduino ground to the "0v" terminal and the " 5v" to the 5V arduino output.
Then I connected the terminals A and B of the wheel to the pins 20 and 21.
I am getting no pulses.
I took a small knob encoder and used the same setup and it works great, I can count pulses back and forth. So I wont include any code because is a hardware problem.
Sounds so simple , I feel stupid...

Please help

Do you have any documentation for that jog wheel?

What you did sounds plausible, but there may indeed be something overlooked.

Please post the code you are working with.


Could it be that the outputs of the encoder are open collector / open drain and need a pullup to enable them to go high.?

The fact there there are A+/- and B+/- indicates the encoder output is differential.

You may need to run the outputs through something like an SN75157 dual differential receiver and connect the outputs of that to the Arduino.

You could verify if the outputs you're currently using have sufficient amplitude to produce the needed Vih and Vil levels for the Arduino MCU. But because they're differential it's possible -- and likely -- that the outputs are designed to change relative to one another by a few hundred mV, not relative to GND (that's the whole idea of differential...)

Hey where’d you dig that up? I gave up, my patience under-lasted my google fu.

I’m more interested now that there is the idea that it is a differential output encoder… the code that goes with the picture of a wiring diagram you posted could be informative


I checked shopping sites and looked at the pictures. Datasheets are hard to find, but sometimes the ads have information in the pictures.

Edit: here's the link Rotary Manual Pulse Generator (MPG1)

The patient must be dead. Seriously though, how do you determine that, post your code

Thank you friends, I learned a lot :
This encoder wheel is not a passive device, it needs 5v and takes about 70mA.
I tried to feed it with 5 volts from the Arduino mega, but that might be too much for the mega...

So I connected the power supply and I am getting nice quadrature signal.

Next I put the A and B to the Arduino inputs 21 and 20 and hope to get encoder signal.
But I did not. I put the scope probes on it and the outputs of the wheel are high all the time. The high comes from the Arduino encoder.h library that does an input-high on the 2 pins allocated to the encoder. That is what I assume. Right?
In that case what to do? Try another library?


What's the volts/div on your 'scope in that picture?

Also, look where the "zero" marker is for channel 2 vs where the output signal low level is. Same for channel 1; the lows for it are below the zero level. This indicates that the A+ and A- signals are, in differential mode and referenced to one another, not necessarily ground; same for B+ and B-.

I still feel like you need to use a differential to single-ended converter like I linked to above.

The oscilloscope is on a 2 v per square mode. So the amplitude should be enough. I think.
It is all referenced to the ground, and that is the common ground I use in the arduino mega.

Am I correct assuming that the "Input high" is cancelling my signal?

The differential outputs may not be referenced to ground though and this is suggested by the fact that the lowest-level in your scope shot for trace #2 is actually hovering at 2V above ground. With differential the two signals are generated relative to each other with little or not regard to GND. It's what allows RS485 to work over ~4000ft when you can't be assured that ground levels won't be the same.

It also works in electrically noisy environments; transmitted differential data over twisted pair may see significant noise but because it would be common-mode the receiver would reject it.

Problem Found,

My ground wiring was faulty, I crimped a wire too hard and I broke it inside the ground connector at the Jog wheel.
Now it works like a charm.
I found this interrupt based routine, does it even better,

#include "EncoderStepCounter.h"

#define ENCODER_PIN1 20
#define ENCODER_INT1 digitalPinToInterrupt(ENCODER_PIN1)
#define ENCODER_PIN2 21
#define ENCODER_INT2 digitalPinToInterrupt(ENCODER_PIN2)

// Create instance for one full step encoder
EncoderStepCounter encoder(ENCODER_PIN1, ENCODER_PIN2);
// Use the following for half step encoders
//EncoderStepCounter encoder(ENCODER_PIN1, ENCODER_PIN2, HALF_STEP);

void setup() {
  // Initialize encoder
  // Initialize interrupts
  attachInterrupt(ENCODER_INT1, interrupt, CHANGE);
  attachInterrupt(ENCODER_INT2, interrupt, CHANGE);

// Call tick on every change interrupt
void interrupt() {

// This is an example on how to change a "long" variable
// with the library. With every loop the value is added
// and then cleared in the encoder library
signed long position = 0;
void loop() {
  signed char pos = encoder.getPosition();
  if (pos != 0) {
    position += pos;

Thanks everyone