Arduino Forum

Using Arduino => Motors, Mechanics, Power and CNC => Topic started by: Candice on Nov 03, 2013, 02:13 pm

Title: Questions regarding a circuit for driving a motor
Post by: Candice on Nov 03, 2013, 02:13 pm
Hi all,

Yesterday I found a circuit diagram out there on the internet which is basically for lowside driving of a brushed DC motor with a logic level MOSFET. It's a bit like this bildr (http://bildr.org/2012/03/rfp30n06le-arduino/) tutorial, except that you can get bi-directional control of the motor.  Here's the circuit I found:



The circuit has a DPDT switch to change the direction of the motor.  I have this circuit running at the moment minus the switch (and yes I have a common GND which the above circuit doesn't indicate) - it's basically the bildr tute but with the 100 ohm resistor as in the diagram above.  

OK, so now my major question regarding the circuit diagram above is... is it safe?  In that scenario, the switch would have to cope with the back emf when the motor stops (hence the flyback diode across the switch points)?  So what kind of DPDT switch is this?  Would it be a DC rated switch?  

Thanks in advance,
Candice

Title: Re: Questions regarding a circuit for driving a motor
Post by: MarkT on Nov 03, 2013, 03:14 pm
"Sorry this person moved or deleted this image"
Title: Re: Questions regarding a circuit for driving a motor
Post by: Candice on Nov 03, 2013, 04:02 pm
My apologies Mark. :smiley-red:  I hope it's viewable now.
Title: Re: Questions regarding a circuit for driving a motor
Post by: joemcder on Nov 03, 2013, 04:39 pm
The switch can be protected easily by going to 0 speed before switching the direction.  The energy is drained from the motor before switching.  In practice with a robot or similar mechanism you need to do this anyway to avoid excessive mechanical stress.

With zero energy switching the stress on the DPDT is negligible.
Title: Re: Questions regarding a circuit for driving a motor
Post by: Candice on Nov 03, 2013, 05:11 pm
Thanks for the reply joe mcd.  I understand that motor has to be stopped before switching, but isn't there kickback from the motor when it comes to a stop?  I actually have a soft stop for the motor, but my understanding was that there will still be back emf.  Wouldn't this take it's toll on the switch?  I also read something about the possibility of arcing across the points of switches if you just use AC-rated ones to switch DC current, so that's why I asked the question about what kind of switch is required.  Maybe this is a storm in a teacup but I just thought I'd ask in case there is an issue.
Title: Re: Questions regarding a circuit for driving a motor
Post by: joemcder on Nov 03, 2013, 06:13 pm
The back EMF is magnetic energy which quickly dissipates into the mechanical system.  Remember the switch is still closed to the motor (or whatever), you just turn off the PWM for a brief period before reversing.
Title: Re: Questions regarding a circuit for driving a motor
Post by: keeper63 on Nov 03, 2013, 07:03 pm
About the only other thing you'll want to review is the type of contacts the relay contains; there are different contact materials depending on whether you are switching resistive loads (light bulb or heater coil), inductive loads (solenoids or motors - your scenario), or capacitive loads (mainly small AC signal - like audio). Check the datasheet for the relay before you purchase it.
Title: Re: Questions regarding a circuit for driving a motor
Post by: Candice on Nov 03, 2013, 08:06 pm
Thanks again joe mcd. :)

And thanks also cr0sh for taking the time to post that advice.  What kind of contact material should I be looking for - will the datasheet just say that the switch is for inductive loads?  I guess I should just go have a look and see for myself.

Thanks everyone.

Title: Re: Questions regarding a circuit for driving a motor
Post by: michinyon on Nov 04, 2013, 12:47 am
I would only do this,  for a very small motor.
Title: Re: Questions regarding a circuit for driving a motor
Post by: dc42 on Nov 04, 2013, 06:16 pm

And thanks also cr0sh for taking the time to post that advice.  What kind of contact material should I be looking for - will the datasheet just say that the switch is for inductive loads?  I guess I should just go have a look and see for myself.


The fact that a motor is an inductive load does not matter in this case, if you reduce the motor current to zero and allow time for the back emf to dissipate before operating the relay or switch. So the switch just needs to be rated for the motor supply voltage, and the stall current of the motor.
Title: Re: Questions regarding a circuit for driving a motor
Post by: joemcder on Nov 04, 2013, 06:17 pm
Quote
I would only do this,  for a very small motor.


I'd like to here your reason.  Remember motors were reversed with relays long before electronic control existed.
Title: Re: Questions regarding a circuit for driving a motor
Post by: Candice on Nov 04, 2013, 09:17 pm


And thanks also cr0sh for taking the time to post that advice.  What kind of contact material should I be looking for - will the datasheet just say that the switch is for inductive loads?  I guess I should just go have a look and see for myself.


The fact that a motor is an inductive load does not matter in this case, if you reduce the motor current to zero and allow time for the back emf to dissipate before operating the relay or switch. So the switch just needs to be rated for the motor supply voltage, and the stall current of the motor.


Thanks dc42.  The thing is that a lot of the switches I see are apparently for AC current (?).  I see for example, DPDT switches which are for "250VAC 15A".  What does this translate to for DC current?  I was doing a bit of reading on Sunday, to try and work out the answer to this question when I came across this pdf (http://www.eaa.org/sportaviationmag/2005/0502_switches.pdf) from 1986, which was interesting to read. 

But OK, I'm not building anything for a plane.  :P  (Although it would help enormously if I didn't elecrocute myself a year from now due to the failure of a "an AC rates switch"  :)).

My motor is a 12V brushed motor with a stall current of 13.5A (according to the spec sheet).  So my plan was to find a "DC rated switch" - for 12V 15A or maybe 12V 20A depending on what I could find, but these "DC rated switches" are pretty rare by the looks of it - nothing matches my search criteria on digikey (my digikey search skills are not that strong however).  What I ended up finding on digikey was a 30V 30A switch, which seems OTT, but it would be safe.

Title: Re: Questions regarding a circuit for driving a motor
Post by: dc42 on Nov 05, 2013, 12:41 am

The thing is that a lot of the switches I see are apparently for AC current (?).  I see for example, DPDT switches which are for "250VAC 15A".  What does this translate to for DC current?  I was doing a bit of reading on Sunday, to try and work out the answer to this question when I came across this pdf (http://www.eaa.org/sportaviationmag/2005/0502_switches.pdf) from 1986, which was interesting to read.


The AC current rating of a switch or relay is normally higher than the DC current rating at a similar voltage, because when you break AC (at least if the load is resistive), the voltage goes to zero after at most 1/50 sec, extinguishing the arc. With DC, the arc continues until the contact separation is too great to maintain the arc, which can be much longer - hence the lower current rating. But if you intend to break the circuit only when the current is zero, then you can get away with a switch that is only rated to carry 13.5A, not to break it.

Is it a switch or a relay you are looking for? I'm not clear about this from your posts.
Title: Re: Questions regarding a circuit for driving a motor
Post by: Candice on Nov 05, 2013, 10:16 pm
The AC current rating of a switch or relay is normally higher than the DC current rating at a similar voltage, because when you break AC (at least if the load is resistive), the voltage goes to zero after at most 1/50 sec, extinguishing the arc. With DC, the arc continues until the contact separation is too great to maintain the arc, which can be much longer - hence the lower current rating. But if you intend to break the circuit only when the current is zero, then you can get away with a switch that is only rated to carry 13.5A, not to break it.

Is it a switch or a relay you are looking for? I'm not clear about this from your posts.
[/quote]

No not a relay, just a mechanical switch.

My application is basically an "e-spinner".  It's essentially a spinning wheel used to spin yarn, but instead of treadling and having a drive wheel to drive the yarn-spinning mechanism, I have a motor doing the work. 

I have a footswitch connected to my arduino which I use to soft start and soft stop the motor.  I pwm the mosfet gate to get the motor up to the rpm that I need for whatever yarn I'm spinning, and then if I need to stop the motor, I soft stop it.  All I want to do with the toggle switch is to change the direction of  the motor when I've got 0 pwm on the gate.  I hope that makes sense (and I hope it will be do-able with a simple DPDT on-on toggle switch). 

Would that work, or do you mean that I would have to disconnect the power to my e-spinner, flip the switch to change the direction of the motor, and then re-power my circuit again to resume spinning?

Thanks,
Candice
Title: Re: Questions regarding a circuit for driving a motor
Post by: dc42 on Nov 05, 2013, 10:22 pm

Would that work, or do you mean that I would have to disconnect the power to my e-spinner, flip the switch to change the direction of the motor, and then re-power my circuit again to resume spinning?


That will work just fine. There is no need to disconnect the power, if you always (or nearly always) turn off the mosfet and wait a fraction of a second for the back emf to dissipate through the flyback diode, before you flip the switch. And a readily-available switch rated for 250V 15A AC should be just fine, even though it will be passing DC.
Title: Re: Questions regarding a circuit for driving a motor
Post by: dc42 on Nov 05, 2013, 10:22 pm

Would that work, or do you mean that I would have to disconnect the power to my e-spinner, flip the switch to change the direction of the motor, and then re-power my circuit again to resume spinning?


That will work just fine. There is no need to disconnect the power, if you always (or nearly always) turn off the mosfet and wait a fraction of a second for the back emf to dissipate through the flyback diode, before you flip the switch. And a readily-available switch rated for 250V 15A AC should be just fine, even though it will be passing (but not breaking) DC.
Title: Re: Questions regarding a circuit for driving a motor
Post by: Candice on Nov 05, 2013, 11:44 pm
Thanks for your perseverence and patience explaining that dc42.  Off to get myself a switch!

Thanks also to everyone who took the time to comment on this thread - you all rock.  :)

Candice