# Question on reversing polarity for DC Motors

Discussion in 'General Electronics Discussion' started by gammzy98, Jan 23, 2019.

1. ### gammzy98

12
0
Aug 7, 2016
I was wondering if anyone can help me with this situation. I have a 12V DC Motor. It will be powered by a 12V power supply, no batteries involved. It will be hooked up to a switch. The function I want to achieve is as follows:

When the switch is flipped one way, the motor spins clockwise for "X" amount of seconds, then stops. X being a defined number that can be programmed or controlled.

When the switch is flipped the other way, the motor spins counterclockwise for "X" amount of seconds, then stops. X being a defined number that can be programmed or controlled.

What would be the easiest way to accomplish this function? Preferably off the shelf components that you can buy, but I am open to ideas. Here is the link to the motor: https://www.ebay.com/itm/500-RPM-Ho...=STRK:MEBIDX:IT&_trksid=p2057872.m2749.l2649

Any help with this in the right direction would be greatly appreciated. Thank you.

2. ### Tha fios agaibh

2,135
721
Aug 11, 2014
I'd probably use 2 control relays with latch contacts one for each direction (polarity) and use a off delay timer in series that would break its run time after x duration of run time.
I don't know what current it will draw, but you may only need small ice cube relays.

3. ### Alec_t

2,936
799
Jul 7, 2015
Won't the switch also need a centre 'off' position?

4. ### Tha fios agaibh

2,135
721
Aug 11, 2014
Yes, momentarily would be easiest.

5. ### AnalogKid

2,476
712
Jun 10, 2015
The way I read #1, the motor is controlled by a timer (or two) and the timer(s) are controlled by the switch. No center-off position needed.

ak

6. ### Tha fios agaibh

2,135
721
Aug 11, 2014
If maintained contacts of the switch are required then I'd use 2 one shot relays.

Ebay has many of these one shot timer modules for a few bucks a piece.
Relay contacts usually can handle up to 10a.

Using a timer to drive anything that requires accuracy is not advised.

7. ### Bluejets

4,614
977
Oct 5, 2014
Surely that would depend on the timer used.
Interlocking the drive relays would ensure no 2 could be on together. Forward Reverse sometimes requires a careful eye on contact racing also.

8. ### Tha fios agaibh

2,135
721
Aug 11, 2014
Even if a timer is accurate down to a μs, there is still mechanical lash between a spinning motor and whatever its driving and fluctuating RPMs that makes accurate repeatability difficult.

I don't know the application here or if accuracy of position is important but I thought it worth mentioning.

Yes, good point about interlocking Fwd and Rev. If both were to come on at the same time you've got a dead short.

9. ### gammzy98

12
0
Aug 7, 2016
Hey guys thank you all so much for your help in this. I’m seeing suggestions spanning different areas and im not sure which route would be the absolute best to take. My friend and I are building a project and are fairly new to these solutions and terms. Our original plan was to allow power to the motor to move an object x seconds and return x seconds, hopefully to end up in its original position. However as “Tha fios agaibh” mentioned, unless the timer is extremely accurate 100% of the time and the RPM is also consistent at the same exact speed, this would become a problem as the slightest offset would add up to total failure in the long run. My friend and I will make a video tomorrow and post it here to hopefully allow you all a better understanding of what it is we are trying to achieve. Once again I thank you all for your help and advice thus far.

10. ### BobK

7,682
1,688
Jan 5, 2010
What you want is limit switches. Switches that activate when the object reaches the desired position. Then all you need is a DPDT switch for direction and 2 normally closed limit switches. When the object gets to the desired position, the corresponding switch is hit and the motor is cut off. This is a very standard circuit.

Bob

11. ### gammzy98

12
0
Aug 7, 2016
Hey guys we’ve actually found a video doing essentially what it is that we are trying to achieve with our project:

As you can see In the video he manually controls when to stop the motor after switching polarities. Had he not, the inner cylinder would have either popped off or grinded against the motor itself. We simply want a switch that would do that and know exactly when to stop in order to not over eject or inject. We thought we could do it with a simple timer but as we have already realized thanks to this chat and help that using a timer to calculate accuracy wouldn’t be the best option long term. Any idea what’s the best possible route? I see another suggestions but before I consider anything I thought it best that you all see this video and see what you think then. Again I appreciate all the help you’ve all given and will consider all options.

12. ### BobK

7,682
1,688
Jan 5, 2010
See post #10.

You need a switch on each end of travel that is mechanically triggered by the moving part. The switches are wired in series with the power supply so that when either of them is pressed the power is cut off.

Bob

Last edited: Jan 25, 2019
13. ### gammzy98

12
0
Aug 7, 2016
Hey thanks Bob and everyone else that contributed to this thread, I’m gonna be doing more research and keep everyone updated with a video of our progress real soon.

14. ### gammzy98

12
0
Aug 7, 2016
Hey everyone, just coming with an update on this. Appreciate everyone's help so far! I filmed a video to better explain what I am trying to accomplish. Here is the link:

Here is also a diagram to better explain as well (click on to zoom in):

Really hoping to finish this within the next two months as it is a birthday present. They would be amazed and absolutely love it! If anyone can help out it would be GREATLY appreciated.

15. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,481
2,830
Jan 21, 2010
OK, here is a simple limit switch circuit:

The diodes are arranged so they permit the motor to operate in the OPPOSITE direction once the limit switch opens the connection to the motor. They must be able to withstand the stall current of the motor (at least briefly) as the motor starts.

Applying power in one direction will drive the motor until the limit switch activates. Then nothing happens until the polarity is reversed. The motor will then run to the other limit switch activation.

All you need now is a circuit to swap polarity with each button press. There are lots of ways to do this.

The easiest way to reverse polarity is with a pair of relays. That way there is no chance of shorting out your power supply:

With both relays off or powered, the motor receives no power. Only with a single relay activated will it be powered.

Now all you need to do is have a circuit which alternately powers one relay or the other.

If you are using a toggle switch this is the easiest. All you need to do is have the toggle switch apply power to one relay coil in one position and the other relay coil in the other position, If you want to use a push button, I'd recommend a push-on/push-off switch because you can wire that the same way.

If you really have to have a momentary contact push button switch then you need more electronics.

edit: you originally specified a toggle switch, so that is easy!

Tha fios agaibh likes this.
16. ### Tha fios agaibh

2,135
721
Aug 11, 2014
I would consider using magnetic reed switches for their compact size as opposed to mechanical limit switches that can be cumbersome and difficult to mount on something like this.

You need to make make sure these limits are reliable because if the trip-dog missed them, the motor will keep running.

17. ### albert001

10
0
Dec 21, 2018
It was years ago I was thinking of controlling a zoom lens using an arduino module, but never got around to it, as found anther zoom lens with a controller. Though the older large lens has RS-232 capabilities it was designed to connected to a cctv camera control system. It was a large heavy zoom lens with gears, motors, etc. ran from 12 volts dc. I was planning on bypassing any RS-232 and connecting directly to it's motors.

I have a couple of basic Arduino boards in storage, but haven't ever got around to use them.

You could first build a prototype using your own switches and relays then graduate to an Arduino board with add on motor control module?

Looking online I see there's modules with relays designed to work with Arduino to control stepper motors. from around \$5.00 to over \$15.00

e.g.

* Qunqi L298N Motor Drive Controller Board Module Dual H Bridge DC Stepper For Arduino
https://www.amazon.com/Qunqi-Contro...ocphy=9059803&hvtargid=pla-306436938191&psc=1

* DC Motor Driver, DROK L298 Dual H Bridge Motor Speed Controller DC 6.5V-27V 7A PWM Motor Regulator Board 12V 24V Electric Motor Control Module Industrial 160W with Optocoupler Isolation
https://www.amazon.com/dp/B06XGD5SC...&pd_rd_r=5b36d984-2339-11e9-a560-cf993223e1a5

* Anmbest PWM 1.8V-15V Low Voltage DC 1.8V 3V 5V 6V 12V 2A 30W 1803BK High Efficiency Motor Speed Controller with Adjustable Driver Switch for Arduino
https://www.amazon.com/Anmbest-1-8V...ocphy=9059803&hvtargid=pla-593965800626&psc=1

The PWM DC Motor Speed Controller allows controlling the direction of a DC motor using a Pulse-Width-Modulated (PWM) DC voltage with a Duty Cycle fully adjustable from 0%-100%. DC Motor Speed Controller allows controlling the direction of a DC motor using a Pulse-Width-Modulated (PWM) DC voltage with a Duty Cycle fully adjustable from 0%-100%.

and many others

Last edited: Jan 28, 2019