5

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.

Rob Napier
  • 153
  • 8
  • 2
    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. – Anindo Ghosh Jan 25 '13 at 12:47
  • About motor current: Working against the motor necessarily causes a current spike, it is essentially being driven in stall conditions or beyond. – Anindo Ghosh Jan 25 '13 at 12:48
  • 3
    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. – Dave Tweed Jan 25 '13 at 12:53
  • 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. – John U Jan 25 '13 at 13:35
  • @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. – Rob Napier Jan 25 '13 at 17:15
  • Btw, a slip clutch is a very interesting idea. But I haven't seen any small enough. For my enclosure, I'd hope for something between 0.5-0.75", but most I've seen look like they're over 1" tall, which is pretty big for my case, when I add the required things (like a pot or linear encoder) above and below. – Rob Napier Jan 25 '13 at 17:35
  • Have you thought about SAMPLING the knob on the microcontroller, and letting the controller control everything? I like one control point personally, parsing all the inputs. That will force you to formalize your algorithm for merging the two control modes. – Scott Seidman Jan 25 '13 at 22:46
  • @RobNapier - I'm sure if you got your google-fu on you could find some stuff about how they're made, how to repair (equipment which features) one, that kinda stuff. Look at the Panasonic CDJ turntables for a starter. Scott has a good point too, rather than move the knob, could you solve the problem without the complexity of a motor etc. by controlling the circuit in a slightly different way? Personally I always try to find the simplest and most elegant way of solving the problem rather than throwing extra parts/code/arduinos at it as many do. – John U Jan 28 '13 at 09:22
  • I don't quite understand what you mean by "letting the controller control everything." A key component of this design is that people can turn the knob and that it will turn back like a rotary egg timer (it's totally possible to create a system that doesn't work like that, but then that would be a different project; if I wanted a cheap, practical timer, I'd buy one at Target :D). I haven't been able to figure out the name of the piece I'm interested in to google it. – Rob Napier Jan 28 '13 at 14:17
  • Spent some more deep-google time and finally came across this, which finally seems a possibility: http://www.west.net/~jay/fmillera/fmillera/prvc.htm – Rob Napier Jan 30 '13 at 02:09

2 Answers2

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.

Phil Frost
  • 56,804
  • 17
  • 141
  • 262
  • 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. – Dave Tweed Jan 25 '13 at 13:36
  • @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? – Rob Napier Jan 25 '13 at 17:22
  • @Philfrost What is the "on resistance" of the MOSFET? – Rob Napier Jan 25 '13 at 17:25
  • 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? – Rob Napier Jan 25 '13 at 17:28
  • @RobNapier it will be listed in the MOSFET datasheet as \$R_{DS-ON}\$, usually. It varies with temperature and gate voltage, and suffers from some other non-ideal effects, but if you don't need very accurate current regulation, you can consider a MOSFET that's on as resistor, and you can calculate the current through it by ohm's law. – Phil Frost Jan 25 '13 at 17:42
  • @DaveTweed That's absolutely wrong. If you suddenly reverse the leads on a motor you were driving, the back-EMF is now not working against the battery, but with it. The angular momentum of the motor and the mechanical load attached to it is now an energy source, and if you don't have a good place for it to go, Bad Things Will Happen. If the motor can provide enough energy to power all the other loads in the circuit, the usual power supply for the circuit must become a power _sink_ instead of a power _source_. The voltage won't rise to the extent that the power supply can be a power sink. – Phil Frost Jan 25 '13 at 18:02
  • "... the back-EMF is now not working against the battery, but with it." That just means that a huge current spike will be drawn from the battery. In other words, the battery is dumping energy *into* the motor to accelerate the load in the other direction. If you simply open-circuit the motor, the voltage across it will be similar to the drive voltage, but no current will flow unless you give it a path. – Dave Tweed Jan 25 '13 at 18:02
  • @DaveTweed OK, I see your point. We do need an inductance, and we do need a path. Unfortunately, we have both. In my mind, back-EMF is necessarily part of a motor, and _always_ accompanied by an inductance, and it's the back-EMF that causes the current in that inductance to potentially be more than what the rest of the circuit that requires. I've changed the wording to hopefully be more clear on that point. – Phil Frost Jan 25 '13 at 19:06
  • OK, That looks good. But now you raise a different point about regenerative braking. Throwing the battery in reverse across a spinning motor will give you *active* braking, but you won't get *regenerative* braking unless you build a circuit that can boost the back-EMF of the motor to a level at which it can charge the battery. *(Note that you can use the transistors of the H-bridge in conjuction with the motor's inductance to accomplish this, but it requires careful design.)* – Dave Tweed Jan 25 '13 at 20:03
  • @DaveTweed That's not true. The only way to brake a motor without regeneration is to put a resistance between the terminals. The switching of the H-bridge effectively creates a boost converter. The only way you can get non-regenerative braking is to not PWM the H-bridge at all, and let all the energy be converted to heat by the transistor and motor winding resistance. Ask a new question and I'll explain more fully with schematics and math. – Phil Frost Jan 25 '13 at 20:42
  • 1
    I think we both just said the same thing. I don't need any further explanation. – Dave Tweed Jan 25 '13 at 21:05
  • let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/7262/discussion-between-phil-frost-and-dave-tweed) – Phil Frost Jan 25 '13 at 21:20
  • [How can suddenly stopping a spinning motor cause my supply voltage to shoot up with the back-EMF can't exceed the supply voltage?](http://electronics.stackexchange.com/questions/56170/how-can-suddenly-stopping-a-spinning-motor-cause-my-supply-voltage-to-shoot-up-w) – Phil Frost Jan 26 '13 at 06:05
0

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.

Chintalagiri Shashank
  • 2,241
  • 17
  • 26
  • 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 :) – Rob Napier Jan 25 '13 at 17:32
  • 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. – Chintalagiri Shashank Jan 25 '13 at 19:19