L298N - Two motors spinning at different speed

Hi, I'm controlling two identical DC gear motors with arduino and a L298N. I'm powering the arduino from USB and the L298 with a power supply (7.5 v / 300mA). One of the motors is clearly spinning a bit slower than the other. I tried also connecting ENA & ENB to PWM digital pins and I need to reduce the speed in one of the motors in order to get both spinning at the same pace.

My understanding is that the L298N provides simetrical output on both sides. What could be the cause of this problem and how could I avoid it without using different PWM dutiy cycle values for each motor?


They're not identical. They may be manufactured to the same spec but their components are each built to some tolerance which means that as a whole, they're slightly different. You will indeed need to use calibrated PWM duty cycle values for each motor.

ok, problem solved then. I've observerd a difference of approx. 50 in the value of the duty cycle of the two motors when one of them is working at maximal speed (255)

Great. You adjusted the PWM to more closely match the speeds. I will assume that this test was done on the bench, so to speak.

What is it that you are really trying to do? What will these motors be driving? How accurate is the relative output of the 2 motors required to be? How are you measuring the output of the motors?

rodrunner: I'm controlling two identical DC gear motors with arduino...

Which Arduino, and which PWM pins. An Uno has a different PWM frequency on pin 5,6 (~1kHz) than on the other PWM pins (~500Hz). Using two different PWM frequencies for the two motors could also add to the problem. Leo..

Thanks for all the infos, I've learned something new thanks to your responses. The board I'm using is an arduino uno, with the following digital pins in output mode:

int in1 = 8; 
int in2 = 7;
int ena = 9;  // PWM
int enb = 11; // PWM
int in3 = 13;
int in4 = 12;

The 2 motors drive the wheels of a 2wd robot car and I just noticed the difference of speed visually, it was quite obvious. The accuracy I get controlling the speed with PWM seems ok for my purposes.

If you are spinning the motors in opposite directions there is often a difference in speed as most DC motors have a forward direction. The brush angles are advanced in the forward direction to give a higher forward speed than reverse - the advancing of the angle makes up for the delaying effect of winding inductance in the armature at high speeds.

If the terminals are labelled + and -, you can be pretty sure there is such a difference.

Cheap small DC motors have noticable variability in manufacture too - leading to different amounts of friction.