I bought two identical 12V 200rpm motors. After using them for two weeks, the motors are running at different speeds and hence the robot is not going straight. What should I do? I checked the speeds of the motors by directly connecting to a 9V battery also.
I'm not a robot expert, so I won't attempt any specific recommendations...
Some more details about the robot might help. How many wheels? Are there wheels that turn to steer the robot? Are the non-powered wheels always pointing straight, or do they pivot?
You generally need some kind of feedback system. ...A car or bicycle that's going straight down a straight road will eventually drift off the road without feedback (without watching where you are going and making steering corrections). And a car or bicycle doesn't have the disadvantage of two motors running at slightly different speeds.
If you wanted a DC motor to run at exactly 200RPM, that would also require feedback, such as a rotary encoder that's monitoring the actual speed and adjusting voltage/current to the motor. But, that would not make your robot run perfectly straight because there would be different slippage in both wheels, the wheels might not be exactly the same size, and the wheels may not be perfectly aligned.
(A stepper motor can be precisely controlled by controlling the speed of the steps, and a synchronous AC motor can be controlled by the AC line frequency.)
Thank you so much. Is it possible to use this rotary encoder with the Arduino Uno?
sulivuli: Thank you so much. Is it possible to use this rotary encoder with the Arduino Uno?
Is there any mechanism that the robot could use to detect whether it is going straight - perhaps a castoring wheel with the castor connected to a potentiometer. That would provide feedback which the Arduino coul use to adjust the speed of the motors.
I doubt if it would be possible to get a robot to go straight just by running the two motors at exactly the same RPM. There will be external disturbances such as dirt on the floor or differences in grip.
A rotary encoder is not a simple thing to include and it would be a pity to waste all that effort only to find that the robot was still not going straight.