Hi i have two gear motors connected to the L298N powered by 12V and the Volts needed for the arduino from a laptop. When I set the same speed for both of the motors one of those is going a little faster than the other one. When I switch the cables from place the other motor goes faster. So, it shouldn´t be a problem of the motors and it should be of the code.
I would like to know how to fix it.
You must show your code, a wiring diagram, and a description of the operation of your project.
You are observing the differences in the discrete components of your motor driver board.
You should measure the rotational velocity of each wheel, then adjust your code to compensate for the differences in the channels of the motor driver board.
Some PWM pins of an Uno R3 are ~500hz and other PWM pins are ~1000hz.
Are you using two pins with the same PWM frequency? If yes, then it must be the L298.
Don't be surprised if that inefficient dinosaur driver drops 2-4volt off your supply, which is likely not the same for each output. Use a steering system that adjusts the two PWM values.
Leo..
Hi, @8ndresyo
Welcome to the forum.
Good that you swapped motors to check if it was hardware, note @Wawa post about PWM frequency.
Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
Thanks.. Tom..
![]()
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.