« Digital Input to the PIC16F628 in C | Main | Serial LCD Controller »
A bigger basic H-bridge (April 12, 2005)
We just don't do small. So when it came to choosing stepper motors, I picked nice beefy 2lb bipolar beasts. Driving these has, however, turned into a bit of a problem.
[PROOF READ STILL]
The 'run' (always turning, never pausing) current for each motor is a moderate 1.8A/coil, the holding current a slightly less moderate 6.5A/coil, and the locked shaft (can't turn) pull out current a whopping 18A+.
Assuming we can power these beasts (we have 2) off of batteries, stock H-bridge chips just don't seem to come in 18A+ of stall current in prices we can affoard. The solution ofcourse, is to build it oneself.
The basic H-bridge is a pretty simple device. And ours is about as simple as they get aswell. Q{1-4} are genericly N-channel MOSFETs (preferably with a low voltage drop); we used ON Semiconductor's NTP18N06 which will handle 15A or 40V or 48.4W (whichever comes first). Although 15A is not ideal for 18A motors, I know our power supply can't provide 18A, and (though experimentation), even with a power supply capable of 18A, the motors don't stay locked long enough to cause noticable damage to the FETs. (They will later be replaced by beefier more pricey fets anyhow.) Notice that all 4 of our FETs are N-channel; P-channel MOSFETs matched to the N-channels would normally be an easier choice for the high-side (the top) FETs, but p-channel FETS are more pricey, and not readily available in an exact match to the low-side N-channels. There are ways of working around this though, which is discussed in the next paragraph.
We however need 2 of them for each motor and preferably some smarts to save us from "shoot through" (both top and bottom of one side of the H-bridge on at once) and to take work off the main µC. The driver also needs to be able to put up with any noise the motors throw out and drive the high-side N-channel MOSFETs.
The driver consists of a PIC12f508 µC, a logic level power supply, a FET drive power supply, an opto-isolator, and some good-karma pull-up/limiting resistors plus a filter cap.
The logic supply is simply 4 AA batteries in series with a 100µF cap accross them. It's sole purpose is to provide the PIC and the logic-side of the opto-isolators with clean power.
The PIC has 4 logic level outputs toward the opto-isolators to drive both H-bridges required for a single motor and 2 pins dedicated to providing a slave I2C interface for talking to the main µC. The PIC is incharge of both high-level commands from the main µC like 'move 1" forward' and also to low-level technicalities like maintaining slow enough switching time to avoid 'shoot through'.
The quad-optoisolator (an ILQ30 from Vishay) provides complete electrical isolation between the high-current, noisy motors and the rather sensitive PIC while at the same time transforming the PICs +5v logic signals to (roughly) +15v signals to drive the FETs. (See "Biasing a FET" for why we need this.) R{1-4} are 330ohm current limiting resistors required to protect the isolators sensitive emiters from burning out. (Seriously, even a momentary short to +5v will destroy them.) On the other side 5.1KOhm resistors (R{5-8}) are used to pull the outputs to ground.
Take note that ground is not ground is not ground. The ground rail of the motor side is seperate from the logic ground used everywhere else and is symbolised by V-. This is the entire point of the opto-isolator. Even with diodes and filtering caps, the motor does things to the ground line that just aren't nice; with the opto-isolator, we don't need to care.
And thats all there is to it. The PIC outputs the expected patern of highs and lows toward the opto-isolator; the isolator pulls the drive lines to (Motor Supply)+9v to drive MOSFETs; the MOSFETs provide forward and reverse current across the motor coils. Assuming the correct patter of highs and lows is sent out, the motor turns.
FET (3) H-Bridge (1) Kit (11) Optoisolator (1) PCB (6) PIC (8) Transistors (4)
Posted by spiffed at April 12, 2005 8:20 PM