Recently I started tinkering with the Arduino microcontroller. I plan to use the controller for a simple robot. Since I have some simple DC motors lying around, I designed a motor control circuit using an L293D H-bridge. The designs I found on the internet usually take two logical output ports from the Arduino, plus one pwm port per motor. As I eventually will want to free my Arduino for other projects, the controller will be replaced by a single chip MCU, most likely an ATtiny. Hence the need to use as few output ports as possible for motor control. With the design I came up with, two DC motors can be controlled using only two digital IO ports and two pwm ports. This means that a single ATtinyX5 could, in principle, control the robot. This would leave one port free for sensor input. Most likely I will end up using an ATtinyX4 which has more IO ports. Anyway I'd like to share my design.
For circuit design I used TinyCAD. I imported the net-file into VeeCAD for board layout.
The way the controller works.
Motor 1 is connected to JM1. This motor is controlled by a pwm signal on pin 1 of J1 plus a logic signal on pin 2. A HIGH signal on pin2 will drive the motor in one direction, and a LOW signal will drive it in the opposite direction. The pwm signal determines the speed of the motor (including full stop). Motor 2 is connected to JM2 and controlled by pins 3 (pwm) and 4 (direction) of J1. Pins 6, 7 and 8 of J1 are Vcc, ground and motor voltage.
I used the 74LS04 chip in such a way that it can be replaced by other inverting gates in the same series. This means that it can be replaced by e.g. a 74LS00 (quad nand gates) if you connect both inputs of each gate so that it works as an inverter.
As I couldn't find a circuit symbol for the H-bridge, I ended up setting up a new library with part in TinyCAD. This library is included with the design files.