
OVERVIEW
The L293D module is a compact motor driver module
with two full bridge circuits and individual enable
inputs. Each channel can continuously drive up to
600mA and can tolerate up to 1.2A non-repetitive load
current. The module accepts 5V up to 20V motor (or
other inductive load) voltage. It also has a built-in 5V
regulator for the logic circuit that accepts up to 12V
input power sourced from either an external power or
from the motor power source. This is selected via an on
board micro jumper. Aside from the obvious benefit,
the internal regulator may be advantageous in
applications without a microcontroller as it readily
makes the module useable with just the input signals
added. Two additional micro jumpers allows each
channel to be permanently enabled or controlled by the
host.
The inputs are accessible from standard 2.54mm pin
headers and outputs are conveniently derived from
screw-in terminal blocks.
The L293D module is part of Layad Circuits’ Kimat series
of rapid-prototyping products.

- Drives up 2 reversible motors
- Continuous Drive Current Per Channel: 600mA
- Peak/Non-repetitive current per channel: 1.2A
- Motor Voltage: 5-20V
- Total Idle Current with both channels disabled:
- ~50mA Selectable regulator input between external or
- motor voltage via jumpers Permanent-enable jumper option
- 3.3V/5V-logic compatible inputs
- Board Dimensions: 49.26 x 32.69 mm
PIN FUNCTIONS
REG IN – this is a 3-pin header labeled “REG IN” with a
microjumper inserted between the middle pin and the
EXT side or between the middle pin and VM side. This
allows the user to select where to source the input to
the regulator circuit for the logic circuits of the board.
This can either come from an external power source
between 5-12V and at least 100mA connected to the
EXT pin header OR it may come from the VM terminal
block so long as VM is between 5 and 12V.



If your motor voltage source is between 5 and 12V and
is able to adequately supply the current requirements
of the motors with some allowance, it is recommended
to set the micro-jumper to the VM position for
simplicity.
5V – The module has an 800mA onboard regulator with
an output of 5V. The internal circuits it supply only draw
around 50 to less than 200mA and may therefore be
used to supply other external 5V circuits. This regulator
output may be accessed from the 5V pin. This comes as
a handy extra power source when the internal 5V
regulator of an Arduino is fully utilized.
EN1 and EN2 – these are the enable inputs of the
drivers. When pulled LOW, the outputs are in high
impedance mode and hence, effectively disconnects the
motors from the outputs. Pulling these HIGH enables
the drivers. These pins may be used to control the
speed of the motors by rapidly turning the pins on and
off as in a PWM signal (or via analogWrite() in
Arduino/Saleng boards). To do this, uninstall the micro
jumpers and then connect the EN1 and EN2 pins to the
PWM signal(s).
IN1-IN4 – IN1-IN4 controls OUT1 to OUT4 respectively
when EN1/EN2 are pulled high (enabled).These pins
may be used by the host microcontroller to turn the
motors on/off and control their direction. Use the table
below as a guide:


PIN FUNCTION SUMMARY

Example Code with Wiring
The following wiring diagram and code may be used in a 2-wheel robot to control 2 DC motors. This example turns the
robot forward, backward, right then left in a loop. It is used as a base code for implementing other applications (e.g. line
follower, sumobot, obstacle-avoidance robot, or RC-robot, etc..) or as a first test code for testing the functionalities of
the L293D module.


Notes:
- Note that in this particular example, the Saleng Uno (or Arduino) shares the same battery with the VM terminal
of the module. Also notice that the module takes the motor power (and logic power) directly from the battery.
This setup greatly simplifies the connection and avoids taxing the microcontroller board’s internal regulator with
additional load. If you need to separate the power sources, ensure that the modules’s GND is wired up to the
Saleng Uno GND. - If in your setup, the motors rotate in the opposite direction (e.g. robot turns backward instead of forward), then
you may simply reverse the motor wirings. For convenience, swap the wires at terminals OUT1 and 2 or at OUT3
and 4.

Example Code/Sketch:
/*
Example Code to move the motor of a 2 (or 4) wheel robot driven by the Kimat L293D Motor Driver Module.
This is meant as a first test code. It moves the robot forward, backward, left and right with certain time intervals.
This software is free provided this notice is not removed and proper attribution
is accorded to Layad Circuits and its Author(s).
Layad Circuits invests resources in producing free software. By purchasing Layad Circuits’
products or utilizing its services, you support the continuing development of free software
for all.
Author(s): C.D.Malecdan for Layad Circuits Electronics Engineering
Revision: 1.0 – 2017/08/17 – initial creation
Layad Circuits Electronics Engineering Supplies and Services
B314 Lopez Bldg., Session Rd. cor. Assumption Rd., Baguio City, Philippines
www.layadcircuits.com
general: info@layadcircuits.com
sales: sales@layadcircuits.com
+63-916-442-8565
- NOTES and WARNINGS:
- Install right motor(s) on OUT1 and OUT2
- Install left motor(s) on OUT3 and OUT4
- REG IN JUMPER
- 5-12V Motor:
- If you are working with a 5-12V motor, then set the REG IN jumer to the VM position.
- This jumper option will take the power for the logic circuit from the Motor Power terminals labeled VM.
- >12-20V Motor
- If you are working on a motor above 12V up to 20V, then you must set the REG IN jumper to the EXT position.
- You will need to connect a 5-12V / >= 100mA power supply for the logic circuit using the EXT and GND pins.
- MOTOR CURRENT:
- The L293D is rated for a maximum of 600mA continous motor current and 1.2A surge current per channel.
- Make sure your motors do not exceed these ratings.
- SPEED CONTROL / EN1 and EN2 JUMPERS
- If you do not plan to control speed and want to operate at full speed, leave the EN1 and EN2 jumpers installed.
- If you want to control speed using PWM, remove the jumpers and connect EN1 and EN2 (beside IN4) to PWM pins of your
- microcontroller. For the Saleng Uno/Arduino Uno, this pins may be used for the EN1/EN2: pins 3,5,6,9,10,11.
- If you are using the Arduino Mega2560, use pins 2-13.
/
//Pin Assignments:
const byte PIN_IN1 = 6;
const byte PIN_IN2 = 7;
const byte PIN_IN3 = 8;
const byte PIN_IN4 = 9;
const byte PIN_EN1 = 3;
const byte PIN_EN2 = 5;
void speedSetting(byte val)
{
analogWrite(PIN_EN1,val);
analogWrite(PIN_EN2,val);
}
void forward()
{
// move right motor(s) forward
digitalWrite(PIN_IN1,LOW);
digitalWrite(PIN_IN2,HIGH);
// move left motor(s) forward
digitalWrite(PIN_IN3,LOW);
digitalWrite(PIN_IN4,HIGH);
}
void backward()
{
// move right motor(s) backward
digitalWrite(PIN_IN1,HIGH);
digitalWrite(PIN_IN2,LOW);
// move right motor(s) backward
digitalWrite(PIN_IN3,HIGH);
digitalWrite(PIN_IN4,LOW);
}
void turnleft()
{
// move right motor(s) forward
digitalWrite(PIN_IN1,LOW);
digitalWrite(PIN_IN2,HIGH);
// move left motor(s) backward
digitalWrite(PIN_IN3,HIGH);
digitalWrite(PIN_IN4,LOW);
}
void turnright()
{
// move right motor(s) backward
digitalWrite(PIN_IN1,HIGH);
digitalWrite(PIN_IN2,LOW);
// move left motor(s) forward
digitalWrite(PIN_IN3,LOW);
digitalWrite(PIN_IN4,HIGH);
}
void motorstop()
{
digitalWrite(PIN_IN1,LOW);
digitalWrite(PIN_IN2,LOW);
digitalWrite(PIN_IN3,LOW);
digitalWrite(PIN_IN4,LOW);
}
void setup() {
pinMode(PIN_IN1,OUTPUT);
pinMode(PIN_IN2,OUTPUT);
pinMode(PIN_IN3,OUTPUT);
pinMode(PIN_IN4,OUTPUT);
pinMode(PIN_EN1,OUTPUT);
pinMode(PIN_EN2,OUTPUT);
motorstop();
delay(2000);
speedSetting(128);
}
void loop() {
forward(); // call this function to move the robot forward
delay(1000);
motorstop();
delay(500);
backward();// call this function to move the robot backward
delay(1000);
motorstop();
delay(500);
turnright(); // call this function to turn the robot right
delay(1000);
motorstop();
delay(500);
turnleft(); // call this function to turn the robot left
delay(1000);
motorstop();
delay(500);
}
OTHER CONSIDERATIONS
Kimat L293D Modul
User Guide
4-Wheeled Robot – If you plan to control a 4-wheeled robot, ensure that the specified continuous motor current
of 600mA and non-repetitive current of 1.2A is met by the motors. While certain motors may all look the same
(as in the case of popular yellow colored DC motors with gearbox), their performance may differ. In a 4-wheeled
setup, the 2 right (or left) motors are in parallel and connected to OUT1&2 (or OUT3&4). Therefore, the total
load per channel would be the sum consumed by the 2 motors. If we consider a 50% safety factor, and if your
motors run at less than or equal to around 150mA, then you may be able to use this module. Otherwise, if the
current is higher, you may need to use the Kimat Motor Shield which has a higher continuous current rating of
1.2A and non-repetitive current of 3A. Find the shield’s user guide here. Note that in the setup described here,
the codes for a 2-wheel and a 4-wheel robot are the same.
Heat Management – when the load has a demanding current requirement, consider adding a heatsink , or
better yet a heatsink+fan combination, on the L293D IC in the module. You may use thermal glue as mounting
method or use the two mounting holes at each side of the IC to help mount the heatsink on top of the IC.
