Mobile WiFi controlled Car : Node MCU

Aarnav Jindal
3 min readApr 10, 2019

--

Since childhood, I wondered how remote control cars worked. The idea of operating a car without direct connection between the car and the remote always fascinated me. I was fortunate enough to pick Computer Science as my major in College where I came in touch with programming and IoT.

There are a lot of similar projects out there but most of them focus on either Arduino or lack proper steps and descriptions of implementation. So I wanted to write one to help my fellow enthusiasts out there. So here goes…

Hardware Requirements

  • Node MCU
  • L298D motor driver
  • 2 motors
  • 3 wheels
  • Jumper wires
  • Chassis
  • USB battery with plug

I didn’t really buy a kit to put the car together. I had a mechanics set which I was able to integrate with my store bought electronics set to complete my project. So use your creativity along with the instructions to make the working model.

Node MCU board ( Left ) | L298D motor driver ( Right )

Motor driver L298D to motor connections

  • Motor A connected to driver motor 1 terminals
  • Motor B connected to driver motor 2 terminals

Motor driver L298D to Node MCU connections

  • Driver IN1 and IN2 connected to board D3 and D4
  • Driver IN3 and IN4 connected to board D7 and D8
  • Driver GND to board GND
  • Driver 5V to board VU

Mechanical Work

  • Attach the tires to the motors
  • Attach the motors to the chassis
  • Attach a tire to front of chassis for balance
  • Attach the motor driver and Node MCU board to the chassis
  • Connect the battery to the board when you want to run the car

Node MCU Coding

Saving the reference of Node MCU digital pins corresponding to the motion they would create if they were set to high and all others set to low ( L-left, R-right, F-forward, B-backward )

Using the ESP8266 WiFi module to establish connection with and communicate on the network

Set the pins to output mode and try connecting to the WiFi in setup

Connecting to the WiFi. You can check the serial monitor to see the current connection status of Node MCU

The loop function which checks for incoming data and decides upon the direction to move in

The checkClient function reads the input from the client and strips away extra characters sent along with the direction instruction and returns the resultant string

One of the possible 7settings of motion for our car : Forward. You can figure out the rest similarly by playing around a little

Complete Node MCU module code here

Android Coding

Most of the tutorials online used MIT app developer to create their apps. You can find the code for one such app here. However, the design of those apps was unappealing. So I designed one using Android Studio which you can see. If you know Android development you can change the string “url” in MainActivity to the one in serial monitor of Arduino IDE to use this app. Code available here.

So I hope you liked my little project. I would love to hear from you guys what you thought about it. For any doubts or queries or any other projects you would like me to post, please comment below. Don’t forget to applaud the post. Keep geeking it out 🤓

--

--

Aarnav Jindal
Aarnav Jindal

Written by Aarnav Jindal

Avid programmer chasing developments in the dynamic and invigorating world of technology 🤓