Reversing motors

Jan 12, 2005 32 Replies

thinking

chip,

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:

formatting link

a

Yep, that's an H-bridge; using bipolar transistors.

You need P-channel MOSFETs. The terms NPN and PNP apply to bipolar transistors. MOSFETs are either: N-channel, or P-channel.

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.

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

formatting link



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

Would one of these per motor do?

formatting link

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

Danny

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

formatting link

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

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

formatting link

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.

Thanks Andy. Found this:

formatting link

So do I just need some PNP mosfets the same as the NPN ones I already have? Is it possibly to drive two MOSFETs (the PNP from one side, and NPN from the other) from the same IC pin?

Ta,

Danny

formatting link

I've just been looking on rapid

formatting link
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 :-(

Danny

formatting link

to

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:

formatting link
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.

formatting link

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!)

Danny

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

formatting link
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

switching

neat:

formatting link

protected

think

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):

formatting link
I really don't like the case (pin layout), it's workable.

This thread Newsgroups: sci.electronics.design Subject: Motor Control Circuit Problem Date: 28 Oct 2004 15:48:41 -0700 news: snipped-for-privacy@c13g2000cwb.googlegroups.com may be of interest

Terry Pinnell Hobbyist, West Sussex, UK

formatting link

diode

is

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 || \ |\ +-||--- 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....)

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)?

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

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.

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.

Yes, you must connect the grounds together to establish the common reference level.

"Danny T" wrote

Don't worry, it gets harder. ;-)

pic.

Should

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? ;-)

formatting link

I've

switch

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.

These:

formatting link

(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?

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required