Pages: [1] 2   Go Down
Author Topic: Best way to control the direction of motors  (Read 913 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Sr. Member
****
Karma: 1
Posts: 462
I am a amateur.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!
I am not currently working on this project. However, if I were to make an RC car with an Arduino, what would be the simplest and smallest way to control a motor's spinning direction by reversing the polarity? The motor (300mA) needs transistors to operate. So is it possible to toggle motor on and off and change its rotation direction with only PNP and NPN transistors? Or does it require another way?
Thanks!
Logged


Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31355
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes it is possible. Look up the h bridge circuit
Logged

Offline Offline
Sr. Member
****
Karma: 1
Posts: 462
I am a amateur.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Grumpy_Mike. This is an H-Bridge example:

S1   S2   S3   S4   Result
1   0   0   1   Motor moves right
0   1   1   0   Motor moves left
0   0   0   0   Motor free runs
0   1   0   1   Motor brakes
1   0   1   0   Motor brakes
1   1   0   0   Arduino dies
0   0   1   1   Arduino dies
1   1   1   1   Arduino dies


* H-Bridge.PNG (134.06 KB, 919x822 - viewed 18 times.)
« Last Edit: April 29, 2013, 04:24:44 pm by dkl65 » Logged


Windy City
Offline Offline
Jr. Member
**
Karma: 0
Posts: 90
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why not consider something like a L293D?  They can handle the current you are talking about and are pretty cheap.  They were designed for just this sort of application.

http://www.aztecmcu.com/sitebuildercontent/sitebuilderfiles/l293d.pdf
Logged

Dirt Biker

Johannesburg UTC+2
Offline Offline
Faraday Member
**
Karma: 60
Posts: 3242
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Since your question was...

Quote
what would be the simplest and smallest way

.... a 293 is a good choice. Only reason to it with transistors that I can think of, is if you had a need to learn about this from first principles. Let the 293 do the electronics for you.....

This tutorial shows wiring and Arduino code.
Logged

Have you looked for answers in the Learning, Reference, Products and Playground tabs on http://arduino.cc/en/ ?
Look here http://electronicsclub.info/ for basic electronics

0
Offline Offline
Shannon Member
****
Karma: 160
Posts: 10418
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If the 300mA is the no-load rating then you'll need to find out the stall-current too - that's the one that will bite you.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Sr. Member
****
Karma: 1
Posts: 462
I am a amateur.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

How come on the Wikipedia H-Bridge chart on my reply #2 show that if the same charge is applied on both terminals of the motor, the motor will "brake"? Isn't there no current flowing?
Logged


0
Offline Offline
Shannon Member
****
Karma: 160
Posts: 10418
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When both the top or both the bottom switches are on, the motor terminals are effectively shorted together,
which acts as a electromagnetic brake.

Electromagnetic braking gets stronger as the square of the motor speed, note, and lots of current can flow
(all DC motors are also DC generators).
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Sr. Member
****
Karma: 1
Posts: 462
I am a amateur.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Will using the electromagnetic brake risk damaging the motor, other components or the Arduino?
Logged


Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24319
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Shouldn't do.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Sr. Member
****
Karma: 1
Posts: 462
I am a amateur.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

And obviously, the motor is not drawing current in electromagnetic brake mode, right?
Logged


Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24319
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No, it is supplying current. That's how the Prius works.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

0
Offline Offline
Shannon Member
****
Karma: 160
Posts: 10418
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Shouldn't do.

Depends on the set-up - full-on braking with a large motor spinning fast and lots of (moment-of-)inertia could rip the motor
off its stand!  With a small hobby motor I don't think there will be any issues...

With electric vehicles the electromagnetic braking is under PWM control so the braking force can be controlled
to the desired level, avoiding wheel-lock or damage.  Full-on braking is equivalent to stall-conditions so that the
current (and thus torque) is limited ultimately by the motor's internal resistance.

DC motors produce torque pretty much directly proportional to current, and back EMF is directly related to rotation
speed.  When under normal load the applied average voltage is roughly the same as back EMF, only the difference
between applied voltage and back EMF is available to drive current through the windings.  Braking is simply applying
0V to the windings (thus full back-EMF is available to drive current through windings)
Logged

[ I won't respond to messages, use the forum please ]

Texas, land of the free, home of the stupid
Offline Offline
Full Member
***
Karma: 3
Posts: 225
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

65,
The conditions which you have labeled as 'shoot through', should be re-labeled to something like 'OUCH!', or 'what's that smell?'.  the bridge (s) become short circuits and smoke belloweth forth...
Logged

Offline Offline
Sr. Member
****
Karma: 1
Posts: 462
I am a amateur.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
No, it is supplying current. That's how the Prius works.
smiley-surprise I have to test that with a multimeter measuring current in series!

Do I need protection diodes to stop the back EMF or whatever from damaging the Arduino? If so, where would the diodes go?

Quote
Braking is simply applying 0V to the windings (thus full back-EMF is available to drive current through windings)
So the motor is using its back EMF to resist motion? Is there any difference between brake 0101 and 1010 (refer to chart)?
Logged


Pages: [1] 2   Go Up
Jump to: