Problems with TB6612FNG Dual Motor Driver Carrier

I am trying to build a 3pi like robot for a line following contest. I use Arduino Duemilanove ATmega 328 as controller and the following hardware from Pololu

Pololu QTR-RC sensor ( 6 lines are connected to analog inputs, and two to digital input of Arduino)
Pololu Adjustable Boost Regulator 4-25V (9.5V for motors like in 3pi robot)
TB6612FNG Dual Motor Driver Carrier
Pololu 42x19mm Wheel and Encoder Set
Pololu 5" Robot Chassis RRC04A Solid Black

My problem is the following: I drive Motor1 from Timer 0 and Motor 2 from Timer2, and when a program the robot to go straight ahead it is starting to turn left eventually. So can the difference in PWM frequency cause this strange behavior ? I also tried using timer 1 and timer 2 with limiting timer 1 to count to 255 and setting both timers to max 32kHz frequency but I got the same result. Please help me !!! :slight_smile:


I don’t exactly understand what you are doing with the timers, but if the PWM duty cycle is the same for both of motors, it’s likely the different frequency is not what is causing your problem. Motors of the same model often do not have the same speed at the same voltage, so if you power them both with the same voltage you should expect your robot to veer toward the slower motor. You can compensate for this by calibrating the voltage to the different motors, or you could use the encoders to make a speed control system that keeps both motors going at a set speed.

- Ryan


The main answer is that you should not expect things to go straight. For a lot of parts, a 1% variation is very minimal, but you would still see the arc if your motor speeds vary by 1%. With all the things that could be different, you should expect much more than a 1% difference; some of the things Ryan mentioned will help, but you still won’t get straightness.

Also, different PWM frequencies at the same duty cycle can result in diffrent motor speeds. The frequencies usually don’t matter in the sense that a few percent doesn’t matter; if you care about something tighter than that, a lot of things start mattering.

- Jan