Before we get the Arduino board to control the motor, we should experiment with the L293D motor control chip to get an idea how it works.

We can start by just using the Arduino to supply 5V to the motor.

Note which way the motor is spinning. You can do this by pinching the motor shaft between your fingers. Swap over the motor leads so that the motor lead that was going to +5V now goes to GND and vice-versa. The motor will turn in the opposite direction.

This gives us a clue as to how the L293D chip works. Its control pins allow us to do the equivalent of swapping over the motor terminals to reverse the direction of the motor.

Build up the breadboard as below. The Arduino is still just supplying power, but we can experiment manually with the control pins before we let the Arduino take over.

The three pins of L293D that we are interested in are Pin 1 (Enable), Pin 2 (In1) and Pin 7 (In2). These are attached to either 5V or GND using the purple, yellow and orange jumper wires.

As shown above, the motor should be turning on one direction, lets call that direction A.

If you move Pin 1 (Enable) to GND the motor will stop, no matter what you do with the control pins In1 and In2. Enable turns everything on and off. This makes it useful for using a PWM output to control the motor speed. Reconnect Pin 1 to 5V so that the motor starts again.

Now try moving In1 (pin 2, yellow) from 5V to GND. In1 and In2 are both now connected to GND, so again the motor will stop.

Moving In2 from GND to 5V will cause the motor to turn in the opposite direction (direction B).

Finally, moving In1 back to 5V so that both In1 and In2 are at 5V will again cause the motor to stop.

The effect of the pins In1 and In2 on the motor are summarized in the table below:

In1

In2

Motor

GND GND
Stopped
5V GND Turns in Direction A
GND 5V Turns in Direction B
5V 5V Stopped

This guide was first published on Dec 19, 2012. It was last updated on Oct 29, 2012.

This page (An Experiment) was last updated on Oct 30, 2012.

Text editor powered by tinymce.