EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: gammzy98 on January 23, 2019, 06:14:13 pm

Title: Question on reversing polarity for DC Motors
Post by: gammzy98 on January 23, 2019, 06:14:13 pm
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-Hobby-Project-12-V-DC-Gearhead-Motor-High-Torque-6mm-D-Type-Shaft/283249435191?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649  (https://www.ebay.com/itm/500-RPM-Hobby-Project-12-V-DC-Gearhead-Motor-High-Torque-6mm-D-Type-Shaft/283249435191?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649)

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

Title: Re: Question on reversing polarity for DC Motors
Post by: MasterT on January 23, 2019, 06:41:36 pm
Arduino UNO + H-Bridge Motor driver shield.  Look on-line tutorial, basic functionality you can get in a few hours.
Title: Re: Question on reversing polarity for DC Motors
Post by: gammzy98 on January 23, 2019, 11:11:06 pm
Arduino UNO + H-Bridge Motor driver shield.  Look on-line tutorial, basic functionality you can get in a few hours.

Hey! Thanks so much for the reply! I will definitely look into this. I am just curious why this method specifically? Is this the most efficient and basic way to achieve what I am looking to do? So Arduino is the way to go?
Title: Re: Question on reversing polarity for DC Motors
Post by: coromonadalix on January 23, 2019, 11:14:39 pm
you have some cheap timed relays boards on ebay with trigger pins etc,  many models and modes to choose, you define/programm your needed timings ??
Title: Re: Question on reversing polarity for DC Motors
Post by: MasterT on January 24, 2019, 12:03:01 am
Arduino UNO + H-Bridge Motor driver shield.  Look on-line tutorial, basic functionality you can get in a few hours.

Hey! Thanks so much for the reply! I will definitely look into this. I am just curious why this method specifically? Is this the most efficient and basic way to achieve what I am looking to do? So Arduino is the way to go?
I think so.  The alternative is to do some circuitry using logic IC or 555, but it would not be less pricey or less time consuming.
With arduino you can add extensive functionality latter on, like soft start-up, RPM control etc.   
Title: Re: Question on reversing polarity for DC Motors
Post by: james_s on January 24, 2019, 02:16:34 am
An Arduino Uno and H-bridge shield is about the least efficient way of doing what you want, but if money is not an issue then it is a quick and easy way to get a prototype going.

You can do the same thing FAR cheaper with a bare AVR and an H-bridge IC, or you can build your H bridge the old fashioned way out of separate transistors. Or you could go an even simpler route and use a 3PDT switch, use two of the poles to control the direction wired directly to the motor and the third pole to trigger a one-shot timing circuit. This could be as simple as a R-C delay or a bit fancier using something like a 555.
Title: Re: Question on reversing polarity for DC Motors
Post by: beanflying on January 24, 2019, 02:30:45 am
Plenty of options to do this sort of thing. If you want to keep the electronics simple then it can be done with an Arduino or another micro and a few libraries using a Brushed ESC like this one eBay auction: #332135735707 these also have the benefit of a brake function (motor hold) if that is of value to what you are trying to do with the gearmotor.

If you want to skip the micro then 555 timer and some bits to generate a switched 1-2mS pulse can also be used to drive it.
Title: Re: Question on reversing polarity for DC Motors
Post by: amyk on January 24, 2019, 03:01:09 am
I suspect you're trying to control something that needs to be moved between two positions? If so, a set of limit switches and relays would probably be a better choice, given that trying to do open-loop position-reckoning of a non-stepper motor by time alone is going to significant drift.
Title: Re: Question on reversing polarity for DC Motors
Post by: gammzy98 on January 28, 2019, 01:35:43 am
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:

https://www.youtube.com/watch?v=g0HqtuOVFGQ (https://www.youtube.com/watch?v=g0HqtuOVFGQ)

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

https://ibb.co/Qb4bzkT (https://ibb.co/Qb4bzkT)


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.
Title: Re: Question on reversing polarity for DC Motors
Post by: beanflying on January 28, 2019, 02:19:40 am
Personally I wouldn't try and reinvent the Linear Actuator  :)

(https://cdn.shopify.com/s/files/1/0615/2193/files/Actuator_exploded_view_large.png?v=1539811999)

There is a huge variation available and they can be very cheap depending on the requirements. Do a search on AilExpress or EBay

They are available with or without limit switches and a range of layouts to incorplorate into whatever base you need.
Title: Re: Question on reversing polarity for DC Motors
Post by: JagV12 on January 28, 2019, 08:35:55 am
Timing is definitely not the best way to go. Limit switch is way better in this situation. Micro-switch or Reed switch & magnet will do. I had a 12V wiper motor to extend-show and retract-hide a 1 meter wide Hand fan (through a chain reduction gear). It was wired like this :

(http://) (See attachment. Hey, how can I insert the attached image here ?)

SW2 and SW3 are NC (Normally Closed). If SW1 is in the down position, B is +12V and A is 0V. Motor will rotate "forward" until SW3 opens. If SW1 switches to up position, A is +12V and B is 0V. D2 is passing current until SW3 closes again and motor rotate "backward" until SW2 opens. If SW1 switches to the down position again, D1 will pass the current until SW2 closes and motor will rotate "forward". Of course 1N4148 are probably not suitable for the motor startup current, choose the diodes and switches accordingly. In case of Reed switch & magnets, relays will be necessary...
Zip file is to be opened with Proteus ISIS for simulation (and fun !)

EDIT :New versions without diodes
Title: Re: Question on reversing polarity for DC Motors
Post by: Zero999 on January 28, 2019, 11:03:09 am
Timing is definitely not the best way to go. Limit switch is way better in this situation. Micro-switch or Reed switch & magnet will do. I had a 12V wiper motor to extend-show and retract-hide a 1 meter wide Hand fan (through a chain reduction gear). It was wired like this :

 (See attachment. Hey, how can I insert the attached image here ?)

SW2 and SW3 are NC (Normally Closed). If SW1 is in the down position, B is +12V and A is 0V. Motor will rotate "forward" until SW3 opens. If SW1 switches to up position, A is +12V and B is 0V. D2 is passing current until SW3 closes again and motor rotate "backward" until SW2 opens. If SW1 switches to the down position again, D1 will pass the current until SW2 closes and motor will rotate "forward". Of course 1N4148 are probably not suitable for the motor startup current, choose the diodes and switches accordingly. In case of Reed switch & magnets, relays will be necessary...
Zip file is to be opened with Proteus ISIS for simulation (and fun !)
That will work and is a common limit switch configuration. Yes, of course don't use the 1N4148 (I'd recommend Schottky diodes such as the 1N5822) and the switches should be rated to carry the full motor current. I agree, using relays is a good idea and is a must if the motor draws over a few Amps. If SW1 is replaced with two relays, the control and limit switches and associated wiring only needs to carry a small current.

Adding in-line images is a bit of a pain. Attach them and post as usual. Go to your post, open the image you've just attached. Copy the address to the clipboard (the exact procedure depends on your browser). Edit your post and paste it between the [img][/img] tags.

Here's an example, using your schematic.
(https://www.eevblog.com/forum/projects/question-on-reversing-polarity-for-dc-motors/?action=dlattach;attach=636715;image)

Note, please use png format for schematics, because it saves space, results in a clearer image and makes it easier for others to edit, if necessary. You can save even more bandwidth by converting the image to indexed (256 or fewer colours) which will not affect the image quality of schematics, since they hardly use that many colours anyway.
Title: Re: Question on reversing polarity for DC Motors
Post by: Raj on January 28, 2019, 02:04:12 pm
contactors maybe? for heavy motor ,it's easiest
Title: Re: Question on reversing polarity for DC Motors
Post by: Zero999 on January 28, 2019, 03:46:51 pm
contactors maybe? for heavy motor ,it's easiest
Yes, contactors are a good idea if failure to stop could cause a lot of damage and mandatory if it could result in injury.