WiFi Controlled Smart Car Using NodeMCU (ESP8266) and ESP 12E Motor Driver Shield
by cyrixninja in Circuits > Microcontrollers
26 Views, 0 Favorites, 0 Comments
WiFi Controlled Smart Car Using NodeMCU (ESP8266) and ESP 12E Motor Driver Shield

In this project, we have designed and built a WiFi-controlled smart car using the NodeMCU (ESP8266-12E) microcontroller and an ESP-12E Motor Shield. This project demonstrates how IoT (Internet of Things) technology can be integrated with robotics to create a wireless car that can be controlled via a smartphone or computer through a simple web interface.
The car creates its own WiFi hotspot, allowing the user to connect directly without the need for an external router or internet connection. Once connected, the user can control the movement of the car — including forward, backward, left, and right directions — from a web-based control panel.
Supplies




- ESP8266-12E Module (NodeMCU)
- ESP-12E Motor Shield
- 4 × BO Motors
- 4 × BO Motor Wheels
- MDF Board or Any Other Chassis
- 12V Battery
- Wires
- Screws
Make the Chassis

- Cut the MDF board into a rectangular shape that will serve as the base for your car. Recommended dimensions are approximately 15cm x 20cm, but you can adjust based on your preference.
- Mark four spots on the underside of the MDF board where you'll mount the BO motors - two on each side, positioned symmetrically for balance.
- Drill holes at the marked positions to allow for mounting screws.
- Place the BO motors in position, with two motors on the left side and two on the right side. Make sure all motors are oriented in the same direction on each side.
- Use small screws to secure the motors to the MDF board through the mounting holes.
- Connect the two motors on each side with jumper wires - connect the positive terminal of one motor to the positive terminal of the other motor on the same side, and do the same for the negative terminals.
- Attach the wheels to each motor shaft, ensuring they're firmly secured.
Connect the Motors With the ESP 12E Motor Shield


- Position your ESP-12E Motor Shield on top of the NodeMCU, ensuring all pins align properly and press down gently to connect them.
- Identify the motor terminals on the ESP-12E Motor Shield. There should be labeled motor outputs (typically marked as Motor A, Motor B or similar).
- Connect the wires from your BO motors to the motor shield:
- Connect the two motors on the left side to one motor output (e.g., Motor A)
- Connect the two motors on the right side to the other motor output (e.g., Motor B)
- Make sure to match the polarity (+ and -) as shown in the diagram
- For each motor:
- Connect the positive (red) wire to the positive terminal
- Connect the negative (black) wire to the negative terminal
- Note: If motors run in the wrong direction later, you can swap these connections
- Connect your battery to the power input terminals on the motor shield:
- Connect the positive (red) wire from the battery to the VIN terminal
- Connect the negative (black) wire from the battery to the GND terminal
- Double-check that your battery voltage is appropriate for the motor shield (typically 7-12V)
- Check all connections to ensure they're secure and that there are no loose wires or short circuits.
- If your motor shield has jumpers or switches for selecting power modes, ensure they're set correctly according to your power supply.
- Organize and secure all wires with zip ties or tape to prevent them from getting tangled or disconnected while the car is moving.
Program the NodeMCU With Following Code

- Install the Arduino IDE if you haven't already:
- Download from arduino.cc
- Install it on your computer
- Set up Arduino IDE for ESP8266:
- Open Arduino IDE
- Go to File > Preferences
- In "Additional Boards Manager URLs", add: http://arduino.esp8266.com/stable/package_esp8266com_index.json
- Go to Tools > Board > Boards Manager
- Search for "esp8266" and install the ESP8266 package
- Install Required Libraries:
- Go to Tools > Manage Libraries
- Search for and install "ESP8266WiFi" and "ESP8266WebServer" libraries if they aren't already installed
- Configure Board Settings:
- Go to Tools > Board > ESP8266 Boards > NodeMCU 1.0 (ESP-12E Module)
- Set the appropriate port under Tools > Port (it will appear when your NodeMCU is connected)
- Set Upload Speed to 115200
- Copy and Upload the Code:
- Create a new sketch in Arduino IDE
- Copy and paste all the code from the provided file
- Make sure your NodeMCU is connected to your computer via USB
- Click the Upload button (right arrow icon) in the Arduino IDE
- Verify Upload Success:
- Open the Serial Monitor (Tools > Serial Monitor)
- Set the baud rate to 115200
- You should see messages indicating successful initialization:
Downloads
Power on the Wifi Car by Connecting Batteries

Now that your NodeMCU is programmed and all components are connected, it's time to power on your WiFi-controlled car:
- Prepare the 12V battery pack:
- Make sure your battery pack is fully charged
- If using rechargeable batteries, ensure they're properly inserted in the battery holder
- If using a LiPo battery, check that it's not damaged and is safely secured to the chassis
- Connect the battery to the motor shield:
- Connect the positive (red) wire from the battery to the VIN terminal on the motor shield
- Connect the negative (black) wire from the battery to the GND terminal
- Double-check the polarity is correct to avoid damaging the components
- Safety check before powering on:
- Ensure all wires are properly connected and insulated
- Check that there are no loose connections or short circuits
- Make sure the motors and wheels can spin freely without obstruction
- Place the car on a flat surface or elevated platform so the wheels don't immediately make contact with the ground
- Power sequence:
- First, connect the USB cable to the NodeMCU to power the microcontroller (optional if running on battery only)
- Then connect the battery to power the motors
- You should see the blue LED on the NodeMCU light up, indicating it's powered on
- After a few seconds, the NodeMCU will initialize and create the WiFi access point
- Verify operation:
- Look for the "RoboCar" WiFi network on your smartphone or laptop
- Connect to the network using the password "12345678"
- Open a web browser and navigate to http://192.168.4.1
- The robot control interface should appear on your screen
- Test basic movements:
- Start with low speed settings (around 400-500)
- Test each direction (forward, reverse, left, right) briefly to ensure motors are responding correctly
- If wheels spin in the wrong direction, you may need to swap the motor wire connections
Your WiFi car should now be fully operational and ready for driving! You can control it through the web interface on your phone or computer while connected to its WiFi network.
Use Your Wifi Car

- Power your car with the 12V battery
- Connect to the "RoboCar" WiFi network on your smartphone or computer
- Password: 12345678
- Open a web browser and navigate to http://192.168.4.1
- You'll see the control interface with two modes:
- Joystick mode: Drag the joystick for precise control
- Button mode: Use directional buttons for simpler control
- Use the slider to adjust maximum motor speed
If you encounter any issues during uploading, try:
- Checking your USB connection
- Pressing the reset button on the NodeMCU before uploading
- Making sure you've selected the correct board and port in Arduino IDE