Arduino Robot Car: Complete 2WD Build Guide

The two-wheel-drive robot car is the best first robot you can build: cheap, forgiving, and the finished chassis becomes the platform for the line follower and obstacle avoider projects. This guide takes you from a bag of parts to a car that drives a programmed route, and explains why each wire goes where it goes.

Before you start

If you have never uploaded an Arduino sketch, do the 45-minute Arduino basics guide first — this build assumes it.

How the robot works

An Arduino pin can supply about 20–40 mA; a small gear motor stalls at over 1 A. The motor driver bridges that gap: the Arduino sends tiny logic signals, and the driver switches battery current into the motors. Steering is differential — there is no steering wheel; you turn by running one side faster than the other, and spin on the spot by running the sides in opposite directions.

Block diagram: battery pack feeds the L298N driver, which powers two DC motors; the Arduino sends direction and PWM speed signals to the driver. Battery pack 6–9 V (motors) L298N driver H-bridge ×2 12V in · 5V out · GND Arduino Uno Left motor OUT1 / OUT2 Right motor OUT3 / OUT4 VIN + GND ENA IN1–IN4 ENB + GND
Signal and power flow. The battery drives the motors through the L298N; the Arduino only sends low-current control signals.

Parts list (BOM)

2WD robot car — complete BOM
PartNotesIndicative price (India)
2WD acrylic chassis kitIncludes 2 TT gear motors, wheels, castor, screws₹300–600
Arduino Uno R3 (compatible)Plus USB cable₹400–800
L298N motor driver moduleDual H-bridge with 5 V regulator₹90–180
Battery holder: 6×AA (or 2×18650 + holder)See the power section before choosing₹60–450
Jumper wires (M–F and M–M)20 of each₹100–200
Rocker/slide switchBetween battery and driver — worth it₹15–40
Small cable ties / double-sided tapeCable management and mounting₹40–80
About prices

Prices shown are indicative online street prices in India as of mid-2026. They vary by seller and stock — treat them as a budgeting guide, not a quote.

Total: roughly ₹1,100–1,900 depending on what you already own. Every part is reused in the follow-on projects.

Assemble the chassis

  1. Peel the protective paper off the acrylic plate (yes, it comes off — the plate is clear or coloured underneath).
  2. Bolt the two TT gear motors to the rear slots using the included brackets, motor shafts pointing outward. Solder or firmly crimp a red and black wire to each motor’s terminals before mounting if they aren’t pre-wired.
  3. Fit the castor wheel at the front centre with its spacers.
  4. Push the wheels onto the motor shafts.
  5. Mount the Arduino and L298N on top with the included standoffs or double-sided tape, and the battery holder wherever it balances the car (usually the middle).

Wire the L298N motor driver

Remove nothing from the L298N except, later, the ENA/ENB jumpers. Wire it exactly as follows (this pinout is used consistently across all Hobby Robots guides, and deliberately leaves pins 3, 9, 10, 11 free for servos and sensors):

L298N ↔ Arduino ↔ motors ↔ battery
L298N terminalConnects toPurpose
OUT1, OUT2Left motor wiresLeft motor power
OUT3, OUT4Right motor wiresRight motor power
12V (VIN)Battery +, through the switchMotor supply (6–9 V here)
GNDBattery − and Arduino GNDCommon ground — required
5VArduino 5V pinPowers the Uno from the driver’s regulator
ENAArduino D5 (PWM)Left speed — remove jumper first
IN1 / IN2Arduino D7 / D8Left direction
IN3 / IN4Arduino D4 / D2Right direction
ENBArduino D6 (PWM)Right speed — remove jumper first
Common ground

Whenever two boards or modules talk to each other, their GND pins must be connected. A missing common ground is the single most frequent cause of “my sensor reads garbage” problems.

About the L298N 5V pin and jumper

With the small on-board jumper next to the 12V terminal fitted, the module generates 5 V that can power your Arduino via its 5V pin (as in the table). This is fine for battery input up to ~12 V. Never feed the L298N’s 5V terminal from the Arduino at the same time as USB, and unplug the battery’s red wire whenever the USB cable is connected — or the two supplies will fight.

Powering it properly

Under-powered motors are the #1 rookie frustration. Rules of thumb:

  • 6×AA NiMH or alkaline (7.2–9 V) — simplest and safest; decent torque. Avoid a single 9 V PP3 block: it cannot deliver motor current and the car will crawl or reset.
  • 2×18650 Li-ion (7.4 V nominal) — best runtime, but use protected cells, a proper holder, and a charger designed for Li-ion. Skip this if the builder is a young student.
  • The L298N is an old bipolar design and drops roughly 2 V internally, so your motors see about 2 V less than the battery. That is why 6 V-rated TT motors pair fine with an 8–9 V pack — and why the TB6612 upgrade exists.

First test: spin the wheels

Prop the chassis on a box so the wheels are in the air, unplug the battery, connect USB, and upload:

// Hobby Robots — motor spin test (no wheels on the ground yet!)
const int ENA = 5;  // left speed  (PWM)
const int IN1 = 7;  // left direction
const int IN2 = 8;
const int ENB = 6;  // right speed (PWM)
const int IN3 = 4;  // right direction
const int IN4 = 2;

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

  digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW);   // left forward
  digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW);   // right forward
  analogWrite(ENA, 180);
  analogWrite(ENB, 180);
  delay(2000);                                       // spin 2 s
  analogWrite(ENA, 0);
  analogWrite(ENB, 0);                               // stop
}

void loop() {}

Disconnect USB, connect the battery, flip the switch: both wheels should spin forward for two seconds. If a wheel spins backward, swap that motor’s two wires at the OUT terminals (or swap its IN pin values in code). Fix this now — every later guide assumes HIGH/LOW on IN1/IN2 means forward.

The reusable drive code

Rather than sprinkling digitalWrite calls everywhere, wrap movement in one function. This drive(left, right) takes speeds from −255 to 255 and is the foundation the line-follower and obstacle-avoider guides build on:

// Hobby Robots — reusable 2WD drive code
// Wiring: ENA=5 IN1=7 IN2=8 (left) | ENB=6 IN3=4 IN4=2 (right)
const int ENA = 5, IN1 = 7, IN2 = 8;
const int ENB = 6, IN3 = 4, IN4 = 2;

// left/right: -255 (full reverse) .. 255 (full forward)
void drive(int left, int right) {
  digitalWrite(IN1, left  >= 0 ? HIGH : LOW);
  digitalWrite(IN2, left  >= 0 ? LOW  : HIGH);
  analogWrite (ENA, min(abs(left), 255));
  digitalWrite(IN3, right >= 0 ? HIGH : LOW);
  digitalWrite(IN4, right >= 0 ? LOW  : HIGH);
  analogWrite (ENB, min(abs(right), 255));
}

void stopMotors() { drive(0, 0); }

void setup() {
  pinMode(ENA, OUTPUT); pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT);
  pinMode(ENB, OUTPUT); pinMode(IN3, OUTPUT); pinMode(IN4, OUTPUT);
  stopMotors();
  delay(3000);          // time to put the car down and step back

  drive(200, 200);  delay(1500);   // forward
  drive(-180, 180); delay(600);    // spin left on the spot
  drive(200, 200);  delay(1500);   // forward again
  drive(180, -180); delay(600);    // spin right
  stopMotors();
}

void loop() {}
Why the 3-second pause?

It gives you time to unplug USB, set the car on the floor, and step back before it moves. Cheap insurance for your laptop’s USB port.

Troubleshooting

Symptoms and causes
SymptomMost likely causeFix
Nothing moves, driver LED offBattery/switch wiring, dead batteriesCheck pack voltage at the 12V/GND terminals with a multimeter
Arduino resets when motors startWeak battery (often a 9 V block)Use 6×AA or 2×18650; check connections
One wheel doesn’t spinLoose OUT terminal or broken motor wireTug-test each screw terminal; swap motors to isolate
Wheel spins the wrong wayMotor polaritySwap that motor’s two wires at OUT
Motors whine but barely moveENA/ENB jumpers removed but pins not driven, or PWM too lowDrive ENA/ENB from D5/D6, use speeds ≥150 to start
Works on USB, dead on batteryMissing driver-GND↔Arduino-GND link or 5V jumper offRe-check the ground and the 5 V regulator jumper

Next steps