Making a quick H-bridge is easy. The complexity comes from making it fool-proof and most of all, efficient.
Check out the attached hbridge_fets.jpeg. You need four switches of some description -- here N-channel mosfets -- to generate AC current from DC, and they ALL must be capable of the rated current. Use PWM on the control wires to vary speed. Keep in mind using exactly what I show here will result in a few problems:
There is no flyback protection in this designWhen you switch off power to an inductor (like a motor) it will try and keep the current moving In effect, it will ramp up the voltage across itself. If it goes high enough it will fry your FETs. Your mileage will vary depending on your motor, choice of FETs, etc etc
If you signal power to both forward and backward pairs, you effectively short power to groundIndeed! Make sure your micro does not try and power the motors both backward AND forward at the same time
Mosfets do not achieve their lowest resistance unless driven on the gate by a high voltageThis leads to greater power wastage through heat.
For most FETs, to reach the datasheet's stated ON-resistance they need to be driven by about 12V or more. Check your datasheet. My second picture shows a solution to this problem: use another couple of FETs to level shift your micro's low voltage output to driving 12V signals.
Unless your FETs are designed for switching, PWMing them will waste a lot of power"Gate transition" from on to off requires power, but you will probably just have to live with this. Same problem as above, especially since (most?) micros output PWM at very high frequencies.
I have successfully driven motors in the past using a circuit identical to what is shown in the first diagram. It was inefficient, and the FETs desoldered themselves within a minute. They were however cheap, not designed for fast switching, in tiny SMD SOT packages and not heatsunk in any way beyond the copper tracks they lay on.
BJT transistors are available for this level of current draw -- and for a long time were better in switching duties than available FETs. In low voltage applications like this however their voltage drop tends to waste more power than a FET's resistance does.
If you were to make a BJT H-bridge, remember a few things:
- You will lose voltage going through two BJTs ala two diodes
- You must calculate resistor values for powering the BJTs
My thoughts were to use two NPNs and two PNPs so that the control current completely avoids the motor (a varying load). That way the resistor values would be easier to calculate -- remember that you can practically sink an infinite amount of current into the base of a BJT if the right end of it is grounded/powered, turning it into vapour within an oh-no-second or two. You will need to measure the BJT's beta (gain), so a cheap multimeter will be useful.
On second thoughts, perhaps using two NPNs and PNPs to intentionally force current through the motor would allow you to omit the resistors
could work. You would have to think more about this -- I have to go to bed right now, sorry. I recommend N channel MOSFETS anyway