Maker Pro
Maker Pro

Reversing motors

D

Danny T

Jan 1, 1970
0
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,
 
A

Andrew Holme

Jan 1, 1970
0
Danny said:
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,

No, that won't work. The power supply would short-circuit through a
diode and a MOSFET. You have to use the H-bridge configuration:
http://www.google.co.uk/search?q=motor+mosfet+"h-bridge"
 
A

Andrew Holme

Jan 1, 1970
0
D

Danny T

Jan 1, 1970
0
D

Danny T

Jan 1, 1970
0
Andrew said:
Yes, you could do it with a relay. You need a back e.m.f. protection diode
across the relay coil and a MOSFET to drive it from the PIC. An
all-semiconductor solution might be more elegant (H-bridge) but a relay is
simpler.

I've just been looking on rapid (www.rapidelec.co.uk) where I got my
N-channel MOSFETs, but they don't seem to have any similar P-Channel
ones. None rated at 1A of the same product, and some of the other
products are 80-100V, and/or don't say if they're NPN or PNP :-(
 
A

Anthony Fremont

Jan 1, 1970
0
Danny T said:
Danny T wrote:
<snip>

Would one of these per motor do?

http://www.rapidelectronics.co.uk/r...&CTL_CAT_CODE=&STK_PROD_CODE=M60258&XPAGENO=1

Any advantages to either way (using these, or doing something similar to
my first post)?

Your first schematic shorts the power supply to ground when you turn on
one of the mosfets.

What you really want is an H-Bridge. You can use one of the available
h-bridge integrated circuits, but you may wish to build your own out of
discrete components.

You can use the mosfets you've already obtained for the low side
switching, but you will need something different for the high side
switch. You could use some standard p-channel mosfets, but switching
them on can be a pain. I really like these things, they are quite neat:
http://www.rapidelectronics.co.uk/r...CAT_CODE=30412&STK_PROD_CODE=M34955&XPAGENO=1
They are often called smart power switches because they contain more
than just a p-channel mosfet, they are usually short-circuit protected
and have the ability to tell you if the circuit is open. They also
contain all the necessary circuitry to take a logic level input and
apply the appropriate gate drive to the internal transistor. I think
they were primarily developed for the automotive industry, but would
work well in your application.
 
D

Danny T

Jan 1, 1970
0
Anthony said:
You can use the mosfets you've already obtained for the low side
switching, but you will need something different for the high side
switch. You could use some standard p-channel mosfets, but switching
them on can be a pain. I really like these things, they are quite neat:
http://www.rapidelectronics.co.uk/r...CAT_CODE=30412&STK_PROD_CODE=M34955&XPAGENO=1
They are often called smart power switches because they contain more
than just a p-channel mosfet, they are usually short-circuit protected
and have the ability to tell you if the circuit is open. They also
contain all the necessary circuitry to take a logic level input and
apply the appropriate gate drive to the internal transistor. I think
they were primarily developed for the automotive industry, but would
work well in your application.

That all sounds fantastic, but while I'm testing and potentially
destroying things, they're probably a bit OTT (and expensive),
especially in comparison to the low-side ones I've got! (about 50p each!)
 
B

Ban

Jan 1, 1970
0
Danny said:
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.
 
A

Andrew Holme

Jan 1, 1970
0
Danny said:

Yep, that's an H-bridge; using bipolar transistors.
So do I just need some PNP mosfets the same as the NPN ones I already

You need P-channel MOSFETs. The terms NPN and PNP apply to bipolar
transistors. MOSFETs are either: N-channel, or P-channel.
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.

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.
 
A

Anthony Fremont

Jan 1, 1970
0
Danny T said:
That all sounds fantastic, but while I'm testing and potentially
destroying things, they're probably a bit OTT (and expensive),
especially in comparison to the low-side ones I've got! (about 50p
each!)

Well, like I said, the nice thing about the smart switches is that they
are often short circuit and reverse polarity protected. I paid US $1.60
ea for some 9A 36V (VN820) switches. Keep in mind that most things
designed for automotive use are usually pretty durable. This is what I
have, in the pentawatt case (5-pin TO-220):
http://www.st.com/stonline/books/pdf/docs/7370.pdf
I really don't like the case (pin layout), it's workable.
 
T

Terry Pinnell

Jan 1, 1970
0
Danny T said:
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:
This thread
Newsgroups: sci.electronics.design
Subject: Motor Control Circuit Problem
Date: 28 Oct 2004 15:48:41 -0700
may be of interest
 
J

John Popelish

Jan 1, 1970
0
Danny said:
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,

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).
 
P

peterken

Jan 1, 1970
0
Danny T said:
I've just been looking on rapid (www.rapidelec.co.uk) where I got my
N-channel MOSFETs, but they don't seem to have any similar P-Channel
ones. None rated at 1A of the same product, and some of the other
products are 80-100V, and/or don't say if they're NPN or PNP :-(

There IS another way, but it needs building a half-supply-voltage-regulator
(if it isn't available yet as a middle connection of a transformer)

something like this....

Vcc
O--+----+------------+-
\ | |
R/ |c s|
\ |/ +-||
+---| npn <-||
| |\e d+-||--- hi drive
| | |===| |
| +----| M |---+
| |e |===| |
| |/ d+-||
+---| pnp ->||
\ |\ +-||--- low drive
R/ |c s|
\ | |
O--+----+------------+---
GND

note the "half-supply" on the left, might be the middle-connection of the
supply transformer
(and yes, I disregarded snubber-diodes, I know, but it's the principle....)
 
D

Danny T

Jan 1, 1970
0
Andrew said:
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,
 
A

Andrew Holme

Jan 1, 1970
0
Danny said:
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)?

Yes, you can do that.
Yes, the logic transition needs to be fairly fast; but that shouldn't be a
problem.

There's an example circuit in the thread Terry P cited.
I don't understand :(

For the lower (N) transistors, the PIC has no problem producing the OFF
voltage (zero).
For the upper (P) transistors, the OFF voltage = motor power supply.
Some sort of level conversion stage may be required in-between.
If you ran the motor from 3V, a P-channel logic-level drive MOSFET would
need 3-5 = -2V to turn-on. You would be better of making the H-bridge with
bipolar transistors for 3V motors.
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 must connect the grounds together to establish the common reference
level.
 
R

Robert Monsen

Jan 1, 1970
0
Danny T wrote:
<snip quest for a reversable motor>

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.

--
Regards,
Robert Monsen

"Your Highness, I have no need of this hypothesis."
- Pierre Laplace (1749-1827), to Napoleon,
on why his works on celestial mechanics make no mention of God.
 
A

Anthony Fremont

Jan 1, 1970
0
Danny T said:
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? ;-)
 
D

Danny T

Jan 1, 1970
0
Andrew Holme wrote:
<snip>

These:

http://www.rapidelectronics.co.uk/r...&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?
 
A

Andrew Holme

Jan 1, 1970
0
Danny said:
Andrew Holme wrote:
<snip>

These:

http://www.rapidelectronics.co.uk/r...&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.
 
Top