Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Robotics & DIY

How to Build a Robot Car with Arduino (Step-by-Step)

How to Build a Robot Car with Arduino (Step-by-Step)

March 11, 2026 /Posted byJayesh Jain / 0

Building your first robot car with Arduino is one of the most satisfying DIY electronics projects you can tackle. You start with a pile of parts and end up with a programmable wheeled robot that you fully understand and can extend in many directions. This step-by-step guide takes you from an empty workbench to a moving robot, then adds Bluetooth control and ultrasonic obstacle avoidance.

Table of Contents

  • Parts List
  • Step 1: Chassis Assembly
  • Step 2: Motor and L298N Wiring
  • Step 3: Basic Movement Code
  • Step 4: Adding Bluetooth Control (HC-05)
  • Step 5: Obstacle Avoidance (HC-SR04)
  • Next Steps
  • Frequently Asked Questions

Parts List

Before you start, gather all the parts. Here is everything you need for a complete 4WD robot car with Bluetooth and obstacle avoidance:

  • 1x 4WD robot car chassis kit (with 4 BO motors and wheels)
  • 1x Arduino Uno R3 (or clone)
  • 1x L298N dual H-bridge motor driver module
  • 1x HC-05 Bluetooth module
  • 1x HC-SR04 ultrasonic distance sensor
  • 1x 18650 battery holder (2S, 7.4V) or 4x AA battery pack (6V)
  • Jumper wires (male-male, male-female)
  • Small screwdrivers, zip ties, double-sided tape
  • USB cable for programming
🛍 Recommended: 2WD Mini Round Smart Robot Car Chassis Kit — Pre-drilled acrylic platform with motors, wheels, and all hardware included. Easy to assemble for beginners.
🛍 Recommended: Arduino Uno R3 Beginners Kit — Comes with the board, USB cable, and starter components. Perfect base for this robot car project.
🛍 Recommended: L298N Motor Driver Module — Dual H-bridge driver handles 2A per channel, perfect for 4 BO motors wired in pairs. Includes onboard 5V regulator.

Step 1: Chassis Assembly

The chassis is the physical frame of your robot. For a 4WD chassis kit:

  1. Identify the two acrylic platform layers and the metal motor mounts.
  2. Attach all four BO motors to the motor mounts using the M3 screws provided. Make sure all motors face the correct direction (shaft outward).
  3. Press the rubber wheels onto each motor shaft. They should fit snugly.
  4. Bolt the upper and lower acrylic platforms together using the supplied standoffs.
  5. Mount the Arduino Uno and L298N on the upper layer using double-sided foam tape or nylon standoffs.
  6. Mount the battery holder at the bottom layer for lower centre of gravity.

For a 2WD chassis, the process is similar but you only attach two motors plus a ball caster at the front or rear for balance. Either configuration works well for a beginner robot car.

Step 2: Motor and L298N Wiring

The L298N motor driver is an H-bridge IC that allows you to control the speed and direction of two DC motors. Here is how to wire it:

Motor Connections

  • OUT1 and OUT2: Left motor (or left pair of motors in parallel)
  • OUT3 and OUT4: Right motor (or right pair)

For a 4WD chassis, wire the two left motors in parallel to OUT1/OUT2, and the two right motors in parallel to OUT3/OUT4. Connect positive to one output and negative to the other — which way determines forward direction (you can swap if the motor runs backwards).

Arduino to L298N Control Pins

  • IN1 → Arduino Pin 2
  • IN2 → Arduino Pin 3
  • IN3 → Arduino Pin 4
  • IN4 → Arduino Pin 5
  • ENA (Enable A) → Arduino Pin 6 (PWM)
  • ENB (Enable B) → Arduino Pin 7 (PWM) — or use Pin 9/10 for PWM

Power Connections

  • 12V terminal on L298N → Battery positive (7.4V–12V)
  • GND on L298N → Battery negative (and also connect to Arduino GND)
  • 5V output on L298N → Arduino 5V pin (only if L298N 5V jumper is present and battery is 7–12V)

Important: Always connect Arduino GND to L298N GND, otherwise signals will not be referenced correctly and the motors will behave erratically.

Step 3: Basic Movement Code

Upload this sketch to your Arduino to test forward, backward, left, and right movement:

// Robot Car - Basic Movement
// L298N motor driver, 4WD chassis

// Left motor
const int IN1 = 2;
const int IN2 = 3;
const int ENA = 6;

// Right motor
const int IN3 = 4;
const int IN4 = 5;
const int ENB = 9;

int motorSpeed = 180; // 0-255

void setup() {
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
  pinMode(ENA, OUTPUT);
  pinMode(ENB, OUTPUT);
}

void moveForward() {
  analogWrite(ENA, motorSpeed);
  analogWrite(ENB, motorSpeed);
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);
}

void moveBackward() {
  analogWrite(ENA, motorSpeed);
  analogWrite(ENB, motorSpeed);
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);
}

void turnLeft() {
  analogWrite(ENA, motorSpeed);
  analogWrite(ENB, motorSpeed);
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);  // Left motors reverse
  digitalWrite(IN3, HIGH);  // Right motors forward
  digitalWrite(IN4, LOW);
}

void turnRight() {
  analogWrite(ENA, motorSpeed);
  analogWrite(ENB, motorSpeed);
  digitalWrite(IN1, HIGH);  // Left motors forward
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);   // Right motors reverse
  digitalWrite(IN4, HIGH);
}

void stopMotors() {
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, LOW);
}

void loop() {
  moveForward();   delay(2000);
  stopMotors();    delay(500);
  moveBackward();  delay(2000);
  stopMotors();    delay(500);
  turnLeft();      delay(600);
  stopMotors();    delay(500);
  turnRight();     delay(600);
  stopMotors();    delay(1000);
}

Adjust motorSpeed (0–255) to change how fast the robot moves. If a motor runs in the wrong direction, simply swap the two wires on that motor at the L298N output terminals.

Step 4: Adding Bluetooth Control with HC-05

The HC-05 Bluetooth module lets you control the robot from your Android phone using a free Bluetooth RC app. Wiring:

  • HC-05 VCC → 5V (Arduino 5V or L298N 5V)
  • HC-05 GND → GND
  • HC-05 TXD → Arduino Pin 10 (SoftwareSerial RX)
  • HC-05 RXD → 1kΩ voltage divider to Arduino Pin 11 (SoftSerial TX at 3.3V logic)
#include <SoftwareSerial.h>

SoftwareSerial BT(10, 11); // RX, TX

// (Include all motor pin definitions from previous sketch)

void setup() {
  // ... pin modes same as before
  BT.begin(9600);
}

void loop() {
  if (BT.available()) {
    char cmd = BT.read();
    switch(cmd) {
      case 'F': moveForward();  break;
      case 'B': moveBackward(); break;
      case 'L': turnLeft();     break;
      case 'R': turnRight();    break;
      case 'S': stopMotors();   break;
    }
  }
}

Pair your phone to HC-05 (default password: 1234 or 0000), then use any Bluetooth RC car app that sends F/B/L/R/S commands.

Step 5: Obstacle Avoidance with HC-SR04

Mount the HC-SR04 sensor at the front of the chassis facing forward. Wiring:

  • VCC → 5V
  • GND → GND
  • TRIG → Arduino Pin 12
  • ECHO → Arduino Pin 13
const int TRIG = 12;
const int ECHO = 13;

long getDistance() {
  digitalWrite(TRIG, LOW);
  delayMicroseconds(2);
  digitalWrite(TRIG, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG, LOW);
  long duration = pulseIn(ECHO, HIGH);
  return duration * 0.034 / 2; // cm
}

void loop() {
  long dist = getDistance();
  if (dist > 20) {
    moveForward();
  } else {
    stopMotors();
    delay(300);
    moveBackward();
    delay(400);
    turnRight();
    delay(500);
  }
  delay(50);
}

The robot now moves forward until it detects an obstacle within 20cm, then backs up and turns right to navigate around it.

Next Steps: Taking Your Robot Car Further

Once your basic robot is working, here are the most popular upgrades:

  • Line Following: Add IR line sensor modules (TCRT5000) below the chassis and write a PID-based line follower.
  • Smartphone App Control: Build a custom app using MIT App Inventor that sends directional commands over Bluetooth.
  • Servo-Mounted Sensor: Put the HC-SR04 on a servo and sweep it left-right to map obstacles before choosing a direction.
  • WiFi Control: Replace the Arduino Uno with an ESP8266 or ESP32 for web-based control over WiFi.
  • Camera: Add an ESP32-CAM for live video streaming from the robot’s perspective.
🛍 Recommended: Cytron MD10C Enhanced 13A Motor Driver — Upgrade from L298N for heavier robots. Handles 13A continuous (30A peak) with sign-magnitude PWM for smoother speed control.

Frequently Asked Questions

Q: Can I use just 4 AA batteries to power the robot?

Yes, 4 AA batteries give about 6V which is enough for the BO motors. However, alkaline AAs drop voltage quickly under load. Rechargeable NiMH AAs (2500mAh) last longer. For best performance, use 2 x 18650 Li-ion cells (7.4V) in a battery holder — they provide steady voltage and are rechargeable.

Q: My robot turns in circles instead of going straight. Why?

Motor mismatch is the most common cause. Left and right motors may spin at slightly different speeds even at the same PWM value. Calibrate by adjusting the ENA/ENB PWM values independently until the robot tracks straight on a flat surface.

Q: Can I replace the Arduino Uno with an Arduino Nano?

Yes. The Arduino Nano is smaller and lighter, which is ideal for a robot chassis. The pin numbers and code are identical. Just note that the Nano uses a Mini-USB or Micro-USB connector depending on the version.

Q: What is the maximum load the L298N can handle?

The L298N chip is rated for 2A per channel (4A total), but it runs hot above 1.5A per channel. For heavier robots or faster motors drawing more current, upgrade to the Cytron MD10C or a DRV8833-based module for better efficiency and thermal performance.

Q: Is this project suitable for school or college project submission?

Absolutely. An obstacle-avoiding Arduino robot car is a great mini-project for school science fairs, engineering college lab submissions, and workshops. You can extend it further with a 16×2 LCD showing sensor readings, a buzzer for alerts, or an OLED displaying live distance data.

Get Your Robot Car Parts at Zbotic.in

Zbotic.in stocks Arduino boards, L298N motor drivers, robot chassis kits, Bluetooth modules, and all the parts you need to build your robot car, with fast delivery across India.

Shop Robotics Parts →

Tags: Arduino, DIY robot, L298N, robot car, Robotics
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
How to Build an Agriculture Sp...
blog how to build an agriculture spray drone diy guide 594528
blog best drone motors t motor vs hobbywing vs readytosky 594536
Best Drone Motors: T-Motor vs ...

Related posts

Svg%3E
Read more

Caterpillar Track Robot: Tank-Drive Build for All Terrain

April 1, 2026 0
When wheels lose grip on sand, gravel, grass, or loose surfaces, caterpillar tracks keep moving. A tank-track robot distributes its... Continue reading
Svg%3E
Read more

RC Car to Robot: Convert a Toy Car into an Autonomous Robot

April 1, 2026 0
That old RC toy car gathering dust can be transformed into an Arduino-controlled autonomous robot with just a few electronic... Continue reading
Svg%3E
Read more

Robotic Arm Kit India: Best Options for Students and Hobbyists

April 1, 2026 0
If you are a student or hobbyist looking to get into robotics, a robotic arm kit is one of the... Continue reading
Svg%3E
Read more

Sumo Robot: Competition Build Guide India

April 1, 2026 0
Sumo robot competitions are among the most exciting events in Indian robotics, pitting small autonomous robots against each other in... Continue reading
Svg%3E
Read more

Robot Arm Build: 6-DOF Servo Arm with Arduino Control

April 1, 2026 0
Building a 6-DOF robot arm with servo motors and Arduino is one of the most rewarding robotics projects you can... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now