Arduino, circuits, writing codes in C/C++

Description

build the circuits in TinkerCad, not physically(should be two- one for #2 and one for #3)

Don't use plagiarized sources. Get Your Custom Assignment on
Arduino, circuits, writing codes in C/C++
From as Little as $13/Page

must use the main() function, not the setup() and loop() structure suggested by the Arduino IDE.

NO ARDUINO FUNCTIONS ALLOWED. The only exceptions are:

Serial.begin()
Serial.print() and Serial.println()
analogRead()
delay() and _delay_ms()
sei() and init()

code should look something like this:

int main(void) {
// Code here runs once and might include:
// Serial.begin(9600);
// init();
// sei();

while (1) {
// Code here runs on an infinite loop
}
}

example codes are attached (TinkerCADCode.pd


Unformatted Attachment Preview

///////////// Lec 22 – polling
int main(void)
{
DDRD = 0b01000000; // bit 6 in port D is an output, the rest
are inputs
DDRB = 0b00000000; // all pins in port B are inputs
//light up the LED
//PORTD = 0b01000000; //setting bit 6 in port D to 1
//_delay_ms(1000);
while (1)
{
if(PINB & 0b00001000){
//light up the LED
PORTD = 0b01000000; //setting bit 6 in port D to 1
}
else{
//turn off the LED
PORTD = 0b00000000; //setting all bits in port D to 0
}
_delay_ms(10);
}
}
///////////// Lec 22 – external interrupt
ISR(INT0_vect){
if(PIND & 0b00000100){
//light up the LED
PORTD = 0b01000000; //setting bit 6 in port D to 1
}
else{
//turn off the LED
PORTD = 0b00000000; //setting all bits in port D to 0
}
}
int main(void)
{
// set I/O
DDRD = DDRD | 0b01000000; // bit 6 in port D is an output
DDRD = DDRD & 0b11111011; // bit 2 in port D is an input
// configure the interrupt
EICRA = 0b00000001;
EIMSK = 0b00000001;
sei();
while (1){
}
}
///////////// Lec 22 – pin change interrupt (did not cover yet – will
cover on 3/15)
ISR(PCINT2_vect){
if(PIND & 0b00000100){
//light up the LED
PORTD = 0b01000000; //setting bit 6 in port D to 1
}
else{
//turn off the LED
PORTD = 0b00000000; //setting all bits in port D to 0
}
}
int main(void)
{
// set I/O
DDRD = DDRD | 0b01000000; // bit 6 in port D is an output
DDRD = DDRD & 0b11111011; // bit 2 in port D is an input
// configure the interrupt
//EICRA = 0b00000001;
//EIMSK = 0b00000001;
PCICR = 0b00000100;
PCMSK2 = 0b00000100;
sei();
while (1){
}
}
MAE 3780
2. Writing codes with Polling vs. Interrupts:
This problem presents an example of utilizing both polling and interrupts to accomplish the same
function. Please follow the subsequent steps to solve this problem. There are a total of 4 tasks to
complete (2a ~ 2d).
For this problem, please submit an image of the complete circuit, your code (.ino file), and a brief
video for each task via Gradescope. Be aware that there are multiple Gradescope assignments that
require your submission.
① Connect an LED with a current-limiting resistor to an Arduino pin of your choice, similar to
what we did in class.
② Connect a pushbutton with a 10kΩ pull-down resistor to an Arduino pin of your choice. See
diagram below. If you don’t remember how to use the button on a breadboard, see the second
video in the “How to Build a Circuit from a Circuit Diagram” playlist linked on Canvas, and/or
refer to the push button datasheet in the “Lab Kit Documentation and Tutorials” module on
Canvas.
③ Take a photo of the complete circuit. Then, write four codes (.ino file) to accomplish each of
the following tasks and take short videos:
2a.
Turn the LED on while the button is held down (using polling)
2b. Repeat part 2a using interrupts
2c.
Toggle the LED when the button is pressed (using polling)
i.e. turn the LED on when the button is pressed once, the LED should stay on, then
turn the LED off when the button is pressed again
2d. Repeat part 2c using interrupts
Page 4
MAE 3780
3. Using an H-bridge to control motor direction (Prelab 3):
This problem will prepare you for Lab 3. In this problem, you will build and program a circuit with
an Arduino and an H-bridge in TinkerCad. This circuit will allow you to change the motor’s direction
using code. Please follow the subsequent steps to solve this problem. There are a total of 2 tasks to
complete (see Objectives section, 3a ~ 3b).
For this problem, create a circuit and write a code on the TinkerCad classroom for your lab section.
Then, please submit a screenshot of the complete circuit and your code (.ino file) via Gradescope. Be
aware that there are multiple Gradescope assignments that require your submission.
Important Note
Your Arduino cannot provide enough power to run motors directly. You will power your motor with
an external 4xAA battery pack (6V). The battery pack should have a common ground connection with
the Arduino. You must be careful not to short-circuit the 6V from the battery pack to the 5V supply
from the Arduino. This is a very common mistake. If your Arduino suddenly starts behaving strangely
(e.g. won’t connect to your computer or the code won’t upload), it is usually because you have shortcircuited the power supplies. This can potentially damage the USB port on your computer, so
to avoid that, (i) plug in the wall power supply to the Arduino as it disconnects the power from
the USB port, and (ii) use a lab computer and not your personal laptop for this lab.
Background Information
You will use the L293D H-bridge in TinkerCad. This is an integrated circuit that has two H-bridges
in the package – so it can be used for bidirectional control of two motors, or uni-directional control
of up to four motors. On the other hand, your lab kits have the L9110 H-bridge, which only has a
single H-bridge on the chip. The L9110 is not available in the TinkerCad parts library, so we will use
the L293D since their functionality is very similar.
Please look at the “Pin Configuration and Functions” section on page 3 of the L293D datasheet before
you continue. The chip has 16 pins, labeled counterclockwise from the top left.
Page 5
MAE 3780
I.
VCC1 is the logic supply voltage. This will be 5V from your Arduino. This voltage is not used
to power the motors, because the Arduino cannot provide enough current.
I.
VCC2 is the power supply for the motors. This will be 6V from your 4xAA battery pack.
II.
The chip has four ground pins. Since motors require a lot of current, these pins help with heat
dissipation in addition to serving as an electrical ground.
III.
Pins labeled “A” are the inputs to the chip that you will connect to Arduino pins. They accept
the low-power control signal from the Arduino using the logic-level voltage (0V or 5V).
IV.
Pins labeled “Y” are the outputs from the chip that you will connect to the motor wires. They
control the high-power drive signal to the motors using VCC2. When an input pin (e.g. 1A) goes
high, the corresponding output pin (e.g. 1Y) will go high.
V.
You can therefore use two inputs to control the direction of a DC motor that has its wires
connected to the two corresponding outputs. For example:
Input from the chip
1A
High
VI.
2A
Low
Output from the chip
1Y
High
2Y
Low
Low
High
Low
High
Low
Low
Low
Low
High
High
High
High
Current
Flow through
motor in one
direction
Flow through
motor in the
opposite
direction
NOT flow
Motor
Spin in one
direction
Spin in the
opposite
direction
NOT spin
The “enable” pins (EN) can be used to control motor speed. When an enable pin is low, the
corresponding motor will not spin, regardless of the status of the input pins. If the enable
pin is high, the motor will spin at full speed (assuming both input pins are high). You can
send a PWM signal to the enable pin to adjust the motor’s speed.
The pin connection for the L293D H-bridge is as follows.
L293D pin #
1
2
3
4
5
6
Connection
5V (from Arduino)
Arduino pin of your choice
DC motor (+) wire
Ground
Ground
DC motor (-) wire
Page 6
MAE 3780
7
8
9
10
11
12
13
14
15
16
Arduino pin of your choice
6V (from battery pack)
Not connected
Not connected
Not connected
Ground
Ground
Not connected
Not connected
5V (from Arduino)
Objectives
3a. First, build a circuit in TinkerCad with an Arduino, a 4xAA battery pack, a DC motor,
and an H-bridge on a breadboard. Connect the pins of the H-bridge according to the table
displayed on the preceding page.
• Please refer to the template in the TinkerCad classroom (Pre-lab 3).
• If you need help building a circuit with an H-bridge, watch this video.
• You can identify the pinout configuration by utilizing the hemisphere notch located at
the top of the chip.
• Important: your entire circuit should have a common ground, but do not short-circuit
+5V from the Arduino to +6V from your battery pack. Be careful how you use the
breadboard power buses (e.g. you may want to use one for 5V and one for 6V, but do
NOT connect them). This is a very common mistake that students make when working
with H-bridges, and it can cause damage when you build the physical circuit (which is
why we’re doing this in TinkerCad first).
• Note that connection pin 1 directly to 5V means that the motor will always run at full
speed (you can also use a PWM signal on this pin to control the motor’s speed).
3b. Next, write a code (.ino file) that makes the motor operate as follows:
① The motor spins “forward” for one second (the RPM value when running the TinkerCad
simulation should be positive)
② The motor pauses for one second
③ The motor spins “backward” for one second
④ The motor pauses for one second
⑤ Repeat the steps ① ~ ④ infinitely
Forward and backward are arbitrary directions – pick them and be consistent.
Page 7
Product
Folder
Sample &
Buy
Support &
Community
Tools &
Software
Technical
Documents
L293, L293D
SLRS008D – SEPTEMBER 1986 – REVISED JANUARY 2016
L293x Quadruple Half-H Drivers
1 Features
3 Description





The L293 and L293D devices are quadruple highcurrent half-H drivers. The L293 is designed to
provide bidirectional drive currents of up to 1 A at
voltages from 4.5 V to 36 V. The L293D is designed
to provide bidirectional drive currents of up to 600-mA
at voltages from 4.5 V to 36 V. Both devices are
designed to drive inductive loads such as relays,
solenoids, DC and bipolar stepping motors, as well as
other high-current/high-voltage loads in positivesupply applications.
1


Wide Supply-Voltage Range: 4.5 V to 36 V
Separate Input-Logic Supply
Internal ESD Protection
High-Noise-Immunity Inputs
Output Current 1 A Per Channel (600 mA for
L293D)
Peak Output Current 2 A Per Channel (1.2 A for
L293D)
Output Clamp Diodes for Inductive Transient
Suppression (L293D)
2 Applications



Stepper Motor Drivers
DC Motor Drivers
Latching Relay Drivers
Each output is a complete totem-pole drive circuit,
with a Darlington transistor sink and a pseudoDarlington source. Drivers are enabled in pairs, with
drivers 1 and 2 enabled by 1,2EN and drivers 3 and 4
enabled by 3,4EN.
The L293 and L293D are characterized for operation
from 0°C to 70°C.
Device Information(1)
PART NUMBER
PACKAGE
BODY SIZE (NOM)
L293NE
PDIP (16)
19.80 mm × 6.35 mm
L293DNE
PDIP (16)
19.80 mm × 6.35 mm
(1) For all available packages, see the orderable addendum at
the end of the data sheet.
Logic Diagram
1A
1,2EN
2A
3A
3,4EN
4A
2
3
1Y
1
7
6
10
11
2Y
3Y
9
15
14
4Y
1
An IMPORTANT NOTICE at the end of this data sheet addresses availability, warranty, changes, use in safety-critical applications,
intellectual property matters and other important disclaimers. PRODUCTION DATA.
L293, L293D
SLRS008D – SEPTEMBER 1986 – REVISED JANUARY 2016
www.ti.com
Table of Contents
1
2
3
4
5
6
Features ………………………………………………………… 1
Applications ………………………………………………….. 1
Description ……………………………………………………. 1
Revision History…………………………………………….. 2
Pin Configuration and Functions ……………………. 3
Specifications………………………………………………… 4
6.1
6.2
6.3
6.4
6.5
6.6
6.7
7
8
Absolute Maximum Ratings ……………………………….. 4
ESD Ratings…………………………………………………….. 4
Recommended Operating Conditions………………….. 4
Thermal Information ………………………………………….. 4
Electrical Characteristics……………………………………. 5
Switching Characteristics ………………………………….. 5
Typical Characteristics ………………………………………. 5
Parameter Measurement Information ……………… 6
Detailed Description ………………………………………. 7
8.1 Overview …………………………………………………………. 7
8.2 Functional Block Diagram ………………………………….. 7
8.3 Feature Description…………………………………………… 7
8.4 Device Functional Modes…………………………………… 8
9
Application and Implementation …………………….. 9
9.1 Application Information………………………………………. 9
9.2 Typical Application …………………………………………… 9
9.3 System Examples …………………………………………… 10
10 Power Supply Recommendations ………………… 13
11 Layout…………………………………………………………. 14
11.1 Layout Guidelines …………………………………………. 14
11.2 Layout Example ……………………………………………. 14
12 Device and Documentation Support …………….. 15
12.1
12.2
12.3
12.4
12.5
Related Links ……………………………………………….. 15
Community Resources…………………………………… 15
Trademarks ………………………………………………….. 15
Electrostatic Discharge Caution ………………………. 15
Glossary ………………………………………………………. 15
13 Mechanical, Packaging, and Orderable
Information ………………………………………………….. 15
4 Revision History
NOTE: Page numbers for previous revisions may differ from page numbers in the current version.
Changes from Revision C (November 2004) to Revision D
Page

Removed Ordering Information table …………………………………………………………………………………………………………………… 1

Added ESD Ratings and Thermal Information tables, Feature Description section, Device Functional Modes,
Application and Implementation section, Power Supply Recommendations section, Layout section, Device and
Documentation Support section, and Mechanical, Packaging, and Orderable Information section. ……………………………… 1
2
Submit Documentation Feedback
Copyright © 1986–2016, Texas Instruments Incorporated
Product Folder Links: L293 L293D
L293, L293D
www.ti.com
SLRS008D – SEPTEMBER 1986 – REVISED JANUARY 2016
5 Pin Configuration and Functions
NE Package
16-Pin PDIP
Top View
1,2EN
1A
1Y
1
16
2
15
3
14
4
13
5
12
2Y
2A
6
11
7
10
VCC2
8
9
HEAT SINK AND
GROUND
VCC1
4A
4Y
HEAT SINK AND
GROUND
3Y
3A
3,4EN
Pin Functions
PIN
NAME
NO.
1,2EN
1
A
Y
3,4EN
TYPE
DESCRIPTION
I
Enable driver channels 1 and 2 (active high input)
2, 7, 10, 15
I
Driver inputs, noninverting
3, 6, 11, 14
O
Driver outputs
9
I
Enable driver channels 3 and 4 (active high input)
4, 5, 12, 13

Device ground and heat sink pin. Connect to printed-circuit-board ground plane with multiple
solid vias
VCC1
16

5-V supply for internal logic translation
VCC2
8

Power VCC for drivers 4.5 V to 36 V
GROUND
Submit Documentation Feedback
Copyright © 1986–2016, Texas Instruments Incorporated
Product Folder Links: L293 L293D
3
L293, L293D
SLRS008D – SEPTEMBER 1986 – REVISED JANUARY 2016
www.ti.com
6 Specifications
6.1 Absolute Maximum Ratings
over operating free-air temperature range (unless otherwise noted) (1)
MAX
UNIT
Supply voltage, VCC1 (2)
MIN
36
V
Output supply voltage, VCC2
36
V
Input voltage, VI
7
V
VCC2 + 3
V
Output voltage, VO
–3
Peak output current, IO (nonrepetitive, t ≤ 5 ms): L293
–2
2
A
Peak output current, IO (nonrepetitive, t ≤ 100 µs): L293D
–1.2
1.2
A
Continuous output current, IO: L293
–1
1
A
Continuous output current, IO: L293D
–600
600
mA
150
°C
150
°C
Maximum junction temperature, TJ
Storage temperature, Tstg
(1)
(2)
–65
Stresses beyond those listed under Absolute Maximum Ratings may cause permanent damage to the device. These are stress ratings
only, which do not imply functional operation of the device at these or any other conditions beyond those indicated under Recommended
Operating Conditions. Exposure to absolute-maximum-rated conditions for extended periods may affect device reliability.
All voltage values are with respect to the network ground terminal.
6.2 ESD Ratings
VALUE
Electrostatic
discharge
V(ESD)
(1)
(2)
Human-body model (HBM), per ANSI/ESDA/JEDEC JS-001 (1)
±2000
Charged-device model (CDM), per JEDEC specification JESD22-C101 (2)
±1000
UNIT
V
JEDEC document JEP155 states that 500-V HBM allows safe manufacturing with a standard ESD control process.
JEDEC document JEP157 states that 250-V CDM allows safe manufacturing with a standard ESD control process.
6.3 Recommended Operating Conditions
over operating free-air temperature range (unless otherwise noted)
MIN
Supply voltage
VIH
High-level input voltage
VIL
Low-level output voltage
TA
Operating free-air temperature
(1)
NOM
MAX
UNIT
VCC1
4.5
7
VCC2
VCC1
36
VCC1 ≤ 7 V
2.3
VCC1
V
VCC1 ≥ 7 V
2.3
7
V
–0.3 (1)
1.5
V
0
70
°C
V
The algebraic convention, in which the least positive (most negative) designated minimum, is used in this data sheet for logic voltage
levels.
6.4 Thermal Information
L293, L293D
THERMAL METRIC (1)
NE (PDIP)
UNIT
16 PINS
RθJA
Junction-to-ambient thermal resistance (2)
36.4
°C/W
RθJC(top)
Junction-to-case (top) thermal resistance
22.5
°C/W
RθJB
Junction-to-board thermal resistance
16.5
°C/W
ψJT
Junction-to-top characterization parameter
7.1
°C/W
ψJB
Junction-to-board characterization parameter
16.3
°C/W
(1)
(2)
4
For more information about traditional and new thermal metrics, see the Semiconductor and IC Package Thermal Metrics application
report, SPRA953.
The package thermal impedance is calculated in accordance with JESD 51-7.
Submit Documentation Feedback
Copyright © 1986–2016, Texas Instruments Incorporated
Product Folder Links: L293 L293D
L293, L293D
www.ti.com
SLRS008D – SEPTEMBER 1986 – REVISED JANUARY 2016
6.5 Electrical Characteristics
over operating free-air temperature range (unless otherwise noted)
PARAMETER
TEST CONDITIONS
L293: IOH = −1 A
MIN
TYP
VCC2 – 1.8
VCC2 – 1.4
VOH
High-level output voltage
VOL
Low-level output voltage
VOKH
High-level output clamp voltage
L293D: IOK = –0.6 A
VCC2 + 1.3
VOKL
Low-level output clamp voltage
L293D: IOK = 0.6 A
1.3
IIH
High-level input current
IIL
Low-level input current
ICC1
ICC2
L293D: IOH = − 0.6 A
L293: IOL = 1 A
1.2
L293D: IOL = 0.6 A
A
VI = 7 V
EN
A
Logic supply current
IO = 0
Output supply current
IO = 0
UNIT
V
1.8
V
V
V
0.2
100
0.2
10
–3
–10
–2
–100
All outputs at high level
13
22
All outputs at low level
35
60
All outputs at high
impedance
8
24
All outputs at high level
14
24
All outputs at low level
2
6
All outputs at high
impedance
2
4
TYP
MAX
VI = 0
EN
MAX
µA
µA
mA
mA
6.6 Switching Characteristics
over operating free-air temperature range (unless otherwise noted) VCC1 = 5 V, VCC2 = 24 V, TA = 25°C
PARAMETER
TEST CONDITIONS
MIN
tPLH
Propagation delay time, low-tohigh-level output from A input
L293NE, L293DNE
L293DWP, L293N L293DN
750
tPHL
Propagation delay time, high-tolow-level output from A input
L293NE, L293DNE
400
tTLH
Transition time, low-to-high-level
output
L293NE, L293DNE
L293DWP, L293N L293DN
100
tTHL
Transition time, high-to-low-level
output
L293NE, L293DNE
300
L293DWP, L293N L293DN
350
L293DWP, L293N L293DN
800
200
CL = 30 pF,
See Figure 2
300
UNIT
ns
ns
ns
ns
6.7 Typical Characteristics
P TOT − Power Dissipation − W
5
With Infinite Heat Sink
4
3
Heat Sink With θJA = 25°C/W
2
Free Air
1
0
−50
0
50
100
150
TA − Ambient Temperature − °C
Figure 1. Maximum Power Dissipation vs Ambient Temperature
Submit Documentation Feedback
Copyright © 1986–2016, Texas Instruments Incorporated
Product Folder Links: L293 L293D
5
L293, L293D
SLRS008D – SEPTEMBER 1986 – REVISED JANUARY 2016
www.ti.com
7 Parameter Measurement Information
tf
tr
Input
5 V 24 V
Input
50%
50%
10%
Pulse
Generator
(see Note B)
10%
VCC1 VCC2
0
tw
A
tPHL
Y
3V
3V
90%
90%
Output
CL = 30 pF
(see Note A)
EN
tPLH
90%
90%
50%
VOH
50%
Output
10%
10%
tTHL
VOL
tTLH
VOLTAGE WAVEFORMS
TEST CIRCUIT
NOTES: A. CL includes probe and jig capacitance.
B. The pulse generator has the following characteristics: tr ≤ 10 ns, tf ≤ 10 ns, tw = 10 µs, PRR = 5 kHz, ZO = 50 Ω.
Figure 2. Test Circuit and Voltage Waveforms
6
Submit Documentation Feedback
Copyright © 1986–2016, Texas Instruments Incorporated
Product Folder Links: L293 L293D
L293, L293D
www.ti.com
SLRS008D – SEPTEMBER 1986 – REVISED JANUARY 2016
8 Detailed Description
8.1 Overview
The L293 and L293D are quadruple high-current half-H drivers. These devices are designed to drive a wide array
of inductive loads such as relays, solenoids, DC and bipolar stepping motors, as well as other high-current and
high-voltage loads. All inputs are TTL compatible and tolerant up to 7 V.
Each output is a complete totem-pole drive circuit, with a Darlington transistor sink and a pseudo-Darlington
source. Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers 3 and 4 enabled by
3,4EN. When an enable input is high, the associated drivers are enabled, and their outputs are active and in
phase with their inputs. When the enable input is low, those drivers are disabled, and their outputs are off and in
the high-impedance state. With the proper data inputs, each pair of drivers forms a full-H (or bridge) reversible
drive suitable for solenoid or motor applications.
On the L293, external high-speed output clamp diodes should be used for inductive transient suppression. On
the L293D, these diodes are integrated to reduce system complexity and overall system size. A VCC1 terminal,
separate from VCC2, is provided for the logic inputs to minimize device power dissipation. The L293 and L293D
are characterized for operation from 0°C to 70°C.
8.2 Functional Block Diagram
VCC1
1
0
1
0
1
16
2
15
1
M
14
4
13
5
12
6
11
7
8
M
4
3
2
1
0
1
0
3
10
9
1
0
1
0
M
VCC2
Output diodes are internal in L293D.
8.3 Feature Description
The L293x has TTL-compatible inputs and high voltage outputs for inductive load driving. Current outputs can get
up to 2 A using the L293.
Submit Documentation Feedback
Copyright © 1986–2016, Texas Instruments Incorporated
Product Folder Links: L293 L293D
7
L293, L293D
SLRS008D – SEPTEMBER 1986 – REVISED JANUARY 2016
www.ti.com
8.4 Device Functional Modes
Table 1 lists the fuctional modes of the L293x.
Table 1. Function Table (Each Driver) (1)
INPUTS (2)
(1)
(2)
OUTPUT (Y)
A
EN
H
H
L
H
L
X
L
Z
H
H = high level, L = low level, X = irrelevant, Z = high impedance (off)
In the thermal shutdown mode, the output is in the high-impedance
state, regardless of the input levels.
VCC1
Current
Source
Input
GND
Figure 3. Schematic of Inputs for the L293x
VCC2
VCC2
Output
Output
GND
GND
Figure 4. Schematic of Outputs for the L293
8
Figure 5. Schematic of Outputs for the L293D
Submit Documentation Feedback
Copyright © 1986–2016, Texas Instruments Incorporated
Product Folder Links: L293 L293D
L293, L293D
www.ti.com
SLRS008D – SEPTEMBER 1986 – REVISED JANUARY 2016
9 Application and Implementation
NOTE
Information in the following applications sections is not part of the TI component
specification, and TI does not warrant its accuracy or completeness. TI’s customers are
responsible for determining suitability of components for their purposes. Customers should
validate and test their design implementation to confirm system functionality.
9.1 Application Information
A typical application for the L293 device is driving a two-phase motor. Below is an example schematic displaying
how to properly connect a two-phase motor to the L293 device.
Provide a 5-V supply to VCC1 and valid logic input levels to data and enable inputs. VCC2 must be connected to a
power supply capable of supplying the needed current and voltage demand for the loads connected to the
outputs.
9.2 Typical Application
5V
24 V
VCC1
16
10 kΩ
VCC2
8
1,2EN
1
Control A
1A
1Y
2
3
2A
2Y
7
6
Motor
3,4EN
9
Control B
3A
3Y
10
11
4A
4Y
15
14
Thermal
Shutdown
4, 5, 12, 13
GND
Figure 6. Two-Phase Motor Driver (L293)
9.2.1 Design Requirements
The design techniques in the application above as well as the applications below should fall within the following
design requirements.
1. VCC1 should fall within the limits described in the Recommended Operating Conditions.
2. VCC2 should fall within the limits described in the Recommended Operating Conditions.
3. The current per channel should not exceed 1 A for the L293 (600mA for the L293D).
9.2.2 Detailed Design Procedure
When designing with the L293 or L293D, careful consideration should be made to ensure the device does not
exceed the operating temperature of the device. Proper heatsinking will allow for operation over a larger range of
current per channel. Refer to the Power Supply Recommendations as well as the Layout Example.
Submit Documentation Feedback
Copyright © 1986–2016, Texas Instruments Incorporated
Product Folder Links: L293 L293D
9
L293, L293D
SLRS008D – SEPTEMBER 1986 – REVISED JANUARY 2016
www.ti.com
Typical Application (continued)
9.2.3 Application Curve
Refer to Power Supply Recommendations for additional information with regards to appropriate power
dissipation. Figure 7 describes thermal dissipation based on Figure 14.
80
θJA
3
60
2
40
PTOT (TA = 70°C)
1
20
0
θJA − Thermal Resistance − °C/W
P TOT − Power Dissipation − W
4
0
0
10
20
30
Side
50
40
− mm
Figure 7. Maximum Power and Junction vs Thermal Resistance
9.3 System Examples
9.3.1 L293D as a Two-Phase Motor Driver
Figure 8 below depicts a typical setup for using the L293D as a two-phase motor driver. Refer to the
Recommended Operating Conditions when considering the appropriate input high and input low voltage levels to
enable each channel of the device.
5V
24 V
VCC1
10 kΩ
VCC2
8
16
1,2EN
1
Control A
1A
2
1Y
2A
2Y
7
6
3
Motor
3,4EN
9
Control B
3A
10
3Y
4A
15
4Y
11
14
Thermal
Shutdown
4, 5, 12, 13
GND
Figure 8. Two-Phase Motor Driver (L293D)
10
Submit Documentation Feedback
Copyright © 1986–2016, Texas Instruments Incorporated
Product Folder Links: L293 L293D
L293, L293D
www.ti.com
SLRS008D – SEPTEMBER 1986 – REVISED JANUARY 2016
System Examples (continued)
9.3.2 DC Motor Controls
Figure 9 and Figure 10 below depict a typical setup for using the L293 device as a controller for DC motors. Note
that the L293 device can be used as a simple driver for a motor to turn on and off in one direction, and can also
be used to drive a motor in both directions. Refer to the function tables below to understand unidirectional vs
bidirectional motor control. Refer to the Recommended Operating Conditions when considering the appropriate
input high and input low voltage levels to enable each channel of the device.
VCC2
SES5001
M1
SES5001
M2
3A
10
4A
15
11
14
16
8
1/2 L293
9
VCC1
EN
4, 5, 12, 13
GND
Connections to ground and to supply voltage
Figure 9. DC Motor Controls
Table 2. Unidirectional DC Motor Control
(1)
EN
3A
M1 (1)
4A
H
H
Fast motor stop
H
Run
H
L
run
L
Fast motor stop
L
X
Free-running motor stop
X
Free-running motor stop
M2
L = low, H = high, X = don’t care
VCC2
2 × SES5001
M
2 × SES5001
2A
1A
7
6
3
2
16
8
1/2 L293
VCC1
1
EN
4, 5, 12, 13
GND
Figure 10. Bidirectional DC Motor Control
Table 3. Bidrectional DC Motor Control
1A
2A
FUNCTION (1)
H
L
H
Turn right
H
H
L
Turn left
EN
(1)
L = low, H = high, X = don’t care
Submit Documentation Feedback
Copyright © 1986–2016, Texas Instruments Incorporated
Product Folder Links: L293 L293D
11
L293, L293D
SLRS008D – SEPTEMBER 1986 – REVISED JANUARY 2016
www.ti.com
Table 3. Bidrectional DC Motor Control (continued)
EN
1A
2A
FUNCTION (1)
H
L
L
Fast motor stop
H
H
H
Fast motor stop
L
X
X
Free-running motor stop
9.3.3 Bipolar Stepping-Motor Control
Figure 11 below depicts a typical setup for using the L293D as a two-phase motor driver. Refer to the
Recommended Operating Conditions when considering the appropriate input high and input low voltage levels to
enable each channel of the device.
IL1/IL2 = 300 mA
C1
0.22 µF
16
L293
1
2
D5
L1
VCC2
IL1
15
+
D1
+
D8
3
14
4
13
5
12
6
11
+
D6
VCC1
D4
L2
IL2
+
7
10
8
9
D7
D3
D2
D1−D8 = SES5001
Figure 11. Bipolar Stepping-Motor Control
12
Submit Documentation Feedback
Copyright © 1986–2016, Texas Instruments Incorporated
Product Folder Links: L293 L293D
L293, L293D
www.ti.com
SLRS008D – SEPTEMBER 1986 – REVISED JANUARY 2016
10 Power Supply Recommendations
VCC1 is 5 V ± 0.5 V and VCC2 can be same supply as VCC1 or a higher voltage supply with peak voltage up to 36
V. Bypass capacitors of 0.1 uF or greater should be used at VCC1 and VCC2 pins. There are no power up or
power down supply sequence order requirements.
Properly heatsinking the L293 when driving high-current is critical to design. The Rthj-amp of the L293 can be
reduced by soldering the GND pins to a suitable copper area of the printed circuit board or to an external heat
sink.
Figure 14 shows the maximum package power PTOT and the θJA as a function of the side of two equal square
copper areas having a thickness of 35 μm (see Figure 14). In addition, an external heat sink can be used (see
Figure 12).
During soldering, the pin temperature must not exceed 260°C, and the soldering time must not exceed 12
seconds.
The external heatsink or printed circuit copper area must be connected to electrical ground.
17.0 mm
11.9 mm
38.0 mm
Figure 12. External Heat Sink Mounting Example (θJA = 25°C/W)
Submit Documentation Feedback
Copyright © 1986–2016, Texas Instruments Incorporated
Product Folder Links: L293 L293D
13
L293, L293D
SLRS008D – SEPTEMBER 1986 – REVISED JANUARY 2016
www.ti.com
11 Layout
11.1 Layout Guidelines
Place the device near the load to keep output traces short to reduce EMI. Use solid vias to transfer heat from
ground pins to ground plane of the printed-circuit-board.
11.2 Layout Example
GND
VCC1 16
0.1 μF
5V
2 1A
4A 15
TTL Logic
3 1Y
4Y 14
1 Ampere
TTL Logic
1 1,2EN
TTL Logic
1 Ampere
GND
VIAS
4
13
5
12
1 Ampere
6 2Y
3Y 11
1 Ampere
TTL Logic
7 2A
3A 10
TTL Logic
5V to 36V
8 VCC2
3,4EN 9
TTL Logic
1 μF
GND
Figure 13. Layout Diagram
Copper Area 35-µm Thickness
Printed Circuit Board
Figure 14. Example of Printed-Circuit-Board Copper Area (Used as Heat Sink)
14
Submit Documentation Feedback
Copyright © 1986–2016, Texas Instruments Incorporated
Product Folder Links: L293 L293D
L293, L293D
www.ti.com
SLRS008D – SEPTEMBER 1986 – REVISED JANUARY 2016
12 Device and Documentation Support
12.1 Related Links
The table below lists quick access links. Categories include technical documents, support and community
resources, tools and software, and quick access to sample or buy.
Table 4. Related Links
PARTS
PRODUCT FOLDER
SAMPLE & BUY
TECHNICAL
DOCUMENTS
TOOLS &
SOFTWARE
SUPPORT &
COMMUNITY
L293
Click here
Click here
Click here
Click here
Click here
L293D
Click here
Click here
Click here
Click here
Click here
12.2 Community Resources
The following links connect to TI community resources. Linked contents are provided “AS IS” by the respective
contributors. They do not constitute TI specifications and do not necessarily reflect TI’s views; see TI’s Terms of
Use.
TI E2E™ Online Community TI’s Engineer-to-Engineer (E2E) Community. Created to foster collaboration
among engineers. At e2e.ti.com, you can ask questions, share knowledge, explore ideas and help
solve problems with fellow engineers.
Design Support TI’s Design Support Quickly find helpful E2E forums along with design support tools and
contact information for technical support.
12.3 Trademarks
E2E is a trademark of Texas Instruments.
All other trademarks are the property of their respective owners.
12.4 Electrostatic Discharge Caution
These devices have limited built-in ESD protection. The leads should be shorted together or the device placed in conductive foam
during storage or handling to prevent electrostatic damage to the MOS gates.
12.5 Glossary
SLYZ022 — TI Glossary.
This glossary lists and explains terms, acronyms, and definitions.
13 Mechanical, Packaging, and Orderable Information
The following pages include mechanical, packaging, and orderable information. This information is the most
current data available for the designated devices. This data is subject to change without notice and revision of
this document. For browser-based versions of this data sheet, refer to the left-hand navigation.
Submit Documentation Feedback
Copyright © 1986–2016, Texas Instruments Incorporated
Product Folder Links: L293 L293D
15
PACKAGE OPTION ADDENDUM
www.ti.com
14-Aug-2021
PACKAGING INFORMATION
Orderable Device
Status
(1)
Package Type Package Pins Package
Drawing
Qty
Eco Plan
(2)
Lead finish/
Ball material
MSL Peak Temp
Op Temp (°C)
Device Marking
(3)
(4/5)
(6)
L293DNE
ACTIVE
PDIP
NE
16
25
RoHS & Green
NIPDAU
N / A for Pkg Type
0 to 70
L293DNE
L293DNEE4
ACTIVE
PDIP
NE
16
25
RoHS & Green
NIPDAU
N / A for Pkg Type
0 to 70
L293DNE
L293NE
ACTIVE
PDIP
NE
16
25
RoHS & Green
NIPDAU
N / A for Pkg Type
0 to 70
L293NE
L293NEE4
ACTIVE
PDIP
NE
16
25
RoHS & Green
NIPDAU
N / A for Pkg Type
0 to 70
L293NE
(1)
The marketing status values are defined as follows:
ACTIVE: Product device recommended for new designs.
LIFEBUY: TI has announced t