I have a DC motor (controlled by an arduino MEGA) and I plan to move some 3D Printed gears and a pulley.

I have a problem with the belt jerking when power is applied to the motor through the arduino and I'd like to know what type of formulas I can use to modify the function that makes the motor calls.

I found a guy on here who has a similar question but his is for stepper motors, not for DC. I see his approach and wonder if I can use this as well? (I just don't want to try it and break something)

Smooth A Motor Movement

I would comment on his post, but I guess you are not allowed to ask question on other people's posts, so I have to do my own to get insights on how to impliment something like that for my application.

I'm using this belt and this motor

  • 1
    \$\begingroup\$ Have you tried using a PWMed ramp on startup? \$\endgroup\$
    – uint128_t
    Feb 27, 2016 at 3:28
  • \$\begingroup\$ Are you needing precise control over speed up/slow down distances/times & total 'distance travelled,' or is your main concern just eliminating the driveline lash? \$\endgroup\$ Feb 27, 2016 at 3:45
  • \$\begingroup\$ If you have an encoder for feedback you can make a trajectory planner, like simple trapezoidal motion trajectory. If you don't position the motor (no feedback) then you can ramp the speed up/down at start/stop. \$\endgroup\$ Feb 27, 2016 at 8:24
  • \$\begingroup\$ 3D printed gears... Are they a good approximation to the correct involute tooth form, with their axes separated by half the sum of the PCD of each gear? (or alternatively, "depthed" so thy run smoothly? There is an art to gear generation and entire books about it amazon.co.uk/Gears-Gear-Cutting-Workshop-Practice/dp/0852429118 which I'm not sure 3D printers have caught up with, so there's definitely room for troubles like jerky motion here. \$\endgroup\$
    – user16324
    Feb 27, 2016 at 11:16
  • \$\begingroup\$ @uint128_t no as i have no idea about that, i only know how to declare HIGH or LOW using digital write or 0-255 using analogwrite, thats it... \$\endgroup\$
    – Frank
    Feb 28, 2016 at 19:30

2 Answers 2


Mixing @uint128_t's comment with the solution the other guy found, yes, you can use this trapezoidal profile for speed.

As you didn't provide the circuitry between the Arduino and the motor, I can only guess it's linear. If it is, you can modulate the input of the driver so to control the speed of the motor. You can achieve this by using one PWM channel of the Arduino and connecting a low-pass filter on the pin to remove the modulation frequency, thus creating an analog control voltage for the driver.

If you need some fine control over distance/position, you'll have to integrate the speed trapezoidal shape (calculate the trapezoid's area) to get the total distance.

Notice the acceleration on the other answers graphic. It's a constant value that determines at which rate should speed change.
The faster you rise the speed, the bigger will be the acceleration.

The smaller the acceleration is, the less force will be applied to the belt and the smoother the motor will perform.

You can define an acceleration value and a maximum speed to create the trapezoids at runtime, pre-calculating when the speed will start to decrease based on the distance you need the belt to travel.

  • \$\begingroup\$ what ? what do you mean ? how? "achieve this by using one PWM channel of the Arduino and connecting a low-pass filter on the pin to remove the modulation frequency, thus creating an analog control voltage for the driver" WHAT? \$\endgroup\$
    – Frank
    Feb 28, 2016 at 19:48
  • \$\begingroup\$ Sorry, from the information I provided I thought you could find your way. On the Arduino website you can find examples on how to create a PWM signal. There's an example on the Arduino IDE on controlling a LED's brightness using a changing PWM signal. You can try to figure that example out and change some things. \$\endgroup\$ Mar 5, 2016 at 20:16
  • \$\begingroup\$ You may also found several tips on the Arduino forums from people building low-pass filters for their PWM signals. A PWM signal is nothing more than a pin holding a logical 0 or a 1 for a determined amount of time. If you hook a low pass filter on this pin, you'll get the mean voltage. Example: If the PWM signal is 50%, you'll get the same amount of time for the 'on time' and for the 'off time'. If your Arduino is running on 5v and you measure the output of the low pass filter, you should get 2.5v. Using PWM and a low-pass filter, you can create an analog voltage from a purely digital circuit. \$\endgroup\$ Mar 5, 2016 at 20:22
  • \$\begingroup\$ You can then use this analog voltage to drive the motor. Again, I don't know how you are driving your motor. I don't know if you are using a bipolar transistor, a mosfet, I son't know. If the way you're driving your motor accepts an analog voltage as a controller, now you should be able not only to control whether the motor is on or off, but also some control over it's speed. Now you can use that PWM example code and ramp up/down the variable that controls the PWM. You can possibly apply @Marko Buršič's answer and let that code generate the PWM signals for you, altough I have not read it yet. \$\endgroup\$ Mar 5, 2016 at 20:25
  • \$\begingroup\$ everything you mentioned i already know about, so this is not answer for my question, notice this link electronics.stackexchange.com/questions/38573/… they are formulas for what it is something similar to what im looking for, \$\endgroup\$
    – Frank
    Mar 6, 2016 at 22:43

You can use simple trajectory planer from linuxcnc.com https://github.com/LinuxCNC/linuxcnc/blob/master/src/emc/motion/simple_tp.c
A planner of course just outputs setpoints: position and velocity, now it is up to you to use them for setpoints of a closed loop:


simulate this circuit – Schematic created using CircuitLab



Your Answer

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

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