How to Use a L293D Chip With Arduino and a Motor




About: I like to create new things! I'm very interested in IOT and just Internet Stuff. I am not responsible for any injury or deaths caused by my projects.

Lets control an DC Motor with a L293D Chip and Make it so it will go clockwise or counter clockwise.

I received a kit from GearBest that included all the parts I needed for this project and recommend it to you if you are just starting with Arduino, You can check it out here!

The parts you will need are:

1) Arduino Board with PWM

2) L293D Motor Driver

3) Wires

4) External Power Supply (not needed but recommended)

5) 10 minutes

Lets Begin!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Wire Everything!

Now were going to wire everything.

I created the schematic to make it easier to understand, then used that for reference when wiring it. Its super simple!

For people that cant see the picture notes:

In the schematic the bottom wire from the chip is the one you would connect to the power supply positive, i didn't add it to keep things simple.

Step 2: Code the Arduino

The code is super simple, we use "for" statements and "analogWrite" to control it.

For Example:

when pin 5 is low and pin 6 is high it will rotate clockwise


when pin 5 is high and pin 6 is low it will rotate counter-clockwise

You can download the code from here

Here is the code also:

void setup() {


void loop() {
  for(int i = 0; i<255; i++){
    analogWrite(5, i);
    analogWrite(6, 0);
  for(int i = 0; i<255; i++){
    analogWrite(5, 255-i);
    analogWrite(6, 0);
  for(int i = 0; i<255; i++){
    analogWrite(5, 0);
    analogWrite(6, i);
  for(int i = 0; i<255; i++){
    analogWrite(5, 0);
    analogWrite(6, 255-i);

Step 3: Test It Out!

Your motor should now get increasingly faster then decelerate reverse direction and repeat!

If you have any questions leave them in the comments and i will try to help you out.

Hope you enjoyed

Maker Olympics Contest 2016

Participated in the
Maker Olympics Contest 2016

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    3 Discussions


    Reply 3 years ago

    thanks, I actually accidentally had the motor attach to the speaker and thought "hey this is really useful". now I use it a lot


    3 years ago

    the rest if your instructable too :)