# How to define a throttle profile for PWM driven DC motor on a power wheels

I am building an arduino to output PWM to a simple low side MOSFET motor driver that's powering two DC motors on a power wheels Corvette. I will have a throttle input signal between 0 and 100%, but I believe the output PWM needs to be more complex to account for starting torque and minimum voltage for the motor. Do most drive profiles start with a short pulse of 100% power to break the starting torque before pulling back to match the throttle percentage? Where can I find more information on how to define a throttle profile?

It depends on how fancy you want to get.

It's common in industrial usage (and model trains) to pulse the voltage to a motor (or the current, depending on what your driver controls).

The explanation gets complicated when you're PWM-ing a motor. Normally when you drive a motor with PWM, you're driving it fast enough so that the motor smooths the current. This is a good thing, because it makes for efficient operation.

To break friction, you need to pulse the drive to the motor such that the motor generates enough torque to break the friction, and for long enough so that the motor can actually move significantly. Done right, you'll hear a buzz and see your mechanism advance at an almost arbitrarily slow crawl. Slower motion will give you a slower buzz; if you allow control down that slow, really slow motion will result in a ticking sound.

For a fixed intensity and on-time, you'll find that for each pulse, the motor advances by some minimum amount -- so you can't move the motor by an arbitrarily small amount. This is just a feature of driving a mechanism with friction and one you have to live with. The fix isn't found in the electronics or the control rule -- it's found in the mechanical construction of the motor and mechanism. For your application, you'll probably be fine -- the amount the car will move with each "tick" will be imperceptible, so the motion will appear smooth to you.

Determining the intensity and duration of the pulse is either done with a whole lot of calculation, followed by experimentation to make sure that you were right, or just starting out with experimentation. Since you don't have control over the mechanical design, I suggest just starting with experimentation. Find the amount of drive that'll just barely start the motor moving -- then double it, to account for wear, tear, and changing temperatures. Then find the pulse duration that gives you acceptable low-speed behavior.

I throttle such drives by starting out varying the period of the "slow buzz" -- remember that you're keeping a fixed on time, so you vary the off time to get different speeds. Once your throttle is at the height of your pulse (i.e. 25% throttle for a 25% pulse), then just drive the motor "normally" from there to 100% throttle.

Then stop messing with it, because this is something that you can get lost in for weeks trying to chase some optimum that only you can see (I've been there, done that -- write "you can't make a silk purse out of a sow's ear" on the wall, and figure that once you're in the neighborhood of "good", chasing "best" is just a waste of time).

• Thanks for the very practical answer! Agree on not trying to chase perfect for this project. Commented Jul 16, 2021 at 15:08

Do most drive profiles start with a short pulse of 100% power to break the starting torque before pulling back to match the throttle percentage?

Not to my knowledge.

If under automated control there is feedback to compensate so no need to explicitly set that.

If manually controlled, you just use your eyes and human intuition. But you may want to simply disallow an arbitrarily low non-zero throttle which will help prevent the user stalling or overheating the motor from low power which will also have the effect of a setting a minimum starting torque. You may also cutoff the throttle below some battery voltage.

• Actually, if you're driving a mechanism with significant friction, it's not uncommon for low-speed operation to be accomplished with short, high-intensity pulses for exactly the reason the OP states. Search on "driving motors with friction" and see if it comes up with useful hits. Commented Jul 16, 2021 at 14:29
• @TimWescott I see... Commented Jul 16, 2021 at 14:30

One approach to this problem is to use feedback with a PI or PID controller. The throttle gives a speed command. That command is compared with the actual speed to give an error signal. That error signal is integrated (the I in PI or PID, and the integral is added to the original (Proportional) error signal, which is then used to control the pulse width modulation.

With a setup as described above, if the motor does not start immediately, the integral error signal will grow until the motor does start. It is similar to your idea of having an initial high duty cycle signal, but it is adaptive, and adjusts to circumstances.

• That can lead to oscillations when there's motor friction. They usually cause more error than the method of bumping the motor with a predetermined pulse. So you want a "bump the motor at slow speeds" inner loop, then wrap that with a PI controller. Commented Jul 16, 2021 at 17:30

There is no simple answer, a real system consists of layers:

• Current control (you may skip it, but in a real system it's important)
• Speed control - may be useful for autonomous systems, like cruise control in your vehicle.
• Speed profiler - the one that defines acceleration, i think this is what you refer to.
• advanced algorithms- things that do weird stuff like open loop corrections or automatic gain calibration, etc.

So for me the takeaway would be that it's pretty complex to simply drive PWM, but i would start with speed profiler: decide every X msec what speed do you want to have at this point.

This is pretty easy- if you have a timer, inside the interrupt simply add a constant speed each time (it's acceleration) until you reach your cruise speed.

What do you do about it then? You either convert it straight to PWM (rough, but will do for the beginning) or build a velocity control loop. Current loop would be next.

I hope it helps.