L293D IC
Pin Connections
L293D Can be used to control two DC motors. INPUT 1, INPUT 2, and ENABLE 1 (Ven1) controll the first motor which is connected to OUTPUT 1 and OUTPUT 2. Vs should be connected to the Power Supply for DC Motor which is higher than Vss and lower than 36 Volt. Vss should be connected to the Power Supply for the IC which is higher than 4.5 Volt. It's good to differ the power supply Vss from Vs. Ven must be higher than 2.3 Volt to enable the DC motor. It can be given by different Power to change the speed of motor.
Logic
Ven1 high & Pin 4 high & Pin 5 high = Stop
Ven1 high & Pin 4 low & Pin 5 low = Stop
Ven1 high & Pin 4 high & Pin 5 low = clockwise
Ven1 high & Pin 4 low & Pin 5 high = anti-clockwise
Ven1 low = Stop (not applicated)
PWM at Ven can be used to control the speed of Motor.
======Arduino Code Sample======
int switchPin = 2; // switch input
int motor1Pin1 = 3; // pin 2 on L293D
int motor1Pin2 = 4; // pin 7 on L293D
int enablePin = 9; // pin 1 on L293D
void setup() {
pinMode(switchPin, INPUT);
pinMode(motor1Pin1, OUTPUT);
pinMode(motor1Pin2, OUTPUT);
pinMode(enablePin, OUTPUT);
}
void loop() {
// if the switch is high, motor will turn on one direction:
if (digitalRead(switchPin) == HIGH) {
analogWrite(enablePin, 255); // analog output for different speed
digitalWrite(motor1Pin1, LOW); // set pin 2 on L293D low
digitalWrite(motor1Pin2, HIGH); // set pin 7 on L293D high
}
// if the switch is low, motor will turn in the opposite direction:
else {
analogWrite(enablePin, 150); // analog output for different speed
digitalWrite(motor1Pin1, HIGH); // set pin 2 on L293D high
digitalWrite(motor1Pin2, LOW); // set pin 7 on L293D low
}
}
==========================
Reference:
Controal a DC motor with Arduino and L293D IC
http://luckylarry.co.uk/arduino-projects/control-a-dc-motor-with-arduino-and-l293d-chip/
http://www.robofun.net/forum/viewthread.php?tid=6189
http://www.freewebs.com/isuru-c/motor_driver.htm
L293D IC by Conrad.de
http://www.conrad.de/ce/de/product/174003/?insert_kz=NA&hk=SEM&WT.srch=1&gclid=CJjz_7WA0asCFcK9zAod_molXA
http://www.conrad.de/ce/de/product/156134/IC-4-KANAL-TREIBER-L293D-STM/SHOP_AREA_17311&promotionareaSearchDetail=005