Get Started With L293D Using NodeMCU



Introduction: Get Started With L293D Using NodeMCU

About: " Work until you no longer have to introduce yourself " Show some love on Instagram @makers_bee & Motivate me on YouTube @MakersBee

Hi Makers,

In this instructable I will show you how to interface L293D Motor Driver board with NodeMCU and the board is compatible with all development boards.

Now lets start our process !

Step 1: Materials Required

Hardware Components

  • NodeMCU
  • Dual H-Bridge L293D Motor Driver board
  • DC Motors
  • Bread board
  • Connecting Wires (Optional)
  • Jumper Wires
  • Batteries
  • Battery Clip
  • Micro USB Cable

Software Components

  • Arduino IDE

Step 2: Description

Here is some intro about L293D IC

L293D IC is a dual H-bridge motor driver IC, that can drive two motor simultaneously. One H-bridge is capable to drive a DC motor in bidirectional. L293D IC is a current enhancing IC as the output from the sensor or micro controller is not able to drive motors itself so L293D is used for this purpose.

Each chip contains two full H-bridges (four half H-bridges). That means you can drive four solenoids, two DC motors bi-bidirectionally, or one bi-polar or uni-polar stepper motor. Just make sure they're good for under 600mA since that's the limit of this driver IC.

About L293D IC
L293D is a 16 pin IC having two enable pins which should always be remain high to enable both the H-bridges.

Pins on the Right Hand Side of the IC are for controlling one motor.

Pins on the Left Hand Side of the IC are for controlling second motor.

Step 3: Circuit Connection

Dual H-Bridge Motor Driver for DC or Steppers - 600mA - L293D

The L293D has two +V pins (8 and 16). The pin '+Vmotor (8) provides the power for the motors, and +V (16) for the chip's logic.

Normally we can connect both of these to the NodeMCU 3v3 pin. Since we use a powerful motor, or a higher voltage motor, we provide the motor driver with a separate power supply using pin 8 connected to the positive power supply and the ground of the secondary power supply (called Battery) is connected to the ground of the NodeMCU.

D1 & D2 pin of NodeMCU is connected to control Motor1.

D3 & D4 pin of NodeMCU is connected to control Motor2.

To get started with coding you need to

  • Download Arduino IDE
  • Setup NodeMCU

Step 4: Code to Control Motors

//Initialize Digital Pins
const int leftForward = 5; const int leftBackward = 4; const int rightForward = 0; const int rightBackward = 2;

void setup() {
// set control pins as Output pinMode(leftForward,OUTPUT); pinMode(leftBackward,OUTPUT); pinMode(rightForward,OUTPUT); pinMode(rightBackward,OUTPUT);


void loop() {
// run forward digitalWrite(leftForward,HIGH); digitalWrite(leftBackward,LOW); digitalWrite(rightForward,HIGH); digitalWrite(rightBackward,LOW);


// run left digitalWrite(leftForward,LOW); digitalWrite(leftBackward,LOW); digitalWrite(rightForward,HIGH); digitalWrite(rightBackward,LOW);

delay(1000); // run forward digitalWrite(leftForward,HIGH); digitalWrite(leftBackward,LOW); digitalWrite(rightForward,LOW); digitalWrite(rightBackward,LOW);

delay(1000); // run backward digitalWrite(leftForward,LOW); digitalWrite(leftBackward,HIGH); digitalWrite(rightForward,LOW); digitalWrite(rightBackward,HIGH);



Download the "L293D.ino" file and open it up in the Arduino IDE.

Then Create a new sketch and paste the code below in the Arduino IDE and hit Upload.

The code will take a few minutes to upload and then you will see the motors rotating.

Step 5: Output Demonstration

You can tinker with it if you like based on the application you need, or just use it as it is.

Spending a bit more time on tweaking the code you can develop an RC car or any kind of project.

That's it for now Makers.

Thanks for your time. Don't forget to leave your thoughts in the comments section.

Stay Tuned for more Projects!

Makerspace Contest 2017

Participated in the
Makerspace Contest 2017

Be the First to Share


    • Big and Small Contest

      Big and Small Contest
    • Make It Bridge

      Make It Bridge
    • For the Home Contest

      For the Home Contest