Home > Articles

Power Up Your Robots with an L293D Chip

  • Print
  • + Share This
John Baichtal, author of Robot Builder: The Beginner's Guide to Building Robots, shows how to use an inexpensive and widely available L293D chip to control a motor. Get your robot up and running - in any direction, and at any speed - with a few simple steps and a little bit of code.
From the author of

DC motors provide a very inexpensive and simple way to add movement to a robot, but they’re limited fresh out of the box. Simply applying voltage to the motor’s leads just makes it turn, and the motor’s speed and rotational direction cannot be modified easily. What you need is a motor control driver! The L293D chip gives you a super simple way to control motors, and this article shows you how to wire it up.

Overview of the L293D Chip

The L293D chip can be purchased from a number of sources, including Adafruit ($2.50) and SparkFun ($2.35).

The L293D chip consists of a silicon wafer with 16 leads sticking out from it (see Figure 1).

Figure 1

Figure 1 The L293D uses 16 pins to control two DC motors.

The following table describes what each of the 16 leads does on the L293D chip.

Pin

Description

1

This “enable pin” should be connected to a digital pin on the Arduino. It controls speed by using pulse-width modulation (PWM), a technique for rapidly triggering a component like an LED or motor, giving it the illusion of dimming or slowing. In actuality, it’s just turning on and off really quickly. I explain how to use this technique in the coding section of this article.

2

Control pin 1 for motor 1.

3

Output 1 for motor 1. Connect this pin to one of the leads of your motor.

4

Ground. The chip has four ground pins, but you only need to connect one to your Arduino’s GND pin.

5

Ground.

6

Output 2 for motor 1. Hook this up to the motor’s second wire.

7

Control pin 2 for motor 1. Connect this pin to a digital pin on your Arduino.

8

External power source for the motors.

9

This is the “enable pin” for motor 2. As mentioned above, you can use PWM when triggering this pin to control the speed of the motor.

10

Control pin 1 for motor 2. This pin connects to a digital pin on the Arduino.

11

Output 1 for motor 2. This pin connects to the first wire on motor 2.

12

Ground.

13

Ground.

14

Output 2 for motor 2. This pin connects to the second wire on Motor 2.

15

Control pin 2 for motor 2. Hook this pin to a digital pin on the Arduino.

16

Powers the logic of the chip. Connect this pin to 5V on the Arduino.

Basically, the L293D chip gives you control over either two DC motors or one four-wire stepper motor. For DC motors, you can control the direction and speed of the motor by using three Arduino pins. To make the motor go forward, turn one of the control pins HIGH while turning the other one LOW. To reverse direction, make the first pin LOW and the second pin HIGH. If you turn both pins HIGH or LOW, the motor won’t do anything.

Super easy! Let’s check out an example.

  • + Share This
  • 🔖 Save To Your Account