HobbyKing.com New Products Flash Sale
Reply
Thread Tools
Old Feb 04, 2013, 01:09 PM
Dave the Rave
dmccormick001's Avatar
Joined Jun 2007
876 Posts
Discussion
Help with wiring an H-bridge

Hey Guys! I need some help understanding the wiring of an H-bridge. I'm trying to build a controller for a friend that will operate a set of mechanical retracts that use brushed DC motors mounted inside the retract itself, no servos involved. I'm planning to use a PIC16F684 for the "brains", and I want to power the PIC from the RX battery (5vDC), but use a separate battery for the gear, since they're pretty large and are designed to operate on 6-7.5vDC.

I understand that I'll need an H-bridge to control the motor in both directions, but I've never used one before, so I'm not sure about how to connect the battery that drives the DC motors. I have some good HEXFETs that I think will handle the current, and was going to wire them up in accordance with Microchip's recommendation in their "DC Motor Control Tips and Tricks". I've attached a copy of the circuit diagram they provide. I've used a single FET switched by a PIC to drive a higher-voltage device, like 12V LED strip lights, I just tied the + supplies together and the FET switched the - side. But with the arrangement shown in the drawing, it looks like I would have to tie BOTH the + and - together, since there are 2 NPN and 2 PNP transistors in the bridge, and I know that's not right. How can I use an H-bridge, driven (logic that is) by a PIC running on 5 volts, to drive DC motors that run on 7.2 volts? Thanks in advance for your help.
dmccormick001 is offline Find More Posts by dmccormick001
Reply With Quote
Sign up now
to remove ads between posts
Old Feb 04, 2013, 01:19 PM
AndyKunz's Avatar
Illinois
Joined Sep 2001
25,243 Posts
A couple tricks. You can boost voltage and use a FET driver to provide proper gate voltage on 4 N-FETs. More easily, especially for a one-off and low current and these low voltages, is to use P-FETs on the top side (A and D) and N-FETs on the bottom (B and C).

You use a pull-up on the high side gates and drive it low to turn it on. That can be accomplished easily in a PIC by turning the pin between and output at state 0 and an input (using TRIS instead of LAT port).

Or a transistor can handle the level shift for you, allowing it to float high or be pulled low depending on how you drive (always use LAT).

Andy
AndyKunz is online now Find More Posts by AndyKunz
Site Sponsor
Reply With Quote
Old Feb 04, 2013, 03:38 PM
Dave the Rave
dmccormick001's Avatar
Joined Jun 2007
876 Posts
Quote:
Originally Posted by AndyKunz View Post
A couple tricks. You can boost voltage and use a FET driver to provide proper gate voltage on 4 N-FETs. More easily, especially for a one-off and low current and these low voltages, is to use P-FETs on the top side (A and D) and N-FETs on the bottom (B and C).
That's what I'm planning to do, I couldn't find a ready-made H-bridge that had a current rating high enough to do the job.

Quote:
You use a pull-up on the high side gates and drive it low to turn it on. That can be accomplished easily in a PIC by turning the pin between and output at state 0 and an input (using TRIS instead of LAT port).

Or a transistor can handle the level shift for you, allowing it to float high or be pulled low depending on how you drive (always use LAT).

Andy
I don't think I understand any of this. How can you turn a transisitor on by driving the gate low? I think you're telling me to put a resistor (10K?) between the gate and V+ on the P-channel FETs? I think I understand how to change a pin from output to input (using the TRIS register), but don't understand the part about TRIS vs LAT port.

One question might clear all this up for me, for now at least. Will the circuit above work as drawn, using logic-level FETs, 2 P-channel and 2 N-channel, if the grounds of the 5 volt supply to the PIC and the 7.2 volt supply to the motor are common, and the V+ of both batteries are kept separate? I can handle programming the PIC to drive A and C high while B and D are low, or vice-versa, to control the motor. I just need to know how to wire the H-bridge to the rest of the circuit. Thanks!
dmccormick001 is offline Find More Posts by dmccormick001
Reply With Quote
Old Feb 04, 2013, 04:43 PM
Registered User
Aberdeen, Scotland, UK
Joined Dec 2007
607 Posts
Hi,

Two practicle applications of mine which might help. Both use two N-types and two P-types. The first one has a wee logic chart that shows you the required voltages on the GATE's of all FET's two achieve forward, reverse and stop.

http://www.ianjohnston.com/images/st.../schematic.jpg

http://www.ianjohnston.com/images/st...ge/PCB/Mcb.pdf
IanJ is offline Find More Posts by IanJ
Reply With Quote
Old Feb 04, 2013, 05:13 PM
Who let the dogs out?
phil_g's Avatar
Pontefract, Yorkshire, UK
Joined Jul 2007
1,126 Posts
Hi Dave
I use a 4428YN 8pin DIP bridge for my Adams magnetic actuator driver, its a very easy to use bridge, just pwm and neg common to the source, then pos can either be a separate supply or commoned to the rx/servos supply.
I chose the YN version so one pic pin can drive either side alternately (one gate is inverted internally) but theres a choice of drive modes.
I mount an 8pin pic and the 4428YN in a common 16pin DIP socket and wire it up under the socket. If you use stamped rather than turned-pin sockets you can bend the pins under and wire it very neatly.
The pic pin drives it directly, with no interfacing components. I generally squeeze an SMT 100uF tant between the pic pos & neg pins.
I attached the datasheet and the build doc, you can see the pic and the power connections, thought it might be of interest.
Cheers
Phil www.singlechannel.co.uk
phil_g is online now Find More Posts by phil_g
Reply With Quote
Old Feb 04, 2013, 07:43 PM
Registered User
New Zealand, Wellington, Porirua
Joined Jan 2013
96 Posts
I believe what Andy is trying to describe is to use P channel fet's on the high side with a resistor tying the gate high as well, which would turn the FET off. The collector of a small npn transistor is also tied to the gate with its emitter going to ground. Connect a resistor between the base of the transistor and the micro to limit the base current. When you apply power to the base the transistor will pull the fet gate low, turning it on.

You can directly drive the low-side N channel fet's via a small resistor, providing they are "logic level" FET's - ie: they can be full driven with the low voltage your micro will be running on. Some FET's require 10V to fully turn them on.

An alternative to FET's is to use plain old PNP and NPN transistors in your H bridge.

You can also look for a FET driver to handle high side N channel FET's.

There's also H bridge chips out there too like the L293, which has two H bridges that handle up to 36V/1A and have logic level inputs.
viperidae is offline Find More Posts by viperidae
Reply With Quote
Old Feb 04, 2013, 09:00 PM
Registered User
Joined Oct 2012
224 Posts
it is here

fantasy1988 is offline Find More Posts by fantasy1988
Reply With Quote
Old Feb 05, 2013, 09:43 AM
Dave the Rave
dmccormick001's Avatar
Joined Jun 2007
876 Posts
OK, I think I'm beginning to get it, but I have a stupid question to ask. Until now I've only used NPN transistors with my PIC projects, I drive the base (or gate) with high logic from the PIC, and it conducts and allows the Vss (-) to flow to the device I'm switching. I've been thinking that the difference in a PNP is just that it conducts the other way, by switching the Vdd (+) to the device, but from what you guys are saying, to make a PNP transistor turn on I use a pull-up resistor tied to the base and then drive the base with low logic from the PIC? Is that how it works?

Sorry for the dumb questions, but I don't have any formal training in electronics, all I know is what I've been able to learn by trial-and-mostly-error, and by reading and tinkering and asking questions. I can handle the logic of programming the PIC just fine, even though I haven't been trained in any of that, either. But when it comes to circuit design and theory, I'm really weak. I know a lot of stuff that works, but sometimes don't really understand why until somebody explains it.
dmccormick001 is offline Find More Posts by dmccormick001
Reply With Quote
Old Feb 05, 2013, 02:16 PM
Registered User
New Zealand, Wellington, Porirua
Joined Jan 2013
96 Posts
The way I described it was just one way. The pull up turns it off, it needs to be there because your motor is being driven by a higher voltage than your PIC.

A PNP transistor turns on when its base is ~0.6V below its emitter.
It's the opposite from an NPN that turns on when its base is ~0.6V above its emitter.

I really recommend going to your library and having a read of this book: http://en.wikipedia.org/wiki/The_Art_of_Electronics
viperidae is offline Find More Posts by viperidae
Reply With Quote
Old Feb 06, 2013, 12:15 AM
We want... Information!
Bruce Abbott's Avatar
Hastings, New Zealand
Joined Jan 2001
5,193 Posts
Quote:
Originally Posted by dmccormick001 View Post
I've been thinking that the difference in a PNP is just that it conducts the other way,
Yes. PNP is exactly the opposite of NPN, ie. it's the same except that all the voltages and currents are negative rather than positive. So a PNP transistor will have its emitter connected to V+, and is turned on by pulling current out of the base (towards ground). The base will be ~0.6V below V+ when the transistor is turned on, and equal to V+ when it is turned off.

If you were powering the motor from the MCU's supply voltage (Vdd) then you could switch the PNP transistor directly from the MCU (via a suitable current-limiting resistor), but as you are using a higher voltage that won't work because the MCU's output can't go above its (lower) supply voltage, so the transistor cannot switch off. You need a 'level convertor' to get the control voltage to go above Vdd up to V+.

In a bridge circuit you need to turn on one NPN and one PNP output transistor at the same time. This can be done by connecting a resistor from the base of the PNP to the base of the NPN. Current then flows from V+ through the PNP emitter-base junction, through the resistor, through the NPN base-emitter junction and finally to ground. To switch this circuit on and off you can insert another NPN 'driver' transistor between the resistor and the NPN output transistor's base, then control this driver transistor from the MCU. With two driver transistors you can make the motor go forwards, backwards, or stop, using just two MCU outputs.

The main advantage of FETs over bipolar transistors is that they don't need continuous drive current to be turned on. However bipolar transistors may be more robust, and base current isn't much of an issue at low currents (<2A). The circuit below is able to deliver at least 0.5A, which should be plenty enough for a highly geared retract drive.
Bruce Abbott is offline Find More Posts by Bruce Abbott
Reply With Quote
Old Feb 06, 2013, 03:36 AM
Registered User
Scottish Borders
Joined Mar 2006
582 Posts
Phil_g,

Post # 5, Nice one.

Unable to find one off MIC4428 but bought it as TC4428 from ebay Thailand for 2.81.
Hope to use it for single channel Manual Pulse in a Mini Concord later this year, if the sun shines.

Dave
orraman is offline Find More Posts by orraman
Reply With Quote
Old Feb 06, 2013, 04:07 AM
Who let the dogs out?
phil_g's Avatar
Pontefract, Yorkshire, UK
Joined Jul 2007
1,126 Posts
Quote:
Originally Posted by orraman View Post
Unable to find one off MIC4428
Hi Dave, I use Farnell for those.
[LINK]
Quite hard to find, took me a while. Bear in mind the different suffixes mean different configuration, YN has an inverted driver on one side of the bridge, which means you can common both sides & drive the bridge from one pic pin.
Cheers
Phil
phil_g is online now Find More Posts by phil_g
Reply With Quote
Old Feb 06, 2013, 09:33 AM
Registered User
Scottish Borders
Joined Mar 2006
582 Posts
Dave001,
I am obviously much taken up with Phill's driver and think it would suit your purpose just fine.

Phill,
Thanks for the link but it's a long time since I had accounts with Farnell and RS and postage to individuals is high for small orders.
The one I bought has inverting and noninverting, the 2.81 includes postage.

More thanks for the DIY magnetic actuator for Manual Pulse on your website but I am still looking for a Mighty Midget motor for MP, any suggestions for a modern equivalent?

Dave

http://www.ebay.com/itm/TC4428-TC442.../170884923631?
orraman is offline Find More Posts by orraman
Reply With Quote
Old Feb 07, 2013, 09:42 AM
Dave the Rave
dmccormick001's Avatar
Joined Jun 2007
876 Posts
Thanks guys, it's beginning to take shape in my head.

Bruce, I already have some NPN and PNP MOSFETs, the NPNs are IRLB8748PBFs, the PNPs are NDP6020Ps. I've used the NPNs a lot for general switching, I can drive them directly from the PIC with a 150 ohm buffer between the PIC and gate. Can I substitute them in this circuit without major problems? One of the motors I'm powering draws almost 3 amps for part of it's range (the tire is a 5.5 Dubro ), I'm not sure exactly what it draws as the mechanism gets to the end and the motor starts to stall, but I figure I need some extra headroom on the current ratings of my transistors to keep them from buring out. Would you please look at the datasheets on the transistors above and tell me if they look OK? I'm a little concerned, especially about the PNPs, because, even though the datasheet says they are suitable for DC motors, etc., the internal diode looks to me like it's turned the wrong way, at least compared to some circuit drawings I've seen. Also, do I still need the pull-up resistors with these MOSFETs, same values, etc.? I'm planning to use PN2222As to drive the NPN MOSFETs, since they don't handle any of the motor's current, that will work OK, right?

Thanks again for all the help. I'm sure I'll have more questions as this thing takes shape...
dmccormick001 is offline Find More Posts by dmccormick001
Reply With Quote
Old Feb 07, 2013, 03:33 PM
Registered User
New Zealand, Wellington, Porirua
Joined Jan 2013
96 Posts
Both of those MOSFET's should be suitable. The P Channel can handle 24A with a 4.5V gate voltage and the N Channel can do even more.
viperidae is offline Find More Posts by viperidae
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion Wiring/soldering help with 900mhx system pete914 FPV Talk 11 Jan 20, 2013 04:20 PM
Discussion dual h-bridge breakout board rocky79 DIY Electronics 0 Jan 19, 2013 01:50 PM
Help! need some electronic wiring help abletowinginc DIY Electronics 0 Jan 14, 2013 08:12 AM
Discussion Quad Wiring Diagram (Terminal Bridge) spackletoe Multirotor Talk 5 Nov 15, 2011 02:50 PM
Question H-Bridge circuit to dual polarity convertion help Angry_Monk Scratchbuilt Indoor and Micro Models 6 Aug 09, 2005 11:15 PM