I need to control 2 DC motors (Maxon RE40) using an AVR (atmega328) through pwm. I was wondering what is the right way to approach the situation.

Should I increment the duty-cycle at a specific time interval or I should just take care that the difference between two consecutive duty-cycle its not too large?

I want the system to be as responsive as possible but also take care of the motors.

I need to understand the way a soft start should be designed (in software) and what are the possible trade offs.


  • \$\begingroup\$ What do you mean by taking care of the motors? There are physical values like acceleraton, speed, jerk. Also what will you control: voltage or current? \$\endgroup\$ Commented May 5, 2016 at 17:50
  • \$\begingroup\$ I mean that I don't want to destroy the motors by changing the speed from full speed in one direction to full speed in the other direction. I control the motors using pwm through a driver (so voltage), but I also have current sensors for each motor (if this is relevant) \$\endgroup\$ Commented May 5, 2016 at 18:41
  • \$\begingroup\$ If you have current sensors, then you may wish to close the loop around current. This is one of the best methods for motors since current directly influences the motor torque. It is a bit more complex than 'limit the duty cycle' approaches. \$\endgroup\$ Commented May 5, 2016 at 20:03

1 Answer 1


But the motor has to change from full speed in one to another direction or form zero to full speed, that's why we use motors. You can limit the current and consequently the acceleration. the H bridge shall output such voltage that the current remains always in the margins. The best you can do is a PI regulator, the setpoint is rated motor current and the feedback is measured current. When you will start, the regulator will output a certain duty cycle setpoint and it will be increased by regulator output when the motor will gain speed (back EMF compensation). $$M=J\alpha + M_{load}$$ $$M \propto I_a$$ $$U_a=I_a*R_{winding}+U_{backEMF}$$ $$U_{backEMF}=k[V/krpm]*n[rpm]$$


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.