Pololu Dual Serial Motor Controller

The Pololu Dual Serial Motor Controller is a powerful motor controller for use of low-voltage motor movement needs. An outline of all the functionality, protocols, and usages can be found documented on their website here as a user manual. Follow the instructions in the user manual to correctly connect the appropriate cables. The below software allows you to correctly interface with custom serial communications.

Special Notes

 * Do not pass more than 3 volts to the motor power pin.
 * Do not forcefully stall the wheels as it will burn the chip.
 * Place a 0.1μF capacitor to reduce noise in parallel onto the motor (directly onto the terminals)
 * If the motor controller seems to be acting bizare, send the "reset" packet, which is the following code:

BASIC Stamp Support
The user guide mentioned above provides BASIC Stamp code that is ready to use.

Arduino Support
The Arduino needs to implement it's own code to correctly be able to use this motor controller. The user's guide provides enough information to help us create our own simple wrapper which is found below.

It is important to note that the Arduino uses pins 0 and 1 for standard serial communications during program transfer. To avoid issues with communication/settings errors, only communicate to the motor controller through your own SoftwareSerial line not using those pins 0 and 1.

The below code implements the needed Arduino setup and loop function that initialize the communications and then loops from speeds 0 to 100 units, switching the motors from forward to backwards. The function InitMotor initializes the communications and motor protocol. The function SetMotor(int, int, boolean) takes a motor index (0 and 1), a motor speed (0 to 127), and a boolean to represent the movement direction (true for forward, false for backwards). A second function SetMotor(int, int) simply takes the motor index (0 and 1) and a speed from 0 to 255, 0 being full reverse and 255 full forward.