I am using L298N motor driver for DC motor. First, I tested the motor with Arduino, by giving PWM signals to the enable pin of the L298N pin.

I have two questions:

  1. Arduino can supply average 5V analog output (PWM) where Raspberry Pi can supply 3.3V as maximum. Does it mean that If I run the DC motor & L298N with the Raspberry Pi, maximum torque and speed that I can get is less than Arduino since Arduino can supply more average voltage on PWM signal. Am I right?
  2. If I am right, how can shift the 3.3V to 5V to connect the enable (PWM) pin of L298N driver. Are the logic level shifters sutiable for this problem?

1 Answer 1


No, you are not right.

It only matters if the Pi's signals are seen as logic low or logic high. The Pi's 3V3 output from a GPIO is seen as logic high by the L298N module.

You can control motor speed in two ways.

  1. use PWM on the enable pin for the motor (typically marked ENA for motor 1 and ENB for motor 2).
  2. strap the enable pins high and use PWM on the input pins. This requires the ability of driving PWM on both the pair of IN pins for the motor (i.e. IN1/2 for motor 1 and IN3/4 for motor 2).

Method 1. is preferred.

PWM is used to switch the motor driver outputs on and off very fast. As long as the input high threshold is reached it doesn't matter if the input voltage is 3V3 or 5V. 3V3 exceeds the L298N high threshold.

  • So, the motor speed is adjustable by the duty cycle of the PWM signal, not the voltage level of the signal. The driver sends the Vcc to the target motor according to duty cycle of the PWM, not the voltage. Did I understand true ?
    – tango-1
    Commented Oct 30, 2021 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.