L293d Motor Driver Circuit

Common DC gear head motors need current above 250mA. There are many integrated circuits like ATmega16 Microcontroller, 555 timer IC. But, IC 74 series cannot supply this amount of current. When the motor is directly connected to the o/p of the above ICs then, they might damaged. To overcome this problem, a motor control circuit is required, which can act as a bridge between the above motors and ICs (integrated circuits). There are various ways of making H-bridge motor control circuit such as using transistor, relays and using L293D/L298.

  1. L293d Motor Driver Ic Connection With Arduino
  2. L293d Motor Drive Circuit
  3. L293d Motor Driver Ic Pinout

H-Bridge Circuit

L293D IC is a typical Motor Driver IC which allows the DC motor to drive on any direction. This IC consists of 16-pins which are used to control a set of two DC motors instantaneously in any direction. L293d ic is same like an h bridge circuit with two channels. It has two half h bridge circuits residing in it. You can use it to drive uni polar, bi polar stepper motors, dc motors or even servo motors. The individual two channels can be use stand alone to drive solenoids/relays. A single channel can be used to drive a dc motor in forward(clock wise) or back word(anti clock wise) direction.

A H bridge is an electronic circuit that allows a voltage to be applied across a load in any direction. H-bridge circuits are frequently used in robotics and many other applications to allow DC motors to run forward & backward. These motor control circuits are mostly used in different converters like DC-DC, DC-AC, AC-AC converters and many other types of power electronic converters. In specific, a bipolar stepper motor is always driven by a motor controller having two H-bridges

A H-bridge is fabricated with four switches like S1, S2, S3 and S4. When the S1 and S4 switches are closed, then a +ve voltage will be applied across the motor. By opening the switches S1 and S4 and closing the switches S2 and S3, this voltage is inverted, allowing invert operation of the motor.

Generally, the H-bridge motor driver circuit is used to reverse the direction of the motor and also to break the motor. When the motor comes to a sudden stop, as the terminals of the motor are shorted. Or let the motor run free to a stop, when the motor is detached from the circuit. The table below gives the different operations with the four switches corresponding to the above circuit.

L293D Motor Driver IC

L293D IC is a typical Motor Driver IC which allows the DC motor to drive on any direction. This IC consists of 16-pins which are used to control a set of two DC motors instantaneously in any direction. It means, by using a L293D IC we can control two DC motors. As well, this IC can drive small and quiet big motors.

This L293D IC works on the basic principle of H-bridge, this motor control circuit allows the voltage to be flowing in any direction. As we know that the voltage must be change the direction of being able to rotate the DC motor in both the directions. Hence, H-bridge circuit using L293D ICs are perfect for driving a motor. Single L293D IC consists of two H-bridge circuits inside which can rotate two DC motors separately. Generally, these circuits are used in robotics due to its size for controlling DC motors.

Pin Diagram of a L293D Motor Driver IC Controller

  • Pin-1 (Enable 1-2): When the enable pin is high, then the left part of the IC will work otherwise it won’t work. This pin is also called as a master control pin.
  • Pin-2 (Input-1): When the input pin is high, then the flow of current will be through output 1
  • Pin-3 (Output-1): This output-1 pin must be connected to one of the terminals of the motor
  • Pin4 &5: These pins are ground pins
  • Pin-6 (Output-2): This pin must be connected to one of the terminals of the motor.
  • Pin-7 (Input-2): When this pin is HIGH then the flow of current will be though output 2
  • Pin-8 (Vcc2): This is the voltage pin which is used to supply the voltage to the motor.
  • Pin-16 (Vss): This pin is the power source to the integrated circuit.
  • Pin-15 (Input-4): When this pin is high, then the flow of current will be through output-4.
  • Pin-14 (Output-4): This pin must be connected to one of the terminals of the motor
  • Pin-12 & 13: These pins are ground pins
  • Pin-11 (Output-3): This pin must be connected to one of the terminals of the motor.
  • Pin-10 (Input-3): When this pin is high, then the flow of current will through output-3
  • Pin-9 (Enable3-4): When this pin is high, then the right part of the IC will work & when it is low the right part of the IC won’t work. This pin is also called as a master control pin for the right part of the IC.

H Bridge Motor Control Circuit Using L293d IC

The IC LM293D consists of 4-i/p pins where, pin2 and 7 on the left side of the IC and Pin 10 and 15 on the right side of the IC. Left input pins on the IC will control the rotation of a motor. Here, the motor is connected across side and right i/p for the motor on the right hand side. This motor rotates based on the i/ps we provided across the input pins as Logic 0 and Logic 1.

Let’s consider, when a motor is connected to the o/p pins 3 and 6 on the left side of the IC. For rotating of the motor in clockwise direction, then the i/p pins have to be provided with Logic 0 and Logic 1.

When Pin-2= logic 1 & pin-7 = logic 0, then it rotates in clockwise direction.
Pin-2=logic 0 & Pin7=logic 1, then it rotates in anti clock direction
Pin-2= logic 0 & Pin7=logic 0, then it is idle (high impedance state)
Pin-2= logic 1 & Pin7=logic 1, then it is idle

In a similar way the motor can also operate across input pin-15 and pin-10 for the motor on the right hand side.

The L4293D motor driver IC deals with huge currents, due to this reason, this circuit uses a heat sink to decrease the heat. Therefore, there are 4-ground pins on the L293D IC. When we solder these pins on the PCB (printed circuit board), then we can get a huge metallic area between the ground pins where the heat can be produced.

This is all about H Bridge Motor Control Circuit Using L293d IC. These ICs are generally used in robotics. We hope that you have got a better understanding about the concept of H-bridge. Furthermore, any queries regarding H bridge motor driver IC l293d or electrical and electronic projects, please give your feedback in the comment section below. Here is a question for you, what is the purpose of moor driver IC?

Related Content

If you are planning on assembling your new robot friend, you will eventually want to learn about controlling DC motors. One of the easiest and inexpensive way to control DC motors is to interface L293D Motor Driver IC with Arduino. It can control both speed and spinning direction of two DC motors.

And as a bonus, it can even control a unipolar stepper motor like 28BYJ-48 or Bipolar stepper motor like NEMA 17.

Control Stepper Motor with L293D Motor Driver IC & Arduino

L293d Motor Driver Ic Connection With Arduino

One of the easiest and inexpensive way to control stepper motors is to interface L293D Motor Driver IC with Arduino. It can control both speed...

Controlling a DC Motor

In order to have a complete control over DC motor, we have to control its speed and rotation direction. This can be achieved by combining these two techniques.

  • PWM – For controlling speed
  • H-Bridge – For controlling rotation direction

PWM – For controlling speed

The speed of a DC motor can be controlled by varying its input voltage. A common technique for doing this is to use PWM (Pulse Width Modulation)

PWM is a technique where average value of the input voltage is adjusted by sending a series of ON-OFF pulses.

The average voltage is proportional to the width of the pulses known as Duty Cycle.

The higher the duty cycle, the greater the average voltage being applied to the dc motor(High Speed) and the lower the duty cycle, the less the average voltage being applied to the dc motor(Low Speed).

Below image illustrates PWM technique with various duty cycles and average voltages.

H-Bridge – For controlling rotation direction

The DC motor’s spinning direction can be controlled by changing polarity of its input voltage. A common technique for doing this is to use an H-Bridge.

An H-Bridge circuit contains four switches with the motor at the center forming an H-like arrangement.

Closing two particular switches at the same time reverses the polarity of the voltage applied to the motor. This causes change in spinning direction of the motor.

Below animation illustrates H-Bridge circuit working.

L293D Motor Driver IC

The L293D is a dual-channel H-Bridge motor driver capable of driving a pair of DC motors or one stepper motor.

Driver

That means it can individually drive up to two motors making it ideal for building two-wheel robot platforms.

L293d Motor Drive Circuit

For more details please refer below datasheet.

Power Supply

The L293D motor driver IC actually has two power input pins viz. ‘Vcc1’ and ‘Vcc2’.

Vcc1 is used for driving the internal logic circuitry which should be 5V.

L293d Motor Driver Ic Pinout

From Vcc2 pin the H-Bridge gets its power for driving the motors which can be 4.5V to 36V. And they both sink to a common ground named GND.

Output Terminals

The L293D motor driver’s output channels for the motor A and B are brought out to pins OUT1,OUT2 and OUT3,OUT4 respectively.

You can connect two DC motors having voltages between 4.5 to 36V to these terminals.

Each channel on the IC can deliver up to 600mA to the DC motor. However, the amount of current supplied to the motor depends on system’s power supply.

Control Pins

For each of the L293D’s channels, there are two types of control pins which allow us to control speed and spinning direction of the DC motors at the same time viz. Direction control pins & Speed control pins.

Direction Control Pins

Using the direction control pins, we can control whether the motor spins forward or backward. These pins actually control the switches of the H-Bridge circuit inside L293D IC.

The IC has two direction control pins for each channel. The IN1,IN2 pins control the spinning direction of the motor A while IN3,IN4 control motor B.

The spinning direction of a motor can be controlled by applying either a logic HIGH(5 Volts) or logic LOW(Ground) to these pins. The below chart illustrates how this is done.

Controlling motor’s spinning direction with control inputs
IN1IN2Spinning Direction
Low(0)Low(0)Motor OFF
High(1)Low(0)Forward
Low(0)High(1)Backward
High(1)High(1)Motor OFF

Speed Control Pins

The speed control pins viz. ENA and ENB are used to turn ON, OFF and control speed of motor A and motor B respectively.

Pulling these pins HIGH will make the motors spin, pulling it LOW will make them stop. But, with Pulse Width Modulation (PWM), we can actually control the speed of the motors.

Wiring L293D motor driver IC with Arduino UNO

Now that we know everything about the IC, we can begin hooking it up to our Arduino!

Start by connecting power supply to the motors. In our experiment we are using DC Gearbox Motors(also known as ‘TT’ motors) that are usually found in two-wheel-drive robots. They are rated for 3 to 9V. So, we will connect external 9V power supply to the Vcc2 pin.

L293d Motor Driver Circuit

Next, we need to supply 5 Volts for the L293D’s logic circuitry. Connect Vcc1 pin to 5V output on Arduino. Make sure you common all the grounds in the circuit.

Now, the input and enable pins(ENA, IN1, IN2, IN3, IN4 and ENB) of the L293D IC are connected to six Arduino digital output pins(9, 8, 7, 5, 4 and 3). Note that the Arduino output pins 9 and 3 are both PWM-enabled.

Finally, connect one motor to across OUT1 & OUT2 and the other motor across OUT3 & OUT4. You can interchange your motor’s connections, technically, there is no right or wrong way.

When you’re done you should have something that looks similar to the illustration shown below.

Arduino Code – Controlling a DC Motor

The following sketch will give you complete understanding on how to control speed and spinning direction of a DC motor with L293D motor driver IC and can serve as the basis for more practical experiments and projects.

Code Explanation:

The arduino code is pretty straightforward. It doesn’t require any libraries to get it working. The sketch starts with declaring Arduino pins to which L293D’s control pins are connected.

In setup section of code, all the motor control pins are declared as digital OUTPUT and pulled LOW to turn both the motors OFF.

In loop section of the code we call two user defined functions at an interval of a second. These functions are:

  • directionControl() – This function spins both motors forward at maximum speed for two seconds. It then reverses the motor’s spinning direction and spins for another two seconds. Finally it turns the motors off.
  • speedControl() – This function accelerates both the motors from zero to maximum speed by producing PWM signals using analogWrite() function, then it decelerates them back to zero. Finally it turns the motors off.