Problem in reading data from encoder with arduino Hello guys I am trying to count the number of the steps of a stepper motor with an encoder (Avago heds).

I found an Arduino sketch to count that steps and display them on the console and I found online the scheme to connect that encoder to Arduino.

The problem is that the encoder returns as output only 0, even if I rotate manually the motor. I also tried to measure the voltage of the encoder with a voltmeter but the voltage does not change even if I rotate the motor.

That is the Arduino Sketch

Here some picture's of Arduino-encoder connections







P.S. The motor works because I tried it before

Thank you for help
In my experience (industrial encoders and PLCs) when the output don't change when the motor shaft is rotated its usually one of the following:


The set screw connecting the motor shaft to the encoder that isn't tight,
broken wire (bad connection to the encoder) or
a bad encoder. 


Your picture shows what looks like a cover over the encoder coupling to the motor.  Look and make sure that the encoder is actually rotating with the motor.

Then double check your connections.  If a DMM still shows no voltage changes (use AC range if turning the motor to show that the encoder output is pulsing).

If there is still no joy, its likely that the encoder is bad.