Electronics

IC Motor H-Bridge Driver 2Ch 0.6A 25V L293D

AED 7.75

1

Description

The L293D IC is a versatile integrated circuit that functions as an h-bridge circuit with two channels. It has two half-h-bridge circuits within it, which enables it to drive a variety of motors including unipolar, bipolar stepper motors, DC motors, and servo motors. The two channels can be used independently to drive solenoids or relays.

Package Includes:

  • 1 x L293D Motor Driver IC

Features:

  • H-bridge circuit with two channels
  • Capable of driving unipolar, bipolar stepper motors, DC motors, and servo motors
  • Two half h-bridge circuits within it
  • Can be used to output a PWM signal for motor speed control
  • Each channel can be used independently to drive solenoids or relays
  • Capable of driving two DC motors simultaneously
  • Can drive DC motors in either a forward or backward direction (clockwise or anti-clockwise)
  • Can handle a maximum voltage of 36V and a maximum current of 0.6A per channel (1.2A peak)
  • Thermal shutdown protection
  • Low saturation voltage drop
  • Standard DIP-16 package for easy use in circuits.

Description:

The L293D IC is a highly versatile integrated circuit that functions as an h-bridge circuit with two channels. It consists of two half-h-bridge circuits, which allows it to drive various types of motors such as unipolar, bipolar stepper motors, DC motors, and servo motors. With the L293D, the two channels can be used independently to drive solenoids or relays. Furthermore, by using a single channel of the L293D IC, a DC motor can be driven in either a forward (clockwise) or backward (anti-clockwise) direction, and two DC motors can be controlled simultaneously. The L293D IC also has the capability to output a PWM (pulse width modulation) signal, which is useful in controlling motor speed. This feature makes it a popular choice for robotics, automation, and motor control applications. Overall, the L293D IC is a crucial component in many electronic projects that involve motor control.

Principle of Work:

The L293D IC is essentially an H-bridge circuit with two channels. It is designed to provide bidirectional control of DC motors or stepper motors. The H-bridge circuit is made up of four MOSFET transistors, two of which are connected to form one half-bridge circuit. Each half-bridge circuit can drive a motor in either direction by changing the polarity of the voltage applied to the motor terminals. By using both half-bridge circuits together, the L293D IC can control the direction and speed of a DC motor. The L293D IC also features built-in diodes that protect the circuit from the back EMF generated by the motor when it is turned off. Additionally, it can output a PWM (pulse width modulation) signal, which is useful in controlling the speed of DC motors.

Pinout:

 

  • VCC1 (Pin 16): Positive supply voltage for the motor driver (4.5V to 36V)
  • VCC2 (Pin 8): Positive logic supply voltage for the control input (5V to 7V)
  • Ground (Pins 4, 5, 12, 13): Ground pin for the IC
  • Enable 1 (Pin 1): Enables the first half of the motor driver
  • Input 1 (Pin 2): Input pin for controlling the direction of current flow for the first half of the motor driver
  • Input 2 (Pin 7): Input pin for controlling the direction of current flow for the first half of the motor driver
  • Output 1 (Pin 3): Output pin for the first half of the motor driver
  • Output 2 (Pin 6): Output pin for the first half of the motor driver
  • Enable 2 (Pin 9): Enables the second half of the motor driver
  • Input 3 (Pin 10): Input pin for controlling the direction of current flow for the second half of the motor driver
  • Input 4 (Pin 15): Input pin for controlling the direction of current flow for the second half of the motor driver
  • Output 3 (Pin 11): Output pin for the second half of the motor driver
  • Output 4 (Pin 14): Output pin for the second half of the motor driver

Applications: 

  • Robotics: The L293D is commonly used in robotics projects to control the movement of DC motors and servos.
  • Automation: It is used in industrial automation applications, such as conveyor belts, assembly lines, and other processes that require precise motor control.
  • Motor control: The L293D is an effective solution for controlling motor speed, torque, and direction, making it a popular choice for use in motor control systems.
  • Automotive applications: The IC is used in automotive applications for controlling window motors, windshield wipers, and other components.
  • Home automation: It can be used in home automation projects to control the movement of window blinds, curtains, and other devices.
  • Educational projects: The L293D is often used in educational projects to teach students about motor control and robotics.

Circuit:

Connect the Arduino board to the IC. Use the circuit diagram below :

  • The red wire from the battery indicates positive polarity.
  • The black wire from the battery indicates negative polarity.
  • The red wire going to the motor represents the polarity to turn the motor in the clockwise direction.
  • The black wire going to the motor represents the polarity to turn the motor in the clockwise direction.
  • To spin the motor in the clockwise direction, current must flow from the red wire to the motor and out of the black wire.
  • The green and yellow wires are the direction control wires.
  • The brown wire is for speed control.

Library:

No need for any library here.

Code:  

#define IN1 7
#define IN2 8
#define EN 9
 
void setup() {
    pinMode(IN1, OUTPUT);
    pinMode(IN2, OUTPUT);
    pinMode(EN, OUTPUT);
}
 
void setspeed(int val) {
    analogWrite(EN, val);
}
 
void setdir(bool dir) {
    digitalWrite(IN1, dir);
    digitalWrite(IN2, !dir);
}
 
void loop() {
    setdir(HIGH);
    for(int i = 0; i < 256; i++) {
        setspeed(i);
        delay(15);
    }
    for(int i = 255; i >= 0; i--) {
        setspeed(i);
        delay(15);
    }
   
    setdir(LOW);
    for(int i = 0; i < 256; i++) {
        setspeed(i);
        delay(15);
    }
    for(int i = 255; i >= 0; i--) {
        setspeed(i);
        delay(15);
    }
}

The code explained:

  • #define IN1 7, #define IN2 8, and #define EN 9 define the digital pins used for controlling the H-bridge circuit. IN1 and IN2 are the input pins that control the direction of the motor, while EN is the enable pin used for controlling the speed of the motor.

  • In the setup() function, the pins are set to output mode using pinMode(). This initializes the pins to be ready to receive the signal that will control the motor.

  • The setspeed() function takes an integer argument val, which corresponds to the PWM (pulse width modulation) signal that will be sent to the enable pin. The analogWrite() function is used to send the PWM signal to the EN pin.

  • The setdir() function takes a boolean argument dir, which corresponds to the direction of the motor. This function sets the values of the input pins IN1 and IN2 based on the dir value.

  • In the loop() function, the direction of the motor is set to HIGH (which is the clockwise direction) using the setdir() function. The setspeed() function is called in a loop to increase the speed of the motor gradually by increasing the PWM signal from 0 to 255. This is done using a for loop that runs from 0 to 255 with a delay of 15 milliseconds between each iteration. Then, the setspeed() function is called again in a loop to decrease the speed of the motor from 255 to 0.

  • The direction of the motor is then set to LOW (which is the counterclockwise direction), and the same process is repeated to increase and decrease the speed of the motor.

Technical Details:

  • Maximum motor supply voltage: 36V
  • Maximum output current: 600mA per channel (1.2A peak)
  • Built-in diodes to protect against inductive loads
  • Low quiescent current: 16mA
  • Thermal shutdown protection
  • Operating temperature range: 0°C to 70°C
  • Can control up to 2 DC motors or one stepper motor
  • PWM (pulse width modulation) capability for speed control
  • Output enable and input pins for flexible control
  • Available in a 16-pin package (DIP or surface mount)

Resources:

Comparisons:

The L293D and the L298 are both integrated circuits (ICs) that are commonly used to drive DC motors and other inductive loads in various electronic applications. However, there are some key differences between these two ICs, which are listed below:

  • Maximum Current: The L293D can drive up to 600 mA per channel, while the L298 can handle up to 4 A per channel. This means that the L298 can drive larger motors or multiple motors at the same time, whereas the L293D is better suited for driving smaller motors.
  • Number of Channels: The L293D has 2 channels, which means it can control two separate motors or other loads, while the L298 has 2 channels but can also be used in a parallel mode to provide a single channel capable of driving up to 4 A. This means that the L298 can be used to drive larger loads with a single channel.
  • Voltage Range: The L293D is designed to work with voltages up to 36V, while the L298 can handle voltages up to 48V. This makes the L298 more suitable for applications that require higher voltages.
  • Heat Dissipation: The L298 has a higher power dissipation than the L293D due to its higher maximum current capacity, which means it may require additional cooling or heat sinks to avoid damage from excessive heat.