# Reverse a DC motor at a set current

#### skot9000

Joined Jan 28, 2009
18
I am looking for some help with a circuit to reverse a DC motor when it's current reaches a certain level. I think that current level will be in the neighborhood of 2A, however I would like this to be adjustable.

I have a 9V DC motor that is going to be winding up some cable. I'd like to have the motor reverse direction when the cable gets tight, and then continue running in the reverse direction until it gets tight again and then reverse and so on.

I am thinking the best way to do this is to monitor the current to the motor by measuring the voltage across a low-side sense resistor, and then have the circuit flip a latching DPDT relay to reverse the motor.

Here is what I have come up with so far; http://www.skot9000.com/proj/wiremotor/circuit1.pdf

Does this seem reasonable? Any part suggestions for the opamp and comparator? I don't really have any experience designing analog circuits. I have read about hysteresis and it sounds like I will need it on the comparator.

Also, where do people get high wattage non-wirewound 0.1ohm resistors?

thanks!
-Skot

#### SgtWookie

Joined Jul 17, 2007
22,210
Hi Skot,

Can you give some more details about your application - like what kind of wire you're going to be winding and unwinding?

There are some problems to overcome. First is that motors have their highest current when they're at stall or starting from a dead stop (exception: when the polarity across them is switched when running at speed).

You really don't want to switch polarities across a motor while it's running at speed in one direction; you need to stop it first.

Assuming you're winding the cable on a motor-powered drum or spool, if you don't keep tension on the cable, it'll be sure to get all kinked up if you suddenly change speed or direction of the motor.

A simple analog circuit will have a difficult time telling what is start-up current vs what is stall current. They'll both put similar voltages across your sense resistor.

You don't have a diode across your relay coil. That will cause your comparator to get zapped the 1st time current stops flowing through the coil due to the reverse EMF spike.

#### skot9000

Joined Jan 28, 2009
18
the motor is going to be winding steel cable.. more like twisting it actually.. into a big kink. (art piece). Once the kink gets good and tight I want the motor to reverse until it gets in a tight kink again and on and on.

Start-up current draw must be brief, right? If so, maybe I could charge a capacitor on the comparator output to differentiate between brief start-up current and current from strain on the motor?

The motor is a gear motor, so when it switches direction, it could be going full speed.. however the torque of the twisted cable will want to get it going in the other direction.. How bad is it to switch polarity at speed?

Joined Jul 7, 2009
1,583
Another thought is to put e.g. a roller microswitch on the line (or a Hall effect switch, optical sensor, etc.) and have it activate at a certain point. Then there's no need to sense current; just shut off the voltage, change polarity, wait for motor to stop, then apply the voltage again.

#### skot9000

Joined Jan 28, 2009
18
someonesdad- There isn't really a set point at which the motor needs to reverse, it's only when the load gets to great.. and it could be different from iteration to iteration depending on how the cable tangles it's self...

Joined Jul 7, 2009
1,583
someonesdad- There isn't really a set point at which the motor needs to reverse, it's only when the load gets to great.. and it could be different from iteration to iteration depending on how the cable tangles it's self...
Ah, now I understand -- I had the wrong mental picture.

You're in good hands with SgtWookie -- I recommend following his advice.

Another thought is that you might want to put a scope across the shunt resistor and look at the actual current waveform. Motor currents can be awfully noisy. Because of that, you may want to put an integrator on the current signal and look at the cumulative current rather than the instantaneous current (or a low pass filter might work).

Now we get into some fun design thinking. What you want is to switch when the motor rotational speed gets low. Maybe you could use some kind of magnet assembly that would couple to the shaft when the speed was low, but disengage when the speed is higher. Here's my mental model: put a collar on the motor shaft and set screw it to the shaft. This collar has a small magnet in it. Then put another collar over this collar that also has a magnet in it. When the motor is turning quickly, the two magnets pass by each other quickly and rotational inertia keeps them from locking together and one slips past the other. When the motor speed gets slower, at some point they do lock together and the outside collar turns with the inner one. This causes a switch to flip, reversing the motor. We're not out of the woods yet because the motor has to start up nearly instantaneously to make sure that it rotates quickly in the other direction to not capture the outer collar until the motor slows down again. So, it still needs some thinking through -- but it might be the germ of an idea for someone else to suggest a better method.

When I propose ideas like this, I always think to myself "would I go into my shop and try to build something like this?". In this case, I think I'd answer no, because it might take a lot of experimentation to find the right design. If there was a commercial application where it might generate revenue, then maybe the experimentation and resources needed could be justified.

#### SgtWookie

Joined Jul 17, 2007
22,210
Here is a pretty basic motor reversing circuit using two SPDT relays that you could begin adapting:

S1 and S2 provide ground paths for RLY1 and RLY2.

If neither or both S1 and/or S2 are closed, the motor terminals will effectively be shorted, acting as a brake.

S1 and S2 could be replaced by transistors or MOSFETs.

If you just use a DPDT relay like you have shown in your schematic, you will have a hard time providing braking action to stop the motor without adding more components.

#### Attachments

• 9.5 KB Views: 118

#### skot9000

Joined Jan 28, 2009
18
This current sense idea is getting tricky. Upon closer inspection, the startup current on this motor is huge. I think I am going to try and use a microcontroller with a photo interrupter to detect a slowing in speed and use the dual relay setup from sgtwookie to reverse the motor.

I think I still need latching relays to store the current direction when powered off..

#### SgtWookie

Joined Jul 17, 2007
22,210
Actually, you probably wouldn't need latching relays. They'd be expensive for one thing.

If you're using a small PIC (like a 12F629 or 12F675), you could store the last direction selected in EEProm.

Using a PIC or other uC would be a very good idea, because you could provide for a slow motor start-up using PWM. A PIC12F683 has a built-in PWM function, but you wouldn't necessarily have to use a PIC with a built-in PWM; you could do it in a software routine.

You could even get rid of the relays altogether, and use an integrated H-bridge IC.

#### hobbyist

Joined Aug 10, 2008
887
Hi,
I used to make stall sensors for my wheeled robots, when the motor is under normal load, the wheels turned forward, the moment the motor goes into a stall, the motors through some drive circuitry would reverse, for a preset time than return forward, as long as the motor was stalled the motor kept in reverse direction.

I don't have the schematic anymore, but basically here is how it was done.

A small value (sensor) resistor, was connected across the source and gate terminal of a power mosfet. This resistor was chosen, by calculating the normal motor current, with a voltage just below the threshold voltage of the mosfet.

The drain of the mosfet was connected to a transistor stage for driving a resistor capacitor timing circuit.

The gate of the mosfet was connected back to motor power supply.

So under normal motor running conditions, the motor current was driven through the resistor to ground.

The mosfet was NOT conducting.

However when a stall occured the excess current produced a greater voltage drop, that the source terminal became more neg. to the point of conduction, which at that point the stall current was bypassed the series resitor, and now flowed through the mosfet, and from there became a neg. going signal to the transitor stage, connected to it.

This transitor stage sent that neg. sig. through a couple of RC timing circuits, to produce a short delay, after the preset delay, the signal was inverted and sent to a transitor driving circuit to switch the direction of the motor, for a preset time.

The key was using a RC delay timing circuit, so that the motor would not loop at every small glitch of stall current, this delay ensured that the motor was in a true state of stalling before trigering.

I think a timing circuit would be appropriate for your motor driving circuitry, which would take care of any ambiguous glitches in the system.

Just a suggestion, brought to the table.

Last edited:

#### THE_RB

Joined Feb 11, 2008
5,438
There is a tried and proven 1-transistor circuit here;
http://www.romanblack.com/current.htm

That will probably suit your requirements. The 22uF cap (C1) can be increased to act as a small time delay, in practice that is a good way to make it not trigger on motor start current (which is usually < 0.2 sec) but only trigger after a stall of (say) 0.5 sec.