30:1 Metal Gearmotor 37Dx52L mm with 64 CPR Encoder

I am new to Arduino and using motors/encoders in general. For a project I am doing (similar to the Balanduino http://www.balanduino.net/) I am using the 30:1 Metal Gearmotor with Encoder https://www.pololu.com/product/1443 as part of a self-balancing robot with PID control. I am driving the motors with the Dual VNH2SP30 Motor Driver Carrier MD03A https://www.pololu.com/product/708. The code for the Balanduino can be found at https://github.com/TKJElectronics/Balanduino. Whenever I try to print any values associated with the encoder, I only get 0’s. I have checked to make sure that the encoders are receiving 5v in. I have been able to drive the motors, but I don’t really know what to do with the encoders. Any help would be appreciated, as would a simple tutorial for using the encoders to get output.



I am not familiar with the code for the Balanduino and do not know if your problem is due to the encoder or the software. To test the encoder, you could measure the encoder outputs with a multimeter or oscilloscope and see if the output changes when you spin the motor. Alternatively, you might try testing the encoders by following one of the encoder examples found on Arduino’s website.

If you continue to have problems, you could post a simplified version of your code and pictures of your setup, and I would be happy to take a look at them.

- Jeremy