You are on page 1of 1

Controlling Motors (H-Bridges & L293D)

The Theory & Code


Controlling Motors While turning a motor on and off requires only one switch (or transistor) controlling the direction is deceptively difficult. It requires no fewer than four switches (or transistors) arranged in a clever way. H-Bridges These four switches (or transistors) are arranged in a shape that resembles an 'H' and thus called an H-Bridge. Each side of the motor has two transistors, one is responsible for pushing that side HIGH the other for pulling it LOW. When one side is pulled HIGH and the other LOW the motor will spin in one direction. When this is reversed (the first side LOW and the latter HIGH) it will spin the opposite way. DC Motor Example Confused? that's alright it all starts making sense with an example. Cut out the breadboard layout sheet below and download the example code from http://tinyurl.com/qcpah9 and play around. Stepper Motor Example (for use with 4, 5,6 & 8 wire motors) The Arduino IDE has an included library for controlling stepper motors. To test it out with this setup, plug the stepper motor in with coil A across OUT 1 & 2, and coil B across OUT 3 & 4. Then download example code from http://tinyurl.com/nyylun and play around. .: Arduino IDE Stepper Library Reference http://tinyurl.com/kvquny :. .: L293D Datasheet http://tinyurl.com/l37lw9 :.

The Pin-out
1,2EN-1 1IN-2 1OUT-3 gnd-4 gnd-5 2OUT-6 2IN-7 (supply)Vcc2-8 16-Vcc1(logic) 15-4IN 14-4OUT 13-gnd 12-gnd 11-3OUT 10-3IN 9-3,4EN

The Limits
.:Current Per Channel:. 600 mA (max peak 1.2A)
(under heavy loads the chip will get quite hot and may need additional heat-sinking. It also has thermal protection so will shutdown before breaking)

L293D

The Circuit
There is a half moon cutout, this goes at the top

The Layout Sheet


to A B C ifD E 5 volts Gto Gnd F H I J using supply voltage 1 to 5v 1
(must share 2 common ground)

IC L293D

2 3

1,2EN-1 1IN-2 1OUT-3 7 gnd-4 8 gnd-5 9 2OUT-6 2IN-7 to pin 310 11 (supply)Vcc2-8
4

16-Vcc1(logic)4 15-4IN 14-4OUT 13-gnd 12-gnd 11-3OUT 10-3IN 9-3,4EN


5 to 6 7 8 9 10 to 11 to 12 13 14 15 16 17 18 19 20 21 22 23 24

to pin 9 5 to pin 2 6

pin 5

L293D

pin 4
pin 10

12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 A B C D E F G H I J
coil B coil A

Stepper Motor

Controlling26 Motors (L293D) 27


28 29 30

CIRC-22 25

.: Instructions: print out, cut out, get making :. .: for more details visit: http://tinyurl.com/nsuwln :.

You might also like