Build a 2WD Robot Chassis with Arduino: Assembly, Wiring and Testing

A two-wheel-drive chassis with a caster wheel is the base for line followers, obstacle avoiders, Bluetooth cars and odometry experiments. It is cheap, simple to steer and easy to program, because turning is done only by changing the speed of the left and right wheels. A good chassis build saves you hours of debugging later; a loose motor or a sagging battery wire will make even perfect code look wrong.

In this tutorial you will assemble a standard acrylic 2WD chassis kit, mount the electronics in a sensible layout, wire a TB6612FNG driver to an Arduino Uno, and run a test sketch that checks every direction and lets you trim the motors so the robot drives straight.

Parts List

PartQuantityNotes
2WD acrylic chassis plate kit1Usually includes motor brackets, screws and spacers
BO gear motors with wheels2Commonly sold in 3 V to 6 V or higher-voltage versions; match to your battery
Caster wheel or ball caster1Mounted at the opposite end from the drive wheels
Arduino Uno1Or a Nano on a breadboard
TB6612FNG driver breakout1An L298N works too, with lower motor voltage
2S 18650 holder or pack with switch17.4 V nominal
Jumper wires, M3 spacers, cable tiesAs neededDouble-sided tape for the driver board
100 uF electrolytic capacitor1Across the motor supply at the driver

Mechanical Assembly

  1. Solder about 15 cm of wire to each motor's terminals before mounting, because the terminals are hard to reach afterwards. Add a 100 nF ceramic capacitor across each motor's terminals to reduce electrical noise.
  2. Fix each motor to the chassis with its bracket and the two long screws. Tighten until the motor cannot rotate in the bracket, but do not crack the acrylic.
  3. Make sure both motor shafts lie on one straight line, perpendicular to the chassis centre line. A skewed motor makes the robot pull to one side regardless of code.
  4. Press the wheels fully onto the shafts so they do not wobble.
  5. Mount the caster at the other end using spacers, so the chassis plate sits level when on the floor.
  6. Place the battery as low and as close to the drive axle as possible. Weight over the drive wheels improves traction; too much weight on the caster makes turning sluggish.
  7. Mount the Arduino and driver on spacers or tape, keeping motor wires away from sensor wires.

Electrical Wiring

Battery + --> switch --> TB6612 VM  and  Arduino VIN
Battery - --> TB6612 GND  and  Arduino GND (common ground)

Arduino 5V  --> TB6612 VCC        Arduino D4  --> STBY
Arduino D5  --> PWMA              Arduino D6  --> PWMB
Arduino D7  --> AIN1              Arduino D9  --> BIN1
Arduino D8  --> AIN2              Arduino D10 --> BIN2

TB6612 AO1/AO2 --> left motor     TB6612 BO1/BO2 --> right motor

The Uno's VIN pin feeds the onboard regulator, which accepts the 7.4 V to 8.4 V of a 2S pack. Keep the motor current path short: battery to driver VM and GND with thicker wire, and the capacitor right at the driver's VM pin.

Motion Test and Trim Sketch

Lift the robot so the wheels are off the table for the first run. The sketch runs forward, backward, left spin and right spin, and prints what it is doing. Use the trim values to balance the two motors.

2WD chassis motion test with straight-line trim and speed limit
// 2WD chassis test for Arduino Uno + TB6612FNG
const int PWMA = 5, AIN1 = 7, AIN2 = 8;    // left motor
const int PWMB = 6, BIN1 = 9, BIN2 = 10;   // right motor
const int STBY = 4;

// Trim: reduce the faster motor until the robot drives straight.
const float LEFT_TRIM  = 1.00;
const float RIGHT_TRIM = 0.95;
const int   MAX_PWM    = 200;  // cap duty if motors are rated below pack voltage

void motor(int pwmPin, int in1, int in2, int speed) {
  speed = constrain(speed, -MAX_PWM, MAX_PWM);
  digitalWrite(in1, speed > 0 ? HIGH : LOW);
  digitalWrite(in2, speed < 0 ? HIGH : LOW);
  analogWrite(pwmPin, abs(speed));
}

// left/right speeds in -255..255, trimmed before output
void drive(int left, int right) {
  motor(PWMA, AIN1, AIN2, (int)(left * LEFT_TRIM));
  motor(PWMB, BIN1, BIN2, (int)(right * RIGHT_TRIM));
}

void runStep(const char *name, int l, int r, int ms) {
  Serial.println(name);
  drive(l, r);
  delay(ms);
  drive(0, 0);
  delay(700);
}

void setup() {
  int pins[] = {PWMA, AIN1, AIN2, PWMB, BIN1, BIN2, STBY};
  for (int p : pins) pinMode(p, OUTPUT);
  digitalWrite(STBY, HIGH);
  Serial.begin(9600);
  delay(2000);  // time to put the robot down
}

void loop() {
  runStep("Forward",    180,  180, 1500);
  runStep("Backward",  -180, -180, 1500);
  runStep("Spin left", -150,  150,  600);
  runStep("Spin right", 150, -150,  600);
  Serial.println("Pause");
  delay(3000);
}

How to trim

Put the robot on a smooth floor next to a long straight edge such as a floor tile line. If it curves to the right during the forward step, the left motor is faster, so lower LEFT_TRIM by 0.02 and test again; if it curves left, lower RIGHT_TRIM. Trimming only ever reduces a motor, so the slower motor stays at 1.00. Note that trim is speed-dependent and changes as the battery drains, which is why accurate robots use encoders and a speed controller, covered in the encoders tutorial.

Troubleshooting

  • Robot goes backward on the Forward step: swap the wires of both motors, or of the one that runs backwards.
  • Robot spins when it should go forward: one motor is reversed; swap only that motor's wires.
  • Motors hum but do not move: PWM too low to overcome friction. Most gear motors need a minimum duty before they start, so find it and use it as your lowest speed.
  • Caster wheel drags or flutters: check the chassis is level and the caster swivels freely.
  • Arduino resets: check the capacitor and battery, and keep motor wires twisted together to reduce noise.

Summary

A reliable 2WD chassis needs aligned motors, a low battery placed near the drive axle, a short and thick motor power path and a shared ground. The test sketch confirms all four motion directions and lets you trim the motors for straighter driving. This chassis is the platform for the line follower, obstacle avoider and Bluetooth car in the next tutorials.