[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? ![]()
