# Change Direction of 9v DC Motor Rotation using Reed Switches and Relay(s)

#### Brianjones90

Joined Nov 26, 2017
9
I am attempting to make a motorised camera dolly which reverses direction at each end of a dolly track

It will be a carriage driven by a 9v battery powered electric motor

I need to make a small circuit to automatically reverse the polarity to the motor at each extremity of travel, so that the dolly changes direction

I have read that this can be achieved by the use of a reed switch mounted to the carriage, and a magnet laid at each extremity of travel

Can anyone suggest a simple circuit to achieve this?

#### LesJones

Joined Jan 8, 2017
4,115
Is the carriage continously travelling between the ends of the track or is it controlled to be stopped at points along the track ?
Is the battery, motor and control circuit mounted on the carriage or is it fixed and drives the carriage via a cord etc. ?
What is the maximum current taken by the motor ?
Must there be only one reed switch used for reversing ? (I originally misread your post thinking there were two reed switches and one magnet. I designed a circuit assuming that there was a reed switch at each end of the track and a magnet on the carriage before I realised that I had misread your post.)

Les.

#### Zane Finner

Joined Jan 29, 2018
30
I've been experimenting with h-bridges. This may help (see attachment)

#### Attachments

• 17.8 KB Views: 12

#### LesJones

Joined Jan 8, 2017
4,115
You can reverse the motor using an H bridge or a DPDT relay. Using your single reed switch you can toggle a flipflop (For example half of a CD4013) using the signal from the reed switch. You would need to de bounce the signal from the reed switch to avoid multiple triggering. The output of the flipflop would control the H bridge or relay.

Les.

#### Brianjones90

Joined Nov 26, 2017
9
Is the carriage continously travelling between the ends of the track or is it controlled to be stopped at points along the track ?
Is the battery, motor and control circuit mounted on the carriage or is it fixed and drives the carriage via a cord etc. ?
What is the maximum current taken by the motor ?
Must there be only one reed switch used for reversing ? (I originally misread your post thinking there were two reed switches and one magnet. I designed a circuit assuming that there was a reed switch at each end of the track and a magnet on the carriage before I realised that I had misread your post.)

Les.

1) The carriage travels continuously between the ends of the track

2) The battery, motor and control circuit are mounted on the carriage - therefore also the reed switch(es) need to be

3) I do not have a specification for the current draw of the motor - it is one of these, which I am driving using a 9v PP9 battery :-

https://www.ebay.co.uk/itm/DC-12V-1...hash=item2cc9f678c7:m:mDlk2tHAv5LchAHxT8JPATA

4) More than one reed switch is fine - I am assuming one magnet on the dolly track at each end of travel.

Also - it would be ideal if there was some provision in the circuit for slowing down to a halt before beginning travel in the opposite direction, rather than an abrupt stop. Unfortunately, with that motor I cannot add a flywheel to achieve this...

#### AnalogKid

Joined Aug 1, 2013
10,789
This can be done with one magnet at each end of the track and only one reed switch on the dolly. If the motor draws less than 100-150 mA, then all of the circuitry fits in two CMOS 555's (LMC555, etc.). The two 555's form the H bridge with almost zero external components, and one of them also is the toggle flipflop. If the current is greater, then the same circuit is done with CMOS logic gates and small power MOSFETs.

About the slowdown... If power is suddenly cut from the motor while travelling at its normal speed, how many inches does the dolly coast while the motor winds down to 0 rpm? A second reed switch and a bit more complex logic circuit could either kill the motor or switch a resistor in series with it to slow it down before the end of travel.

OR, back to only one reed switch. When it toggles the flip flop, the H-bridge has a delay between when one side turns off and the other side turns on. The delay is times to allow the motor to slow to 0 rpm. When the other side of the bridge does come on, it comes on slowly, like over 1 second, rather than snapping on. Hmmm - this sounds promising.

OK, I think I've got it. With an R-C delay driving only the lower bridge transistors and a monostable to guarantee that there is no cross conduction, the motor will ramp down to zero, sit just long enough to be sure, then ramp up in the other direction.

2 - CD4093 or CD40106
2 - p-channel MOSFET
2 - n-channel MOSFET
4 - timing resistors (3 timers, 1 debounce)
6 - capacitors (4 timing, 2 decoupling)

or something like that. What is your skill set for assembling a small circuit on perf board or a solderless proto-board?

ak

Last edited:

#### Brianjones90

Joined Nov 26, 2017
9
This can be done with one magnet at each end of the track and only one reed switch on the dolly. If the motor draws less than 100-150 mA, then all of the circuitry fits in two CMOS 555's (LMC555, etc.). The two 555's form the H bridge with almost zero external components, and one of them also is the toggle flipflop. If the current is greater, then the same circuit is done with CMOS logic gates and small power MOSFETs.

About the slowdown... If power is suddenly cut from the motor while travelling at its normal speed, how many inches does the dolly coast while the motor winds down to 0 rpm? A second reed switch and a bit more complex logic circuit could either kill the motor or switch a resistor in series with it to slow it down before the end of travel.

ak

Somthing like this? :-

- how would one go about replacing the 100k pot?

The motor stops instantly when current is removed - there is a worm gear in the gearbox - so I wondered if some kind of capacitor could be used to maintain and gradually drop off th current at the end of each run?

#### Brianjones90

Joined Nov 26, 2017
9
This can be done with one magnet at each end of the track and only one reed switch on the dolly. If the motor draws less than 100-150 mA, then all of the circuitry fits in two CMOS 555's (LMC555, etc.). The two 555's form the H bridge with almost zero external components, and one of them also is the toggle flipflop. If the current is greater, then the same circuit is done with CMOS logic gates and small power MOSFETs.

About the slowdown... If power is suddenly cut from the motor while travelling at its normal speed, how many inches does the dolly coast while the motor winds down to 0 rpm? A second reed switch and a bit more complex logic circuit could either kill the motor or switch a resistor in series with it to slow it down before the end of travel.

OR, back to only one reed switch. When it toggles the flip flop, the H-bridge has a delay between when one side turns off and the other side turns on. The delay is times to allow the motor to slow to 0 rpm. When the other side of the bridge does come on, it comes on slowly, like over 1 second, rather than snapping on. Hmmm - this sounds promising.

OK, I think I've got it. With an R-C delay driving only the lower bridge transistors and a monostable to guarantee that there is no cross conduction, the motor will ramp down to zero, sit just long enough to be sure, then ramp up in the other direction.

2 - CD4093 or CD40106
2 - p-channel MOSFET
2 - n-channel MOSFET
4 - timing resistors (3 timers, 1 debounce)
6 - capacitors (4 timing, 2 decoupling)

or something like that. What is your skill set for assembling a small circuit on perf board or a solderless proto-board?

ak
That sounds very good - and beyond my design skils. - I am planning on assembling it all on the breadboard first to test, and then I will etch and drill myself a small board to assemble the final item on.

#### AnalogKid

Joined Aug 1, 2013
10,789
OK, I have it. One 4093, one 4013. With a motor ramp down, the dolly might overshoot the magnet, so the switch might trip again as the dolly starts up Iin the other direction. 2 reed switches, one at each end of the dolly such that only one comes on at each end of the track, makes the logic more simple.

ak

#### Brianjones90

Joined Nov 26, 2017
9
OK, I have it. One 4093, one 4013. With a motor ramp down, the dolly might overshoot the magnet, so the switch might trip again as the dolly starts up Iin the other direction. 2 reed switches, one at each end of the dolly such that only one comes on at each end of the track, makes the logic more simple.

ak
That sounds good - I want to buy enough components in one order to try the various options - so it makes sense to get a few reed switches anyhow

#### AnalogKid

Joined Aug 1, 2013
10,789
If a 9 V transistor radio battery is the total power, then 555's probably can handle the motor current. But that's no fun, plus you might need 4 transient suppression diodes.

First pass at a schematic with speed ramp-up and ramp-down. Note that this is preliminary, way open to review and comment. This version assumes that the dolly comes to a complete stop while still holding the reed switch closed.

U1A and B form a 1 second monostable with an active-low output. When pin 4 goes low it turns off both upper FETs immediately through U1C and D. One already was off, and the other turns off slowly as its gate capacitor discharges. This lets the motor sped wind down gradually. When the monostable times out, it makes a positive edge that clocks the flipflop, disabling the FET pair that was on and turning on the other pair. Pin 4 stays high, enabling both upper FET NAND gates, but only one of them has a high on the other input. The upper FET turns on slowly as its gate capacitor charges, gradually increasing the motor speed.

R2 and R3 might need to be adjusted to make sure the motor comes to a complete stop before the monostable times out.

All FETs spend most of the time either saturated or cut off, but the upper FETs spend about 0.5 s per cycle in the linear region, dissipating a little heat.

UPDATE: If the dolly overshoots the magnet, such that the switch closes again shortly after the dolly starts moving in the other direction, the unused 4013 flipflop can solve that issue with no additional parts.

ak

Last edited:

#### Brianjones90

Joined Nov 26, 2017
9
If a 9 V transistor radio battery is the total power, then 555's probably can handle the motor current. But that's no fun, plus you need 4 transient suppression diodes.

First pass at a schematic with speed ramp-up and ramp-down. Note that this is preliminary, way open to review and comment. This version assumes that the dolly comes to a complete stop while still holding the reed switch closed.

U1A and B form a 1 second monostable with an active-low output. When pin 4 goes low it turns off both upper FETs immediately through U1C and D. One already was off, and the other turns off slowly as its gate capacitor discharges. This lets the motor sped wind down gradually. When the monostable times out, it makes a positive edge that clocks the flipflop, disabling the FET pair that was on and turning on the other pair. Pin 4 stays high, enabling both upper FET NAND gates, but only one of them has a high on the other input. The upper FET turns on slowly as its gate capacitor charges, gradually increasing the motor speed.

R2 and R3 might need to be adjusted to make sure the motor comes to a complete stop before the monostable times out.

All FETs spend most of the time either saturated or cut off, but the upper FETs spend about 0.5 s per cycle in the linear region, dissipating a little heat.

ak
View attachment 149374

That's great - thank you! I will order some parts, and see how it goes

#### AnalogKid

Joined Aug 1, 2013
10,789
While you're at it, get some 100K, 220K, 330K, and 1.0M resistors in case the timers have to be adjusted.

ak

#### MisterBill2

Joined Jan 23, 2018
16,612
You can do the whole control function with two relays and four reed switches, four magnets, and no electronics. You would also need a start button . The start button engages one relay to power the motor tow"drive north" relay. The dolly will then coast up to magnet #2, which will engage the "drive south" relay, and the dolly will head back in the other direction until it reaches magnet #3, which will release the drive south relay, and the dolly will then coast up to the point where magnet #4 will engage the "drive north" relay, and the cycle will repeat. The hard parts are that you need two NC reed switches, operated by magnets #1 and #3, and two NO reed switches, operated by magnets #2 and #4. Each of the two relays will need to have at least 3 sets of contacts , 2 sets for driving the motor and 1 set for the self-latching circuit. Also, the reed switches will need to be located so that only one magnet will operate them. This circuit is about as simple as it could be. OOPS! I forgot that you will also need a stop button or a power switch.

#### MisterBill2

Joined Jan 23, 2018
16,612
I don't know what happened, I posted this reply once and it did not show up.
The function required can be provided by using two 3Pole Double Throw relays and 4 reed switches with 4 magnets. 2 of the reed switches must be normally closed and the other 2 normally open. Also a start button, NO, and a stop button NC are needed. I will call the two directions north and south. Each relay has a self-sealing circuit engaged by an NO reed switch and released by an NC reed switch. The slowdown at each end is by coasting after the NC reed switch is triggered by it's magnet.
The drive starts with the pushbutton latching the drive north relay, running the motor forward, until it passes magnet #1, releasing the drive north relay, and then the dolly coasts until it reaches magnet#2, which seals in the drive south relay. The dolly then rolls south until it reaches magnet #3, releasing the drive south relay, and then the dolly coasts until magnet #4 seals in the drive north relay, and the cycle repeats. The stop button opens the power feed to the latching contacts of both relays. I would send a circuit but I am not at a computer with the cad software to draw it today.

#### AnalogKid

Joined Aug 1, 2013
10,789
Given that the power source is a single 9 V battery, I thought relay coils would reduce battery life significantly, possibly drawing more current than the motor. Also, according to post #7 the dolly does not coast when power is removed.

Here is a more simple circuit using two CMOS 555's as an h-bridge. This one does not ramp the motor speed up and down, but R3-C3 creates a dead band for the motor to drop to 0 rpm before reversing. Because the 555 has a totem pole output, the four transient suppression diodes might not be necessary.

Two reed switches, one at each end of the dolly, make the control logic very simple.

ak

Last edited:

#### Brianjones90

Joined Nov 26, 2017
9
I don't know what happened, I posted this reply once and it did not show up.
The function required can be provided by using two 3Pole Double Throw relays and 4 reed switches with 4 magnets. 2 of the reed switches must be normally closed and the other 2 normally open. Also a start button, NO, and a stop button NC are needed. I will call the two directions north and south. Each relay has a self-sealing circuit engaged by an NO reed switch and released by an NC reed switch. The slowdown at each end is by coasting after the NC reed switch is triggered by it's magnet.
The drive starts with the pushbutton latching the drive north relay, running the motor forward, until it passes magnet #1, releasing the drive north relay, and then the dolly coasts until it reaches magnet#2, which seals in the drive south relay. The dolly then rolls south until it reaches magnet #3, releasing the drive south relay, and then the dolly coasts until magnet #4 seals in the drive north relay, and the cycle repeats. The stop button opens the power feed to the latching contacts of both relays. I would send a circuit but I am not at a computer with the cad software to draw it today.

If you have time to post a circuit that would be great - I am keen to try a range of options and see which works best for this particular task

#### MisterBill2

Joined Jan 23, 2018
16,612
The circuit can be described as a pair of classic latching relay circuits with each of the relays having extra contacts to run the drive motor. Given the small size of the motor the relay coils could be fairly high resistance ones so as to not draw much current. The magnet near each end of the track would release the relay driving it toward that end, and then the magnet at the end would operate the relay driving it toward the opposite end. I hope that this description is adequate because I am still not in a position to deliver a drawing of the circuit.