maybe this ask is repeated but i need solve this special situation, i have an arm robot with 3 Freedon deegre, i want to control position of each motor with a raspberry pi 2 and L293D like a motor driver, i am source with 3.3 logic and 6 v source,but i don't know how to manipulate the PWM to change the action velocity like in arduino that only change the cycle(0-255) you have different velocity, thank

  • 1
    Ah, let me see. L293D is similar to L298N. You can search L298N and found a couple of questions with answers also helpful to L293D.
    – tlfong01
    Commented Jun 27, 2019 at 4:55
  • yes, but my question is how modulate the frenquence to change the velocity Commented Jun 27, 2019 at 5:24
  • 1
    Well, you may also like to search for "PWM" controlling "servo". PWM controling L298N DC motors is basically the same, once you know how to do PWM.
    – tlfong01
    Commented Jun 27, 2019 at 5:33
  • If you are using I2C 3DOF MEMS, you might also like to search for "PCA9685", an I2C PWM module for controlling LED and servo alike.
    – tlfong01
    Commented Jun 27, 2019 at 6:20

1 Answer 1


You do not modulate the PWM frequency to change motor speed.

You change the PWM dutycycle.

You set a dutycycle of 0% for off, 100% for fully on, 50% for half on, etc.

If the permitted dutycycle range is 0 to 255 that would be 0 (0%), 255 (100%), and 128 (50%).

If this isn't what you are asking you need to clarify your question.


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.