Reading 3 Channel Encoder for Tether Control

Hi all,

I’m attempting to integrate a 3 channel encoder (see link below) to read the length of a tether run along a pulley to control a winch to deploy a controlled amount of tether. From what I have found it seems to be possible to treat this encoders as a 2 channel encoder (correct me if i am wrong) and as a result I am using the attached code to read the encoder. The issue I am running into is when I read the data directly off the encoder it runs very smoothly but if I read the data as the tether is pulled past it, the data oscillates between values as it increases. The encoder in question has a resolution of 1000 PPR which I believe is too fine.

So my two questions are as follows. One, am I correct to treat this encoder as two channel, and two is it possible to read only every 2nd or 3rd value off the encoder without using delay()?

Encoder link: Roller Wheel Length Position Meter Measuring Pulse Rotary Encoder High Resolution Spring Bracket Lift Rail Fabric Leather|measure length|length measuringencoder measuring wheel - AliExpress

encoderTest.ino (433 Bytes)

Do you have a link to the encoder that doesn't ask me to log in?

Paul

Yes sorry that link didn't make me log in when I pulled it.

link: https://www.wantitall.co.za/industrial/calt-ghw38-roller-polyurethane-wheel-length-position-meter-measuring-pulse-rotary-encoder-steel-moun__b07h29ybg9

islander98:
Yes sorry that link didn't make me log in when I pulled it.

link: https://www.wantitall.co.za/industrial/calt-ghw38-roller-polyurethane-wheel-length-position-meter-measuring-pulse-rotary-encoder-steel-moun__b07h29ybg9

That link works fine!

If you want only every 2nd or 3rd value, just count the times you read the value and ignore the ones you don't want. When you get to the one you want, reset the counter and proceed with your program.

Paul

3 channel incremental encoders have standard A and B quadrature signals and an indexing pulse once per
revolution (called Z) which can be used for homing.

How fast are you turning this 1000PPR encoder and how are you reading it? (ie post your code!)

Here is my code for how I'm reading it. I am not currently sure what the rpm is for the encoder. I have not had a chance to test that in the lab. I'll post that once I have it.

int A = 8;
int B = 9;

int counter;
int aLast;
int aState;
int bState;

void setup () {

  Serial.begin (9600);

  pinMode (A, INPUT);
  pinMode (B, INPUT);

  aLast = digitalRead(A);

}

void loop () {

  aState = digitalRead (A);

  if (aState != aLast) {

    bState = digitalRead (B);

    if (bState != aState) {
      counter ++;
    }

    else {
      counter --;
    }
    Serial.println (counter);
  }

aLast = aState;

}