keyes L298

Hello everyone!

I've been recently trying to apply PWM to control 3 (6V) dc brushed motors with two keyes L298 motor drivers and arduino uno. but I have some issues, and I would really appreciate your help.

When I apply a high PWM (e.g. analogWrite(motor1, 255) ) the motor starts rotating a high speed as expected (normal), and even If the motors are still rotating if I change the PWM to a low PWM (e.g. analogWrite(motor1,100)), the motors reduce their speed (normally too).
But this is the problem:
If I apply a low PWM directly (e.g. analogWrite(motor1, 100) ) no motor rotates and i can hear a weird sound coming from the motor drivers, so basically I cannot start the motors at low speed.
I've searched about this issue and I have found that if the motor is running a low voltage, its current increases a lot because of
P = V*I .

honestly i am not familiar with electronic devices, but after looking deeply the keyes L296 motor driver i observed that the motor driver has many holes and even one of those holes is marked as C1.

These are my questions.

Should I add a capacitor to fill the C1 hole?. (and if I should, Is 100 uf enough to solve this problem?)

What else should I add to the circuit?

I will really appreciate if someone can help me.

Thank you very much in advance.

Bye

What voltage are you supplying to the L298 module? There's a minimum 2V drop through the 298, more of a drop at higher currents. So at low PWM average voltage, less the drop which depends on the current drawn, there may be very little left at the motor.

Stick a meter on and see what it really is....

I have changed the frequency that arduino send PWM to the motors (I lowed the frequency to ~10Hz). I found the motors worked better (than before).

Can it means that Arduino send PWM at a frequency (~1000HZ) that might be too high for the motors?. (e.g. motors are inductive load).

Do I have to add capacitors to the keyes L296 motor driver ?. Can it helps?

I will really value your help.

best wishes

You are probably using slow-decay mode where the current is carried by one of the
diodes during the PWM off period. This doesn't give as linear or regulated speed
control as synchronous drive (PWM on both top and bottom switches in anti-phase).

In particular the frequency of PWM will affect whether the current falls to zero on
each PWM cycle - so yes I'd experiment with the PWM frequency some more.

The reluctance to start at drive level 100 despite it working at that drive level from
full speed is partly a result of static friction, note, you will often see this kind of
hysteresis in motor function driving real frictional loads with small motors.

Larger motors have much stiffer torque v. speed curves so are less prone to it.

Thanks for your replay

How can I measure if my circuit is in low decay mode?

this is the datasheet of my dc motor.

Dimensions: 25D x 52L mm
Weight: 3.1 oz
Shaft diameter: 4 mm

47:1 reduction ratio
Load Speed ??@ 6V: 210 rpm.
Load Current @ 6V: 450 mA
Maximum current @ 6V: 6000 mA
Maximum torque @ 6V: 80 oz · in

I've been reading about slow/fast decay mode, but I don't think that could be the problem, since slow/fast decay mode is for the case when the motors should change from a clockwise rotation to a counterclockwise rotation, but in the matter of fact, the motors don't start working at low speed in neither direction.
besides, the keyes L296 only have three pins for each motor, "EN1, IN1, and IN2" if we would like to apply slow/fast decay mode we should have another two pins to control (e.g. IN11, IN12, and IN21, IN22) .

Any comment will be truly appreciated.

bye

You can adapt in your sketch a driveMotor(int dutyCycle) funtion that does the following:

void  driveMotor(int pin, int dutyCycle){

   If (dutyCycle == 0){
      digitalWrite(pin,LOW);
      delayMicroseconds(20);
   else{
      digitalWrite(pin,HIGH);
      delayMicroseconds(10);
      analogWrite(pin,dutyCycle);
      delayMicroseconds(10);
   }
}

This way you will always drive the motor at full speed for some fraction of a second and then get it to your desired speed.

Thank for for comment John1a, i just tried but still did not work yet.

Could the reason of this problem be: the battery is too small to power 3 motors +2 L298 at low speed?,
since it is a 7.4 volts battery.

thanks .

any comment will be must welcomed.

Hi, starting a brushed motor from zero is not easy if the motor has only 3 poles, this has to do with starting torque, and if you load the motor then the starting torque will be higher.
You will have to program into your sketch a minimum starting PWM, rather than relying on zero pwm to ramp up from.

Tom..... :slight_smile:

Thanks for your replay Tom.

I do really appreciate it.

I am trying to build a three wheels omnidirectional robot and i just don't want it to crash again the wall if it is running to fast.
I did not have much knowledge about motors or motor drivers before I started to built it... Well, I believe I should change my motors for other kinds.

Thanks again.

Bye :slight_smile: