SVP + Wheel encoder trouble

I’ll get the problem out of the way quickly in case it rings any bells: after letting a motor run for 500 ms my wheel encoder returns 0 with no error.

I’m not sure what I did wrong here. I may have had the wires crossed at one point and mixed GND & VCC or VCC & OUT A/B or something like that. I don’t think I did, but anything’s possible at this point.

I’ve certainly got everything hooked up correctly right now. The little black boxes on the encoder PCB sit directly below the teeth in the 42x19mm wheel. I’ve never turned the trimpots or anything like that. I don’t have an oscilloscope handy, but I can probably get access to one.

The code I’m using:

#include <pololu/orangutan.h>

int main()
	set_digital_output(IO_B4, LOW);  // Make SSbar an output (C only)
	int counts[2], errs[2];
		set_motors(100, 100);
		set_motors(0, 0);
		counts[0] = svp_get_counts_and_reset_ab();
		counts[1] = svp_get_counts_and_reset_cd();
		errs[0] = svp_check_error_ab();
		errs[1] = svp_check_error_cd();
		lcd_goto_xy(0, 0);
		print(" ");
		lcd_goto_xy(0, 1);
		print(" ");

So if my code’s not wrong, maybe I need to order another set of encoders?

Hello. I am sorry that you are having trouble. What type of motor do you have, and how is it physically mounted? A picture of your setup would be helpful. How did you connect the motor and encoder to the SVP? A picture showing your connections would also be very helpful for troubleshooting.

I do not see anything wrong with your code.

Do you have a multimeter available?


I’ll post pictures/diagrams/whatever when I get back home. Since I have a feeling you won’t be looking at the forums then; what should I do with my multimeter? Check that there’s voltage pulses or something?


You can use your multimeter to look at the outputs as you slowly rotate the wheel. You should see them alternating between 0 and 5V.

- Ben

Out of my pair of wheel encoders, only one of the sensors actually has this behavior!

Board #1: A fluctuates between 300mV and ~ 2V, but isn’t very predictable. B stays at a constant 600 mV. This board gets very warm after a few minutes as well!

Board #2: A fluctuates between 0 & 5V as expected, B just reads a constant 0 mV.

I’m guessing that at one point I mixed up the pins and got a sensor into Vcc or something similar. All of my male/female jumper wires are purple so this is an easy mistake to make.

I guess I should order another set of encoders and a rainbow pack of jumper cables :laughing: