Roomba Wheel Encoder Problem


[example image from the web]

I don't know what model Roomba the wheel i have is from, but it looks identical to the one above.

Wheels work great, I'm trying to read the magnetic encoder sensor on the back. It is not broken physically, and as per this thread I've connected the 3 wires as:

Grey = Signal -> to Arduino Interrupt Pin 18 as per Arduino Reference
White = 5V
Green = Ground

In this config, it is not working and I'm not getting any change in values. Here is the code I'm using:

int RWheelInput3 = 18;
int encoderValue = 0;

void setup() {
  Serial.begin(115200);

  pinMode(RWheelInput3, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(RWheelInput3), wheelTurning, CHANGE);
}

void wheelTurning() {
  encoderValue++;
}


void loop() {

  Serial.print("Encoder Value=");
  Serial.println(encoderValue);
}

It's the first time I've used an encoder with Arduino, so I'm reluctant to suspect the device is broken. But it was bought second hand,
and it is a number of years old.

I've tried swapping the white & grey cables, no luck.
I added a 10K resistor (now removed), no luck - using Arduinos Pullup
I've tried with just pinMode INPUT and not INPUT_PULLUP incase the board already has a resistor

I read 5V across white and green pin, so it is getting power.

0.239V when wheel is turning 200 & 255 PWM

0.453V when wheel not turning

No matter what, Encoder Value=0 is printed and doesn't change.

I've tried another script online to test the encoder without luck.

Everything points to connection issue/pin issue. I don't know any more.

Any ideas? :slight_smile:

The green wire seems to be connected to a pad marked “ENC” (don’t know what this could possibly be), not to the pad marked “GND”. So my first suspicion is that your connections are wrong.

I also see an A and B pad, this are probably the signals (appearing to be connected to the black and red wires and suggesting it’s a quadrature encoder), and a pad marked 5V that appears to be connected to the white wire, and is indeed likely to be a power supply.

No idea what the WD marking could mean.

wvmarle:
The green wire seems to be connected to a pad marked "ENC" (don't know what this could possibly be), not to the pad marked "GND". So my first suspicion is that your connections are wrong.

I also see an A and B pad, this are probably the signals (appearing to be connected to the black and red wires and suggesting it's a quadrature encoder), and a pad marked 5V that appears to be connected to the white wire, and is indeed likely to be a power supply.

No idea what the WD marking could mean.

Ah, i see what you mean. Let me investigate

Edit: Yes that seems to have fixed the problem! Thank you. I didn't have that top board on mine, so i never saw that, but i should have studied the web image more closely. The ENC is the encoder signal, WD is for wheel drop switch (when robot has been picked up physically by human). Thanks again !