robotics
I2C-based H-bridge controller with PWM
During development of my Sumo robot, I ran into some problems around controlling the H-bridges:
- If you're going to use PWM, the PWM signals on each input of the H-bridge need to be synchronised (phase-coherent), and there's no such guarantee when using an AVR to drive them. If they're not phase-coherent, the H-bridge will get hot and not drive the motor properly.
- I wanted to use braking on the H-bridge, which means I need independent control of all four H-bridge inputs. The ATMega32 that I was using has four PWM channels - more than most microcontrollers - but still only enough to run a single H-bridge.
Building a Sumo robot (summary)
Robot Sumo is a competition based on the idea of robots shoving each other out of a ring. It's (nominally) non-destructive, unlike BattleBots and the like. The robots are autonomous, so there's a much greater emphasis on sensors and on-board intelligence.
I'm documenting my Sumo robot build as I go. This is my first robot. I am nominally trained as a software engineer, but I've done a lot of personal study on the electrical side of things as well. My mechanical skills are pretty poor. So I'll be constructing the electronics from scratch and going for a lot of prefab mechanicals where possible.
Controller hardware
The controller is based around a PIC16F84A. It has 13 I/O's, a timer, and not a lot else. To program it I'm using JDM programmer hardware, ICProg software, and the excellent Microchip MPLAB suite to compile and simulate the software.
The controller board, attached to the main control board: Note the I2C cable running between them, which provides the main control board with power.
Problem: driving the H-bridges
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.
Building the robot's motor drivers
The two designs that looked best for my situation were:
- Bob Blick's Darlington-based H-bridge. I really liked the risk-free braking behaviour of this design. I'm confident enough in my coding abilities, but I'd feel much more comfortable with a design that made it difficult to destroy hardware with software. Darlingtons have the advantage of being cheap and less likely to spontaneously combust than MOSFETs - but they'll get hot and waste a fair bit of power. Since I'm aiming to run off as low a voltage as possible, this was an issue. So I went with:
- Eugene Blanchard's MOSFET-based H-bridge. It's about the same complexity, but is a riskier and more expensive design due to the MOSFETs. It would be able to drive much more powerful motors, and heat would be less of an issue. It doesn't have the idiotproof braking behaviour, so I'd have to code carefully.
Again, I assembled the circuit on Veroboard. I really don't like Veroboard for high-power designs like this one, but empirically, I've never had a problem. My main concern was in the braking design, which routes the motor current through the ground tracks. The current is burnt off as heat somewhere, like in the tracks or MOSFETs, neither of which was particularly appealing to me. I hoped that this wouldn't be an issue in operation, where worst-case, I could be braking while getting pushed hard by another robot.
Building a Sumo robot (in progress)
Robot Sumo is a competition based on the idea of robots shoving each other out of a ring. It's (nominally) non-destructive, unlike BattleBots and the like. The robots are autonomous, so there's a much greater emphasis on sensors and on-board intelligence.
I'm documenting my Sumo robot build as I go. This is my first robot. I am nominally trained as a software engineer, but I've done a lot of personal study on the electrical side of things as well. My mechanical skills are pretty poor. So I'll be constructing the electronics from scratch and going for a lot of prefab mechanicals where possible.

