Problem: driving the H-bridges

ian – Tue, 2006 – 05 – 16 14:55

I couldn't use the AVR outputs to directly drive the H-bridge; as ample as four PWM channels seemed before, it would only be enough for a single H-bridge. And if separate PWM channels got out of phase or had slightly different timing characteristics, the MOSFETs would be switching out of time and would probably get hot. So I'd need a separate controller of some sort. I drew up a truth table showing the relationship between the microcontroller commands and the inputs of the H-bridge:

Command H-bridge input
PWM Reverse Brake A B C D
P 0 0 P 0 0 P
P 0 1 0 0 P P
P 1 0 0 P P 0
P 1 1 0 0 P P

This simplified down to the following circuit diagram: I considered a few methods for implementing this circuit:

  • Discrete transistor logic. This looked like it would be too complicated to be worthwhile.
  • Chip-level logic. Again, the complexity would kill me. I'd need three devices, minimum, and that was for a single H-bridge channel. I'd need two channels minimum, and I was already considering bumping to four for a 4WD bot.
  • A CPLD or FPGA. A CPLD would be ideal for this application. They're cheap, robust, and perfect for this sort of logic. Unfortunately, I can't get the things easily. I'd already written the 'code' for the CPLD in the course of determining the circuit diagram.
  • A dedicated H-bridge driver chip. I can't get them easily, living in geographically isolated Australia. And they didn't appear to support braking.
  • Another microcontroller. Ah-hah! This would work. I could use a PIC16F84 to implement the logic; it would be fast enough, and I had the gear already. I'd need three inputs and four outputs per channel; (3+4)*2 = 14 I/O lines. The PIC16F84 has... Thirteen. One short. But why not use I2C or another serial bus to control the PIC, and have it generate the PWM separately from the AVR? That frees up the PWM channels on the AVR for whatever else I think up, gives me total control over the characteristics of the PWM signal, and I could chain together as many PIC motor controllers as I desired. I wound up developing an external H-bridge controller. It uses I2C for control, can run two H-bridges with braking, and (again) uses common, cheap parts.


Post new comment

Please solve the math problem above and type in the result. e.g. for 1+1, type 2
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
More information about formatting options