Can PWM run DC motor both directions
Archiver
Posts: 46,084
Just a quickie question, I have yet to use PWM and was
wondering if in the code can you run a DC motor both
directions (at seperate times) with PWM or do you need
a relay to switch polarity??
Thanks
Matt
__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1
wondering if in the code can you run a DC motor both
directions (at seperate times) with PWM or do you need
a relay to switch polarity??
Thanks
Matt
__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1
Comments
Original Message
From: "Matthew K"
> Just a quickie question, I have yet to use PWM and was
> wondering if in the code can you run a DC motor both
> directions (at seperate times) with PWM or do you need
> a relay to switch polarity??
>
> Thanks
> Matt
If you connect the motor between to stamp pins you can, Lets assume pins 0
and 1.
The motor will need to be rated 20ma @ 5 or 6vDC for direct connection to
the pins.
Make pin1 low and PWM pin0 to drive the motor one way,
Pin0 low and PWM pin1 to drive it the other.
> wondering if in the code can you run a DC motor both
> directions (at seperate times) with PWM or do you need
> a relay to switch polarity??
The PWM signal by itself cannot run the motor both directions. A
DPDT relay can be used as you suggest to switch the polarity and
hence the direction.
A more elegant solution that does not use a relay is to use a
circuit called an "H Bridge". With this there is no mechanical
switching component, etc. The "H Bridge" uses 4 transistors
controlled by the processor so that you can "swap" the polarity
of the power applied to the motor. You can build the circuit
yourself or there are commercial IC packages with the whole works
built in.
Tim
> > wondering if in the code can you run a DC motor both
> > directions (at seperate times) with PWM or do you need
> > a relay to switch polarity??
>
> The PWM signal by itself cannot run the motor both directions.
A
> DPDT relay can be used as you suggest to switch the polarity
and
> hence the direction.
>
> A more elegant solution that does not use a relay is to use a
> circuit called an "H Bridge". With this there is no mechanical
> switching component, etc. The "H Bridge" uses 4 transistors
> controlled by the processor so that you can "swap" the polarity
> of the power applied to the motor. You can build the circuit
> yourself or there are commercial IC packages with the whole
works
> built in.
More information about an H Bridge circuit can be found at
http://www.bobblick.com/bob/projects/hbridge/
Tim [noparse][[/noparse]replying to his own messages now :-(]
run the motor in two directions. See the National Semi website for
the Applications Note. The LMD18200 has "current sense" and other
features which you can use as feedback mechanism to match the load
and speed -- and it's pretty beefy, if think the ratings are like 55
volts, 3 Amps. It does need to be heatsinked, needs bypass caps
etc., but I assume you would do this anyway. The LMD18201 does not
have "sense" features, but these you can outboard.
I use the LMD18200 in a photoprocessor. Had thought of using 4
HexFets for an H-Bridge, but that's too much work and the $savings
weren't worth the extra real estate.
Of course, the LMD18200 isn't the only H-Bridge chip, it's just what
I happen to have on hand.
http://www.bobblick.com/bob/projects/hbridge/
I also found a very good H-Bridge module that I am using to control two
motors for focus and iris on my camera. Here ...http://www.lynxmotion.com/
Really simple .. you only need 2 10K resistors and it's fully basic stamp
compatible. Certainly for my use however the heat sink will need a bit of
uprateing.
Justin Pentecost