Skip to content

rover project – part 2

In the last post, I replaced the steering servo with a standard hobby servo. Now I should be able to control the drive and steering with an arduino. For the drive motor controller, I am using a Pololu MC33926 motor shield with a 7.2v NiMH RC battery pack hooked straight to the shield. I plugged everything in, tweaked the example code from the DualMC33926MotorShield library and it worked like a charm.


Next up, was getting steering working, but I ran into a problem with the arduino standard servo library. Apparently, the motor controller defaults to using timer 1 of the arduino and the servo library also uses timer 1. As a result, as soon as I set up the steering servo using the servo library, steering would work, but the drive motor would spin up full speed as soon as the arduino started up.

After some googling and head scratching, I found the ServoTimer2 library. I tried it out, but kept getting compilation errors. It was conflicting with the pololu controller library.

Eventually, I found an example on the pololu site about controlling a servo using timer 2 and modified my code. Now steering works.


Here is the code so far. With this, I can control the car over the serial interface. Sending and ‘l’ or ‘r’ will turn left or right. A ‘c’ will center the steering. ‘f’ or ‘b’ will increase the forward or reverse speed and ‘k’ will kill the drive motor. This is a good start so far. Next, I will figure out how to control it remotely. I will probably add a raspberry pi and have it control the arduino.


Comments are closed, but trackbacks and pingbacks are open.