Reversing motors

D

Danny T

Guest
I've got little motors that change direction if you reverse the
polarity. What's the best way to achieve this from a PIC? I was thinking
something like this:


VCC
+
| .------------------------------.
| | |
'--)----------o--------. |
| | | |
| | V Diode |
| | - |
| | '-----. |
| | | | | __
| | _-_ | | -o|P |o-
| |Motor |___| | | -o|I |o-
| | - | '---o|C |o-
| .----)--------' | .---o|__|o-
| | | | | |
| | | - | |
| | | Diode ^ | |
| |D | | D| |
| ||-+ '--------' +-||-
|G ||<- ->|| G
'--||-+ +-||
| S S |
---------------------------'
|
===
GND



GND
(created by AACircuit v1.28.4 beta 13/12/04 www.tech-chat.de)

However I'm not sure about the diodes, and power heading for the chip,
instead of the motor. What's the usual way to do this kind of thing?

Thanks,
--
Danny
 
Andrew Holme wrote:

http://www.armory.com/~rstevew/Public/Motors/H-Bridges/HBridge_NPN-PNP.gif

I recommend this circuit: it'll happily run at lower voltages; you can
drive it directly from PIC outputs; you could substitute different
(suitably beefy) back e.m.f diodes, if you can't get the ones shown.

http://www.rapidelectronics.co.uk/rkmain.asp?PAGEID=20671&CTL_CAT_CODE=30397

You want a "high power silicon NPN transistor" and a "high power
silicon PNP transistor." They have TIP31/32. They are bipolar
transistor.
Excellent. Can't find a 2N2222 on rapid, would the ZTX455 here:

http://www.rapidelectronics.co.uk/rkmain.asp?PAGEID=80010&CTL_CAT_CODE=&STK_PROD_CODE=M34418&XPAGENO=1

be a suitable replacement? Or is there anything else there I should try?
(Most of them don't seem to have the same max current current as the
2N222 (.8A)


Look up "darlington", "bipolar" (etc) in the AoE index.
I've started reading it from Chapter 1, so I'll probably find them soon :)

Other bits I need (for both the motors & ultrasonic) haven't arrived, so
I've got a weekend of no fiddling, so I'll probably read a bit more!!

--
Danny
 
Andrew Holme wrote:

e.g.
http://www.armory.com/~rstevew/Public/Motors/H-Bridges/HBridge_NPN-PNP.gif

I recommend this circuit: it'll happily run at lower voltages; you can
drive it directly from PIC outputs; you could substitute different
(suitably beefy) back e.m.f diodes, if you can't get the ones shown.
When you say suitably beefy, what am I looking for - high current
rating? Voltage? Any particular type (rectifier? zener? schotky?)

(sorry, I'm sure I'll know when I've finished reading, but people here
can probably answer the questions quicker than I'll read the book :))

--
Danny
 
Danny T wrote:
Andrew Holme wrote:
There's an example circuit in the thread Terry P cited.

On this page:

http://www.cs.uiowa.edu/~jones/step/circuits.html

Figure 3.14 shows a couple of diodes, a couple of resistors and
4xBD679 darlington transistors. On Rapid, they're 81-0106, 25p+vat.

I assume X and Y could be connected to my PIC? Outputs are 4-5V from
my pic. Would the digram there work as is for me (it's around 4-5V
motor), or would I need to change anything? (How does is the voltage
to the motor controlled?)
As drawn, and stated beneath, X and Y require open-collector (or open-drain)
outputs. If you omitted the pull-ups, and connected 1k resistors in series
i.e. between X/Y and the bases, you could use standard outputs instead.
 
Danny T wrote:
I've got little motors that change direction if you reverse the
polarity. What's the best way to achieve this from a PIC? I was
thinking something like this:


VCC
+
| .------------------------------.
| | |
'--)----------o--------. |
| | | |
| | V Diode |
| | - |
| | '-----. |
| | | | | __
| | _-_ | | -o|P |o-
| |Motor |___| | | -o|I |o-
| | - | '---o|C |o-
| .----)--------' | .---o|__|o-
| | | | | |
| | | - | |
| | | Diode ^ | |
| |D | | D| |
| ||-+ '--------' +-||-
|G ||<- ->|| G
'--||-+ +-||
| S S |
---------------------------'
|
===
GND



GND
(created by AACircuit v1.28.4 beta 13/12/04 www.tech-chat.de)

However I'm not sure about the diodes, and power heading for the chip,
instead of the motor. What's the usual way to do this kind of thing?

Thanks,
Don't try it out, unless you want to smoke the components. You will need a
H-bridge to reverse current flow with the appropriate drivers. and
aditionally some snubber across the FETs. There are ready made solutions
available in intregrated form like
http://www.national.com/pf/LM/LMD18200.html, the data sheet will give more
details. You can control the motor with a PWM-signal and need only 1 line
from the PIC.
--
ciao Ban
Bordighera, Italy
 
Danny T wrote:
I've got little motors that change direction if you reverse the
polarity. What's the best way to achieve this from a PIC? I was thinking
something like this:

VCC
+
| .------------------------------.
| | |
'--)----------o--------. |
| | | |
| | V Diode |
| | - |
| | '-----. |
| | | | | __
| | _-_ | | -o|P |o-
| |Motor |___| | | -o|I |o-
| | - | '---o|C |o-
| .----)--------' | .---o|__|o-
| | | | | |
| | | - | |
| | | Diode ^ | |
| |D | | D| |
| ||-+ '--------' +-||-
|G ||<- ->|| G
'--||-+ +-||
| S S |
---------------------------'
|
===
GND

GND
(created by AACircuit v1.28.4 beta 13/12/04 www.tech-chat.de)

However I'm not sure about the diodes, and power heading for the chip,
instead of the motor. What's the usual way to do this kind of thing?

Thanks,
--
Danny
Sorry, no. If either mosfet turns on, it forward biases the diode it
is connected to, forming a near short across the supply. You need 4
mosfets (each of those diodes has to be replaced with an active
switch).
--
John Popelish
 
Andrew Holme wrote:

Is it possibly to drive two MOSFETs (the PNP from one side, and
NPN from the other) from the same IC pin?

Only via an inverter: the high-side MOSFETs turn-on when the gate is
low.
Then how about tunning the PNP and NPN from the same side on a single
pin? Would they change properly together, or could there be a period
where the P-channel has closed (on a low) before the N-channel has
opened (on the low)?


The high-side transistors are tricky to drive when the motor runs off a
different voltage to the controller. You might be better off looking
for a monolithic high-side driver like Anthony suggested.
I don't understand :(
I've been thinking about having seperate supplies for my motors and pic.
I'll use diodes while it's plugged into the wall, but when running on
batteries, I'll have a set for the motors, and a set for the pic. Should
I connect the grounds together, or keep everything seperate? (surely I
need to connect them since the MOSFETs drain and gate both need source
to be grounded for their circuits?

Thanks,

--
Danny
 
"Danny T" <danny@nospam.oops> wrote

I don't understand :(
Don't worry, it gets harder. ;-)

I've been thinking about having seperate supplies for my motors and
pic.
I'll use diodes while it's plugged into the wall, but when running on
batteries, I'll have a set for the motors, and a set for the pic.
Should
I connect the grounds together, or keep everything seperate? (surely I
need to connect them since the MOSFETs drain and gate both need source
to be grounded for their circuits?
Yes, you will want to connect the grounds together.

High side switching is kind of a pain (go read a p-channel MOSFET
datasheet and pay close attention the voltage that is needed on the gate
with respect to the source voltage, also look at the horrid RDSon
values), that is why the monolithic power switch devices exist. They
also make it possible to apply the same +5V signal that you are applying
to the low-side MOSFET to switch them on, instead of needing a voltage
inversion.

You can also use N-channel transistors on top, but then you have to come
up with a voltage higher than your motor supply to turn them on fully.
That's because the Vds is really small when the transistor is on, AND
(for the transistor to be fully on) the Vgs has to be at least 4V for a
logic level MOSFET. In order to get the gate at a high enough voltage,
you will have to apply 16V (if your motor supply is 12V) to the gate.
How ya gonna do that? ;-)
 
Danny T wrote:
Andrew Holme wrote:
snip

These:


http://www.rapidelectronics.co.uk/rkmain.asp?PAGEID=80010&CTL_CAT_CODE=&STK_PROD_CODE=M34947&XPAGENO=1

(and others on Rapid) don't say if they're N-channel or P-channel.
I've
checked a few datasheets with no avail too. They're called "power
MOSFETs", but I don't know if that means they're P or not... The item

number (VNP10N06) has both an N and P in! It also says "omnifet", if
that suggests either! :-\

The datasheet (if I'm reading it right) says a min of 3.2V will
switch
it, but it says "Vdd = 16". My supply is only 4-5V - would this be a
problem?
The schematic in the PDF, with the source arrow pointing into the
MOSFET, indicates N-channel.

This device looks a bit OTT for your application.

Where does it say "Vdd=16"? Do you mean "Vdd=15" in the "Test
Conditions" column? That's just the voltage they took the measurement
at. The MOSFET will switch any voltage up to the specified max.
 
Robert Monsen wrote:

Regarding motor reversal, you probably want to use an integrated IC that
is designed for this. One that I use is this one:

http://www.acroname.com/robotics/parts/R6-754410.html

(I probably wouldn't buy it there though. You could probably buy 4 at
arrow for the price of one here).

There are lots of advantages to this chip over the discrete solution you
are considering, including the ability to drive a higher voltage motor,
circuitry to prevent 'shoot through', which must means having the high
and low driver on one side turned on at the same time (which causes
spikes on the supply), etc. It takes 4 PIC pins to run 2 motors (or 6 if
you want to separately control the enables).

You need to buy some 'fast' diodes as well to protect the drivers from
reverse voltages. Look at the datasheet for more info.

The only real liability is the power limit.
That looks less fun. I want to learn as much about electronics as I can,
so the more "diy" I do, the better :)
(it does mean I'll be anal about asking questions in here a lot though!)
--
Danny
 
Danny T wrote:
Andrew Holme wrote:
There's an example circuit in the thread Terry P cited.

On this page:

http://www.cs.uiowa.edu/~jones/step/circuits.html

Figure 3.14 shows a couple of diodes, a couple of resistors and
4xBD679 darlington transistors. On Rapid, they're 81-0106, 25p+vat.

I assume X and Y could be connected to my PIC? Outputs are 4-5V from
my pic. Would the digram there work as is for me (it's around 4-5V
motor), or would I need to change anything? (How does is the voltage
to the motor controlled?)

I'm gonna go start reading The Art of Electronics, but I want to order
the bits I'll need asap, so I can start fiddling! :)

Ta,
hey Danny,
there are many possibilities constructing H-bridges, but they narrow down
with your low voltages. If you have a 4V supply and your motor is drawing 1A
average, or 3A peak, you can best use a relay, maybe of the bistable kind
like Nais TQ2-L2-5V. This would allow the full voltage swing and you could
PWM the motor with an inexpensive NMOS. A bistable relay uses energy only
when changing states and also stays latched on power off. I costs 4bucks
single quantity.
Darlingtons are not applicable as they use at least 1V each, so for your
motor there is only 2V left. :-(
But you can use bipolar transistors, like the FZT788 PNP for the power stage
and a FCX688 for the NPN. Those can be driven by a small (20mA) current from
a PIC or via another buffer transistor. These transistors have around
2X250mV= 0.5V saturation voltage(at 2A), so this would leave 3.5V across the
motor.
With your low voltages I would not recommend FETs, they need higher gate
voltages and do not perform well with 4V.
--
ciao Ban
Bordighera, Italy
 
Ban wrote:

hey Danny,
there are many possibilities constructing H-bridges, but they narrow down
with your low voltages. If you have a 4V supply and your motor is drawing 1A
average, or 3A peak, you can best use a relay, maybe of the bistable kind
like Nais TQ2-L2-5V. This would allow the full voltage swing and you could
PWM the motor with an inexpensive NMOS. A bistable relay uses energy only
when changing states and also stays latched on power off. I costs 4bucks
single quantity.
But then I won't understand the differences between bipolar, darlington,
FETs etc. ;)

Darlingtons are not applicable as they use at least 1V each, so for your
motor there is only 2V left. :-(
My power supply can be increased - though if it means they'd flatten my
batteries quicker, I'm open to other methods!


But you can use bipolar transistors, like the FZT788 PNP for the power stage
and a FCX688 for the NPN. Those can be driven by a small (20mA) current from
a PIC or via another buffer transistor. These transistors have around
2X250mV= 0.5V saturation voltage(at 2A), so this would leave 3.5V across the
motor.
With your low voltages I would not recommend FETs, they need higher gate
voltages and do not perform well with 4V.
The gate voltage is 4-5V (from my PIC) and the N-channels I've got seems
to work great. What's the difference (in basic terms!) between a MOSFET
(& JFET for that matter), bipolar and darlington? I'm sure they're
covered in the book I'm reading (The Art of Electronics), but I want to
order as many of my bits as I can asap, so I can fiddle with things and
try things out! :)

I can't find anything marked as bipolar on Rapid - can you see anything
you think would be good from here:

http://www.rapidelectronics.co.uk/rkmain.asp?PAGEID=20671&CTL_CAT_CODE=30397

?

Thanks,
--
Danny
 
Danny T wrote:
Andrew Holme wrote:

e.g.
http://www.armory.com/~rstevew/Public/Motors/H-Bridges/HBridge_NPN-PNP.gif

I recommend this circuit: it'll happily run at lower voltages; you
can drive it directly from PIC outputs; you could substitute
different (suitably beefy) back e.m.f diodes, if you can't get the
ones shown.

When you say suitably beefy, what am I looking for - high current
rating? Voltage? Any particular type (rectifier? zener? schotky?)

(sorry, I'm sure I'll know when I've finished reading, but people here
can probably answer the questions quicker than I'll read the book :))
Danny, first try to find out the requirement for your motor. Take your
multimeter and measure the resistance of the motor at the terminals, without
spinning it. If the value was 3.3 Ohms i.e. , that would mean your motor
will take a maximum of 5/3.3 = 1.5A, when stalled or switched on. Second
measurement driven with 5V how much would be the average current? Insert
your multimeter into one line in the 20A range. It might be 0.3A. Once you
have found these values you can go on choosing the right driver transistors.
The max. current capability should be above 1.5A.
You might want the ZTX1048A and the ZTX1147A(both available at rapid), which
have a 4A max. rating. Now you should determine the base current needed for
these transistors. you divide the 1.5A by the hfe value for the current in
question and with hfe above 200 you will need only 7.5mA of base drive. You
choose a bit higher like 15mA, to saturate the transistor well. then you can
calculate the base resistor. The circuit of the link above is very good, as
long as you can control those 2 lines from the pic. But you could also
insert an inverter and use only one O/P driven with a PWM-signal, that
allows you a continuous speed control from forward to reverse.
The diodes across the power transistors should be of Schottky type with the
max. current rating above your 1.5A and the average can be smaller like 1A.
SB130 are good.
--
ciao Ban
Bordighera, Italy
 

Welcome to EDABoard.com

Sponsor

Back
Top