Linear encoder from printer, can’t get it to work

Hi @mrExplore
Refering the was:

Linear encoder from printer, can’t get it to work
https://forum.arduino.cc/t/linear-encoder-from-printer-cant-get-it-to-work

I have the same encoder Q9864 module from the HP printer but the arduino interrupts fire randomly.

I'm using the encoder in place, didn't remove it to use the encoder wheel, just removed the connection with the printer board.

I'm using Arduino mega with interrupts on pins 20 & 21, I connect as the following picture, when I turn the printer wheel the multimeter shows volts between 1 and 4.8 volts, so the pinout of the encoder is fine, but the Arduino interrupts are not working as excepected.

How did you connect the arduino pins? direcly without resistor? or can you share the circuit diagram?

thanks,

I moved this to a new topic of its own, please don't hijack threads esp. when they are not related.

➜ please read How to get the best out of this forum and make sure to post accordingly (including code tags and necessary documentation for your ask).

1 Like

I would guess Vcc, GND and these two pins (for clock and data?):

Encoder myEnc(2, 3);

I modified the original post with some updates and pics.

Do you have an interrupt handler in your code?

int i;
.
.
pinMode(encoder, INPUT_PULLUP)
.
.
attahInterrupt(digitalPinToInterrupt(encoder), interrupthandler, RISING);
.
.
void interrupthandler()
{
  i++;
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.