Welcome to next article in the robotic vehicle series. This is probably most difficult and complex part in the whole vehicle to build. Purpose of the part is to convert battery voltage to desired 5 Volts and 3.3 Volts required by the logic circuits in the vehicle. Most important function of this part is the DC motor driver, which is necessary to drive motor in appropriate directions and speed.
Figure 1. DC motor driver and power supply - top view
L293D DC motor driver
In robotic vehicle the L293D integrated circuit is used as a motor driver. It's a dual H-Bridge with some improvements. L293D is able to driver DC motors with output current of 600 mA for each channel (motor), which is enough for majority of hobby projects. Some people using L293D to drive one stepper motor or contact the relay.
Figure 2. L293D pinout
Pinout at figure 2 shows that L293D consists of four inputs (A), which accepts TTL logic voltage level and four outputs (Y) that gives VCC2 Voltage. That allows L293D to be used as two "reversible" output or four "one-way" outputs. There are two more TTL inputs (EN), which stands for enable. This means that pin 1 (1,2EN) enables outputs 1Y and 2Y. Without pin 1 set to logical 1, the outputs will remain inactive. The enable inputs are usually hooked to +5V to be set still. In "motor driving" applications, enable inputs are called slow stop and it's used for speed control. Switching from logical 1 to logical 0 cause motor to rotate accordingly to the switching interval.
Figure 3. L293D connected to motor and micro-controller
DC motor driver in robotic vehicle is designed as shown on the figure 3. GPIO3 on the Digi Connect ME is connected to enable pin, so it's used for speed control.
Other GPIOs are designated for direction control. I believe that principle is obvious.
When GPIO5 is set to true (logical 1) and GPIO4 is false (logical 0), the motor rotates forward (whatever the direction means). When the GPIO5 is false and GPIO4 is true the motor rotates backward.
In this particular case, all 5 GPIO of Digi Connect ME are used, which might be a bit waste of pins. There is a possibility to connect one direction pin directly to GPIO and second one through inverter or OR gate. This modification will save one pin for each motor.
Designing the PCB
The PCB is a bit more complex but it's still one layer PCB with enough space for soldering. Figure 4 shows the PCB layout and shouldering scheme. Scheme in CAD software DWG format and PDF format are available to download. Print it in 1:1 ratio to get exact size. The best way is to go with DWG True View, which is a free to download DWG file viewer from Autodesk.
Figure 4. PCB and shouldering scheme
There are two voltage regulators in the circuit. One for +3.3V necessary for Digi Connect ME and XBee modules. Second one for +5V necessary for L293D logic.
Maximum power supply of the circuit is 16 Volts, it's important to consider the polarity of the power supply and connect + where it's labeled, otherwise you might destroy the components.
Besides the voltage regulators and L293D, there are molex connectors for motors and battery power supply.
As it's shown on the shouldering scheme, the regulated voltage and ground are wired-out to the pins that will fit into the breadboard. Other pins are connected to L293D input pins. Please consider two jumpers: one under the L293D socket and one close to the C1 capacitor.
- L293D, motor driver (1x)
- LF50CV, 5V voltage regulator (1x)
- LF33CV, 3.3V voltage regulator (1x)
- Heat sinker / TO220 / 25K/W (2x)
- C1, capacitor 0.1 microF (2x)
- C2, electrolytic capacitor 2.2 microF (2x)
- DIL socket 16 pin (1x)
- 2pin molex connectors (3x)
- Pins ladder 1x15 pin / RM = 2.54 mm (1x)
- Piece of wire for "jumper" (2x)
Start me up
Before you start using your new product, it's important to test it properly with voltmeter. Check the circuit before the L293D is plugged into the socket. First check the circuit with the "beeper", if there is no short or cold connections.
When you are sure that wiring and soldering is OK, plug the battery. Now check the appropriate outputs if produce desired voltage (5V and 3.3V). Unplug the battery, put L293D into socket and plug battery back.
Test it again if correct voltage is where it should be. Put the "product" into the bread board and connect EN A and A1 to +3.3V. Connect A2 to ground and measure the voltage on the motor A connector.
You should get voltage value similar to your battery voltage. Repeat test for second motor and "reverse" direction.
If everything is OK, then your circuit is ready for micro-controller and motors.
Figure 5. DC motor driver and power supply - detail