A question about L298N pwm drive

Hi, i have a question about l298n module. There is 2 way of motor drive as far as I understand,
1 - I can use jumper for enable pins and directly use pwm (let say D3 pin). I can control motor speed.

2- I can send pwm to enable pin and +5v gnd motor pins. Still i can control motor speed

I m wondering what's the differences and advantages or disadvantages of these 2 methods

Thank you

If you are running the motor only in one direction, if you want to reverse and control speed you would need a second PWM pin.

I hate these Frizzy style diagrams, but you should find something to help you HERE

Depending on the motors and module, there are several variations.

So only advantage is, if we want 2 way direction, using 2 pwm pins instead of 4 . Right?

If you wanted reversing with speed control in both directions, 2 non PWM pins for !n1, In2 (direction) and 1 PWM pin for analogWriting ENA (speed), that also gives you braking ability if needed (set both In pins either HIGH or LOW and keep ENA HIGH):

  // brake
digitalWrite(In1,LOW);
digitalWrite(In2,LOW);
digitalWrite(ENA,HIGH);

See figure 6/13 in datasheet:
https://www.st.com/resource/en/datasheet/l298.pdf

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.