# Reducing motor speed without jamming up

So I built three little bots so far.

One with a raspberry-pi, (6V motors), one with an arduino (12V motors), and another with an arduino but a hacked remote car (7ish, volt motors):

The problem I have with all these is that the motors spin so fast the car just bumps into something in a few seconds. (I have a small house)

I tried to use PWM to control the speed, but at a little less than full throttle (255) they jam up and they can't take the weight I put on them.

Should I buy one of these chassis that slow the motor down and give it torque with a gearbox, or is there anything else I can do?

1. Gearboxes are probably your best bet if you never want to go fast.
2. You may be able to make it work better if you give it pulsed power (PWM in a way, but pulsed at a speed low enough that the motor actually gets going and then slows down each time. See Controlling Motors in the Presence of Friction and Backlash for details on the technique.
3. You can almost certainly make it better if you put some sort of closed-loop speed control on the motors. Encoders are best, but you can do amazing things using back-EMF speed sensing. Either of these techniques require you to work with a closed-loop system which isn't trivial, and neither of them will overcome all the problems unless you use a gearbox (but, with closed-loop speed control you can have a much higher ratio of top to bottom speed while keeping things smooth).
• Hey thanks for your answer. I tried (1) and got a 45 RPM motor+gearbox. Works decent so far. About point (3), I've heard about these encoders from the rover 5 platform, I understand it will help me scan how fast the motors are going? Forgive my ignorance but how will this really help? Is the speed control that is outputed by the arduino and the actual speed different? Also, what do you mean by closed loop ? – gideon Jul 3 '13 at 19:26
• Wikipedia has the skinny on rotary encoders: en.wikipedia.org/wiki/Rotary_encoder. The ones in the pictures are scary-fancy, though. Yes, a rotary encoder can help. I don't know Arduino, but I'll bet that their "speed control" is just a drive voltage. If so, then sensing the motor speed and adjusting the drive voltage can help tremendously. Sensing the speed and using it to drive the motor speed is what I mean by closed loop control -- once again Wikipedia comes to the rescue, although with a very wordy article: en.wikipedia.org/wiki/Feedback – TimWescott Jul 3 '13 at 21:28
• Yep on the arduino I can just do PWM pulses slower or faster to control speed. So essentially you're saying I should send PWM pulses and then scan for the speed the robot is running at. The rover 5 has hall effect encoders so if I do buy one of those then I will try it. Thanks very much for your help. – gideon Jul 4 '13 at 15:56

When you PWM the voltage to the motor you are effectively controlling the current to the motor which is related to torque (acceleration). The "jamming up" that you notice is basically the inability of the motor to overcome friction.

Think about the PWM as the gas pedal in your car, to get to a constant speed you may push all the way down, gradually back off as you reach your target speed and then modulate it to maintain that speed.

A DC motor driven at a fixed voltage loses torque as it goes faster and faster. That's why it doesn't speed up to infinity. Gearing it down effectively limits the top speed you'll see at the output. It gives you more torque at the output but you're trading off speed.

As Tim notes what you need is a closed speed control loop running over that such that you set a speed set-point and the loop, very quickly, ramps the PWM up and down to maintain the speed. To do that you need some way of measuring the speed. Once you have that you may be able to get by with a relatively simple PI controller.

• @MarkBooth: Thanks for the comment! It's a somewhat imperfect analogy but the point is that speed is self limiting and that's why slapping a gearbox on that system results in lower top speed. In a DC motor it's effectively limited by the back EMF and my imperfect analogy to that is the "red line". I'll think of a way of expanding the answer. – Guy Sirton Jul 5 '13 at 17:54
• @MarkBooth: A gear box doesn't really give you more controllability. It can improve your stability if your feedback is at the motor because now the reflected load is smaller. It will always reduce the linearity and the stiffness of the system. I'll think of a better analogy though :-) – Guy Sirton Jul 5 '13 at 20:01
• @MarkBooth: It really depends if you're thinking about control of the load or the motor. Your ability to control the load is a a function a how stiffly it is coupled to your motor... – Guy Sirton Jul 5 '13 at 20:22
• Thanks for the edits Guy, can't fault your answer now. I guess we have different ideas about controllability though. *8') – Mark Booth Jul 6 '13 at 0:35

You need to use a PID algorithm to control the speed of the motors, that way you'll be able to make them spin as slow as you need while still getting torque. The PID algorithm needs to measure the speed of your motor somehow, the typical way is to place some optical encoders in the wheels, this is a must for any rover and besides giving you the speed will give you a very good estimate of the position, which helps navigate and make turns.

You can steal the optical encodes from an old mouse, those with a ball.

• Including "somehow" in the answer suggests a bit more detail is required... – Andrew Aug 16 '13 at 13:38