I'm developing a small knob that can be controlled by both the user and a microcontroller. My current design is a modified servo. I'm removing most of the gearing to keep the motor's torque low. I'm using the pot to keep track of knob location and an H-bridge to drive the motor.

If the user tries to turn the knob while the microcontroller is also trying to turn the motor, I'd like to maintain constant torque and not let the current spike. Essentially I want to let the user "win" but I don't want to turn off the motor or damage it.

Do I need protection circuitry here, or is a motor fine with being forced backward while it's trying to run forward? This is my first non-trivial use of a servo, and I'm still learning how they and DC motors work.

  • 2
    \$\begingroup\$ If the user is rotating the shaft against the servo's microcontroller-generated position signal, the shaft will in any case rotate back to specified position as soon as the user lets go... If the motor does not have sufficient torque to do that, it won't be able to rotate the knob anyway. Perhaps a bidirectional stepper is more appropriate for this task, since manual rotations can be read back, and digitally controlled rotation needs no additional power after making the rotation steps needed. \$\endgroup\$ Jan 25, 2013 at 12:47
  • \$\begingroup\$ About motor current: Working against the motor necessarily causes a current spike, it is essentially being driven in stall conditions or beyond. \$\endgroup\$ Jan 25, 2013 at 12:48
  • 3
    \$\begingroup\$ To a first approximation for most motor types, torque is directly proportional to current. Therefore, if you want to limit the torque, limit the current. \$\endgroup\$
    – Dave Tweed
    Jan 25, 2013 at 12:53
  • \$\begingroup\$ I'd do it mechanically using a small slip-clutch or similar in the knob. Also have a look at how they do it in pro mixing desks etc. as they have powered faders that the user can grab to override. \$\endgroup\$
    – John U
    Jan 25, 2013 at 13:35
  • \$\begingroup\$ @JohnU, I've heard of this in high end car stereos, but I didn't have any to take apart (contemplating some time at the junk yard). Do you have pointers on how they do it, since this is exactly my problem. \$\endgroup\$
    – Rob Napier
    Jan 25, 2013 at 17:15

2 Answers 2


You can apply a voltage opposite the direction the motor is turning as long as you don't exceed the maximum power of the motor and driving components. Depending on the motor, and the speed, and the torque, you may or may not need protection circuitry.

You will also have to consider that working with the back-EMF rather than against it, the motor current can get very high, very fast. This happens any time you decrease the average drive voltage faster than friction will slow the motor; applying full reversed voltage is just the most extreme case. Consider that if you allow the user to command rapid direction changes, under some conditions you will experience regenerative braking. If your power supply can't also be a power sink, and the power of the other loads in the circuit is less than the power extracted from the motor, then your supply rail voltage will be driven up and bad things will happen. Including a crowbar might be good protection, or you might want to switch on a power resistor to convert this energy into heat when necessary.

One approach you can take is to detect the back-EMF of the motor, then limit the difference of the average voltage you apply to the motor. Once you have detected and compensated for back-EMF, the motor is effectively a resistor, and by limiting the voltage across it you also limit the current, by ohm's law. This effectively gives you an simple but effective, open-loop, current/torque limited control with very little additional complexity. You can even use the on resistance of your MOSFETs to detect current.

The reason this is easier than just measuring and controlling the current directly is that you can directly calculate the voltage necessary to reach your target current, rather than finding it with a PID controller or such. Plus, you get speed information.

  • \$\begingroup\$ It's a popular misconception, but no, back-EMF by itself can NOT cause "the voltage to shoot up". Only a current flowing through an inductance can do that. \$\endgroup\$
    – Dave Tweed
    Jan 25, 2013 at 13:36
  • \$\begingroup\$ @DaveTweed, can you elaborate (or link) more on this? My specific concern is a current (rather than voltage) spike when stalling the motor. Specifically I don't want to burn it out. Are you saying it won't if stalled? Or are you just saying there's no voltage jump? \$\endgroup\$
    – Rob Napier
    Jan 25, 2013 at 17:22
  • \$\begingroup\$ @Philfrost What is the "on resistance" of the MOSFET? \$\endgroup\$
    – Rob Napier
    Jan 25, 2013 at 17:25
  • \$\begingroup\$ And are basically saying that as I notice the resistance going up (by measuring some voltage going down I assume), I can back off my uprocessor driving voltage and avoid current spike? I'm driving the motor with PWM, but I assume that's the same as a lower voltage? \$\endgroup\$
    – Rob Napier
    Jan 25, 2013 at 17:28
  • 1
    \$\begingroup\$ I think we both just said the same thing. I don't need any further explanation. \$\endgroup\$
    – Dave Tweed
    Jan 25, 2013 at 21:05

Generally, a DC motor would take quite unkindly to such a situation. Reducing torque by removing gearing may not be a particularly good idea either, in that you may end up with insufficient torque to drive the knob itself in a reliable way. If you've tried it and the knob by itself works, then you should be fine on that count. However, do keep that in mind as a potential problem, which may need rectification depending on how you solve the problem.

Since you want the user to win, you should be looking for some way for the micro to realize that the user is even playing. There are two ways I can think of for doing this -

One way is to detect that the motor is consuming more or less current than it should at that setting of speed / voltage / duty cycle / whatever you're controlling using the h-bridge. You could have a high side or low side current shunt at the servo supply which can help you measure this. For quicker response, some sort of scheme involving a comparator may be a better bet. Note that you will have to first figure out how much current is 'normal', which may be dependent on both the supply voltage as well as the quality of the knob, etc. and to a smaller degree on temperature. You should also investigate how repeatable this normal area is

The second method is to detect if the pot is turning as much as it should, or less, or more. This is much harder to do, especially since this means you need to be aware of any and all control loops that may be involved, and also be very confident about repeatability.

Note that for both methods, having a gearhead can actually help with repeatability, and particularly more so with the second method.

Whichever method you use, once you've detected that the user is playing, your motor should pull back and no longer exert control. Depending on what sort of servo you are using, this may not be very easy to achieve. For a generic DC motor, you would basically want to let the motor winding float on atleast one end. If the servo has an internal control loop which you can't shut down, you would have to atleast power off the servo. This is probably best done with a low side switch. More details would be necessary to be sure, though.

In either case, for the period during which you haven't yet detected that the user is involved and until your controller reacts, you're in a somewhat dangerous area. You should try to minimize this time as much as possible. Be sure to include diodes for protecting against reverse EMF, something simple like an 1N4007 or better yet something fast like a MUR110. You would have two diodes each on both the motor lines. If the servo includes a control loop, you may not be able to access these lines. Such servos generally have the reverse EMF diodes anyway, though.

  • \$\begingroup\$ Regarding gearing, I don't have a working prototype yet, but a standard servo gearing is too aggressive for a person to easily turn, so I definitely want to reduce that. I'd like to avoid just turning off the motor, since I have various reasons to exert some processor "push back" on the user. In one of my use cases I want to provide the equivalent of "stops" so that the dial tends to snap to certain spots (mimicking physical detents). I just don't want to burn out the motor in the process :) \$\endgroup\$
    – Rob Napier
    Jan 25, 2013 at 17:32
  • \$\begingroup\$ In that case, a stepper probably is a better idea. Also, if the motor is still running, you would need to be able to differentiate between changes in the settings due to the motor and changes because of user intervention, and accordingly change the set point in the uC. Using a DC motor to simulate 'dents' seems like a bit of an ask. You're more likely to burn out the drive circuitry rather than the motor winding, btw. Using a low torque motor and making the drive circuit less aggressive with a small current limit, and rev emf diodes is probably the direction you'd want to go, if you insist. \$\endgroup\$ Jan 25, 2013 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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