H-bridge using L298
December 14, 2008
Now that I have the rotary encoders working properly, it's time to think about the motor control circuit. I have an Atmel AVR ATmega32 with three PWM outputs, of which I'll use two for motor control. I'm planning a differential drive robot, that is, one with two drive motors, one for the left side and one for the right side. I'll need forward and reverse directional control of both motors, as well as speed control via PWM. I have a couple of L298 H-bridge chips, so they'll do nicely.
I fitted a small finned heatsink, although the chip shouldn't get too hot. I had to spread out the pins in the front row to fit the 0.1-inch pitch Veroboard holes. There are eight protection diodes, four for each motor. The pale brown components are 0.1Ω resistors for current sensing (not used at present). The motors connect to the board via three-pin Molex KK connectors. I'll use the middle pin as a ground wire, to connect the motor cases to ground as a precaution against noise spikes.
The H-bridge has worked well so far, although I did make one construction error: a reversed diode!