I want to get deeper into the robotics scene, and need some sort of “base” to experiment from. So I bought the AREXX Mr. Basic 4WD robot/car chassis from DealExtreme.com (SKU 45542), and while it still has not arrived, I decided getting busy preparing it a warm welcome.
So, since the robot chassis has two stationary DC motors I wanted to make a TTL level compatible stationary motor driver, so I wouldn’t have to re-invent the wheel(driver) each time a prototype a new idea. This has at least two main advantages
1 – Fewer components on the logic drive circuit, less time prototyping
2 – Lower cost. Motor driver chips are expensive, and one chip per prototype is just unnecessary.
The best choice of chip type for this application is one of the many dual h-bridge driver chips out there. The reasons you should choose an integrated circuit instead of designing your own h-bridge with 8+ FETs is because they need almost no external components and take up less space. This gives you a lower bill of materials, more space left for other circuitry and an even easier design process. And since we’re building this as a module, it doesn’t even restrict the use to your one robot platform, it is really a very handy thing to have at hand!
The most available motor driver chips I have found to be the ones from ST Microelectronics. For applications with motors reaching currents up to 600mA (1.2A 100us peak) ampere, use the L293D. For currents up to 2A (3A 100us peak, 2.5A repetitive(see datasheet)), use the L298, like I did, to play it safe for all future applications.
What I basically did was to follow one of the example schematics in the datasheet and complete it with header pins and terminal block for connections to my microcontrollers, power supplies and motors. See Figure 6 : Bidirectional DC Motor Control on page 6 in the datasheet (current version at this date).
One feature that this chip have, and the L293D has not, is the current sense output pins. Those pins are where the motor current is passed through so they need to be grounded. But since ST have been so nice to regulate the voltage on these output pins to 2 volts, you can add a high power, low value, resistor in series with the output and then easily sense the current drawn by the motors by measuring the voltage drop across the sense resistors. This voltage can then be directly read by a microcontroller ADC to get some great operational feedback. Remember to dimension the resistor value and specifications to match your application. If you’re expecting currents up to 3A you could easily reckon the voltage drop across small hobby motors will be big, so a 5W resistor will do in most cases, and 3A/2V=1,5 Ohms so a 2 Ohm 5 watt resistor is fine to play it safe. For smaller applications with less current drawn you just have to make sure to use a high resolution ADC to sense the smaller voltage drops.
In the video below I have connected one channel to my atmel STK500 at which all the momentary tact switches are pulled high when open, then drawn to ground when closed. Thats why the enable pin doesn’t cut the drive circuit until I press it’s connected button. If you like to see a curios cat, just keep watching. Note that in the pictures and on the video I have no current sensing resistors yet since I had none at hand when soldering the board. They will be added!