The L293D has 4-half H-bridge drivers, which can be used to drive 2-DC motors bidirectionally. Here we are demonstrating how to drive a single DC motor using Half bridges 1 & 2. The DC motor is connected between OUT1 and OUT2 pins, and the pin IN1 is connected to the Microcontroller PWM output and pin IN2 is connected to a Microcontroller I/O port.
Clockwise rotation: To rotate the motor in clockwise direction the IN2 pin is made LOW and a PWM signal is generated on IN1 pin.
Anti-Clockwise rotation: To rotate the motor in clockwise direction the IN2 pin is made HIGH and a PWM signal is generated on IN1 pin.
Note: The pulse durations for Clockwise and anticlockwise rotations are opposite. i.e., if T is the period of the PWM. FOR 100 RPM in clockwise direction, Ton = 0.3T, & Toff = 0.7T & IN2 = LOW FOR 100 RPM in anticlockwise direction, Ton = 0.7T, & Toff = 0.3T & IN2 = HIGH