Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To build a simple Arduino robot, make a two-wheel differential-drive car with an Arduino Uno, two geared DC motors, a dual H-bridge motor driver, a battery pack, and a caster wheel. Add an HC-SR04 ultrasonic sensor only after the robot can drive and stop reliably; the sensor provides simple reactive obstacle avoidance, not mapping or navigation.

This project produces a small battery-powered robot that can move forward, reverse, turn left and right, stop, and optionally react when an obstacle is less than a chosen distance away. The design deliberately avoids Bluetooth, cameras, line following, and robotic arms so that each electrical and software step can be tested separately.

Key takeaways

  • A beginner-friendly Arduino robot is a 2WD differential-drive car with independently controlled left and right motors.
  • DC motors must be connected through a motor driver; Arduino I/O pins provide control signals but are not motor power outputs.
  • An L298N module is familiar and inexpensive, but TB6612FNG and DRV8833 drivers generally waste less voltage and produce less heat for small robots.
  • The Arduino Uno R3 has 14 digital I/O pins, six PWM outputs, six analog inputs, and a 16 MHz clock, making it suitable for this basic build.
  • Build in stages: prove the Arduino uploads, test each motor, run the drive-only program, and only then add ultrasonic obstacle avoidance.

What kind of Arduino robot should a beginner build?

A simple 2WD robot car is the best first Arduino robot because its differential-drive mechanism is easy to understand and debug. Each wheel has its own motor, so the robot changes direction by changing the speed or direction of one wheel relative to the other.

Motor command Robot behavior
Both motors forward Drive forward
Both motors backward Reverse
Left motor backward, right motor forward Turn left in place
Left motor forward, right motor backward Turn right in place
One motor stopped while the other runs Make a gentler turn
Unequal forward speeds Make a curved path
Both motors stopped Stop

A caster wheel or ball caster supplies the third support point. The finished robot is a mobile platform, not a humanoid robot or a self-navigating machine. If an ultrasonic sensor makes the robot reverse and turn when it sees an obstacle, that is reactive obstacle avoidance; it is not mapping, localization, or path planning.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
ELEGOO Mega 2560 R3 Project The Most Complete Starter Kit with Tutorial
  • 35+ Guided Electronics Projects: Progress from LEDs and buttons to RFID access, real-time clocks, motion and distance sensing, environmental monitoring, motor control and interactive displays for STEM learning, coding clubs and maker projects
  • More I/O and Memory for Larger Builds: The MEGA 2560 R3 provides 54 digital I/O pins, including 15 PWM outputs, 16 analog inputs, 4 hardware serial ports and 256 KB flash for projects that combine more sensors, controls and displays
  • 200+ Components for Prototyping: Includes LCD1602, RC522 RFID, RTC, DHT11, HC-SR501 PIR, ultrasonic and water-level sensors, GY-521, MAX7219, keypad, joystick, rotary encoder, relay, SG90 servo, stepper motor, DC motor, breadboard and more
  • Learn, Modify and Create: Follow 35+ guided lessons with example code, then adjust sensor thresholds, timing, display text, motor behavior and control logic to turn structured exercises into access systems, monitors, alarms and interactive projects
  • Organized for Repeatable Learning: Pre-soldered modules, a solderless breadboard, storage case and small-parts box reduce setup time and keep sensors, LEDs, ICs, wires and other components easy to find between projects

What parts do you need?

You need the following parts for the basic moving robot. The L298N wiring and code in this guide assume a common dual H-bridge L298N module; other driver boards require their own pinout and wiring.

Required parts

  • Arduino Uno R3 or a compatible Uno-style board.
  • Two matched low-voltage geared DC motors, commonly sold as TT-style motors.
  • Two wheels that fit the motor shafts.
  • A small robot chassis.
  • A caster wheel or ball caster.
  • A dual H-bridge motor driver: an L298N module, Arduino Motor Shield Rev3, TB6612FNG board, or DRV8833 board.
  • A battery holder and batteries suitable for the motor voltage and current.
  • An on/off switch.
  • Jumper wires, screws, spacers, and mounting hardware.
  • A USB data cable for the Arduino.

Optional obstacle-avoidance parts

  • HC-SR04 ultrasonic distance sensor.
  • SG90 or similar hobby servo.
  • Servo bracket or rotating sensor mount.
  • A separate regulated supply for the servo if servo current causes Arduino resets.

The Uno R3 is based on the ATmega328P and provides 14 digital I/O pins, six PWM-capable outputs, six analog inputs, a 16 MHz resonator, USB, a power jack, and an ICSP header. Arduino’s Uno R3 specifications describe the board’s electrical and pin capabilities.

Part What it does
Arduino Runs the program and reads sensors
Motor driver Switches motor current and reverses motor direction
Geared DC motors Turn electrical energy into wheel movement
Chassis Holds the motors, electronics, and battery
Caster Provides the third support point
Battery Supplies portable power
HC-SR04 Measures the approximate distance to an object
Servo Turns the sensor toward different directions

Which motor driver should you choose?

For the wiring and first program in this guide, choose a common L298N module. The L298N is easy to find and can independently control two DC motors, but it is an older bipolar-transistor design that loses significant voltage as heat. A small robot may therefore receive substantially less motor voltage than the battery voltage, especially under load.

Driver Best reason to choose it Main trade-off
L298N module Cheap, familiar, and common in beginner kits Voltage loss, heat, and lower efficiency
Arduino Motor Shield Rev3 Official Arduino form factor and convenient installation More expensive and still based on L298 technology
TB6612FNG Efficient MOSFET driver for many small motors Breakout pinouts and current limits vary
DRV8833 Efficient option for suitable low-voltage motors Voltage and current constraints vary by board

The Arduino Motor Shield Rev3 documentation identifies an L298P dual full-bridge controller for two independently controlled DC motors. The official store specification lists a 5–12 V operating range and a maximum of 2 A per channel or 4 A total with an external supply. Those are product specifications for that shield, not a universal safe rating for every L298N clone, motor, battery, or cooling arrangement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a driver using the motor’s stall current, not only its no-load current. A stalled motor can draw several times its running current. Compare the actual motor voltage, stall current, driver thermal capability, battery discharge capability, and breakout-board documentation before connecting power.

Motor shield versus motor module

An L298N is a separate module connected to the Arduino with wires. A motor shield stacks onto a compatible Arduino board and uses its own documented pin assignments. A shield is physically convenient, but it is not automatically the cheapest, most efficient, or most compatible choice. Never use the L298N pin table below with the Arduino Motor Shield Rev3; use the shield’s official pinout instead.

How should you assemble the chassis?

  1. Attach the two geared motors to the chassis.
  2. Press or screw the wheels onto the motor shafts.
  3. Attach the caster at the opposite end of the chassis.
  4. Mount the Arduino with spacers.
  5. Mount the motor driver where its terminals are accessible and away from conductive chassis parts.
  6. Place the battery holder low and near the chassis center.
  7. Install the power switch in series with the battery supply.
  8. Keep the USB connector accessible during testing.
  9. Route and secure wires so they cannot touch either wheel.

Keep motor wires separate from sensitive sensor wires where practical. A heavy battery can overload small motors, a flexing chassis can misalign the wheels, and a binding caster can increase motor load. Wheels with different diameters, slippery floors, carpet, gearbox backlash, and motor mismatch can all make timed movement inconsistent.

Define left and right from the robot’s perspective, looking in the direction the robot normally drives—not from the viewpoint of someone standing in front of it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do you wire an Arduino Uno to an L298N?

The following is one practical pin assignment for an Uno and a common L298N module. Disconnect USB and battery power before adding or changing motor wiring.

L298N connection Connect to
ENA Arduino D5, a PWM pin
IN1 Arduino D7
IN2 Arduino D8
IN3 Arduino D9
IN4 Arduino D10
ENB Arduino D6, a PWM pin
OUT1 and OUT2 Left motor
OUT3 and OUT4 Right motor
Motor power input Battery positive
GND Battery negative and Arduino GND
5V logic Follow the exact module documentation; do not assume all boards are wired identically

ENA and ENB are enable inputs. Remove or configure their jumper caps when the program needs to control motor speed with PWM. Swapping the two wires of a motor reverses that motor’s direction. The Arduino ground and motor-driver ground must be connected together so that the driver can interpret the Arduino’s control signals correctly.

Rank #2
Sale
ELEGOO UNO R3 Project Super Starter Kit with PDF Tutorial for Beginners
  • TURN CODE INTO REAL-WORLD RESULTS — Follow 22+ guided lessons to make LEDs blink, read temperature and distance, move servo and stepper motors, control an LCD and respond to joystick or IR input; ideal for a family weekend build, homeschool unit, coding club or STEM classroom
  • MORE PROJECT VARIETY IN ONE ORGANIZED KIT — Includes the UNO R3 controller, LCD1602 with pre-soldered header, breadboard power module, ultrasonic and DHT11 sensors, joystick, IR receiver and remote, SG90 servo, stepper motor, relay, DC motor, fan blade, displays, LEDs, buttons, resistors and jumper wires
  • START WITHOUT SOLDERING — Plug-in modules, a solderless breadboard and the pre-soldered LCD help beginners focus on wiring, code and testing; the illustrated component list makes it easier to find each part and move from one lesson to the next
  • LEARN THE LOGIC, THEN CREATE YOUR OWN — Use Arduino IDE and the included example code to understand digital input and output, analog sensing, timing, motor control and display functions, then change thresholds, speeds and sequences for alarms, environmental monitors, reaction games and motion projects
  • CLEAR SETUP SUPPORT FOR FIRST-TIME BUILDERS — Download the latest tutorial and code, select the UNO board and correct computer port, check component polarity and breadboard rows, and keep power-module input at 9V or below; younger learners should work with an experienced adult

Do not connect motors directly to Arduino I/O pins, and do not power motors from the Arduino 5 V pin. Arduino pins send low-current logic signals; the motor driver handles the higher current and inductive electrical load. The official Arduino motor-shield documentation illustrates the same controller-versus-motor-power distinction for the shield version.

HC-SR04 wiring

HC-SR04 pin Arduino connection
VCC 5V
GND GND
TRIG D11
ECHO D12

The HC-SR04 sends an ultrasonic pulse and measures the returning echo. The sound travels to the object and back, so the measured travel time is divided by two when converting time to distance. The Arduino documentation lists libraries for HC-SR04 modules, including the HCSR04 Ultrasonic Sensor library and the Ultrasonic library. The examples below use pulseIn() instead of an external library so the measurement process remains visible.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do you install Arduino IDE 2 and upload a test?

Arduino IDE 2 is the recommended desktop workflow for installing board packages, selecting a board and port, compiling sketches, uploading programs, installing libraries, and using the Serial Monitor. Follow the official Arduino IDE documentation for the installer appropriate to your operating system.

  1. Install Arduino IDE 2.
  2. Connect the Uno with a USB data cable, not a charge-only cable.
  3. Open Arduino IDE 2.
  4. Select the board from the board selector, or choose Tools → Board → Arduino AVR Boards → Arduino Uno.
  5. Choose the correct serial port under Tools → Port.
  6. Create a new sketch and paste the test program below.
  7. Click Verify to compile it.
  8. Click Upload.
  9. Wait for the IDE to report a successful upload.

Arduino describes upload as transferring the compiled sketch to the board; the Arduino upload documentation explains the process and board-platform requirements.

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(500);
  digitalWrite(LED_BUILTIN, LOW);
  delay(500);
}

The Uno’s built-in LED should flash twice per second. Test this before connecting the motor battery. If the upload or blink test fails, try another USB cable and port, confirm the board and port selection, close programs using the serial port, install the requested board package, press Reset once, and check whether the board appears in the operating system’s device list.

How do you test the motors safely?

Lift the chassis so both wheels can spin freely, or secure the robot so an unexpected movement cannot make it fall. Connect the motor driver only after the Arduino upload test succeeds. Check battery polarity, common ground, motor terminals, and the ENA/ENB jumper configuration before switching on.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Test one motor and one driver channel at a time if possible. A motor that spins in the wrong direction is not necessarily faulty: reverse its two wires or invert its software command. Testing in the air reduces the risk of a wiring mistake causing the robot to launch across a table, but it does not replace checking motor current and driver temperature.

What code makes the Arduino robot drive?

The following drive-only sketch assumes the exact L298N wiring table above. The Uno’s analogWrite() PWM range is represented here by speed values from 0 to 255, with D5 and D6 used for motor speed control. The Uno R3 documentation lists the board’s PWM-capable outputs.

// Simple 2WD Arduino robot using a common L298N module

const int ENA = 5;   // Left motor speed, PWM
const int IN1 = 7;   // Left motor direction
const int IN2 = 8;

const int ENB = 6;   // Right motor speed, PWM
const int IN3 = 9;   // Right motor direction
const int IN4 = 10;

const int SPEED = 170; // 0-255 on an Uno

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

  pinMode(ENB, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);

  stopRobot();
}

void loop() {
  forward(SPEED);
  delay(1500);

  stopRobot();
  delay(500);

  backward(SPEED);
  delay(1000);

  stopRobot();
  delay(500);

  turnLeft(SPEED);
  delay(700);

  stopRobot();
  delay(1000);
}

void setLeftMotor(int speedValue) {
  speedValue = constrain(speedValue, -255, 255);

  if (speedValue > 0) {
    digitalWrite(IN1, HIGH);
    digitalWrite(IN2, LOW);
    analogWrite(ENA, speedValue);
  } else if (speedValue < 0) {
    digitalWrite(IN1, LOW);
    digitalWrite(IN2, HIGH);
    analogWrite(ENA, -speedValue);
  } else {
    digitalWrite(IN1, LOW);
    digitalWrite(IN2, LOW);
    analogWrite(ENA, 0);
  }
}

void setRightMotor(int speedValue) {
  speedValue = constrain(speedValue, -255, 255);

  if (speedValue > 0) {
    digitalWrite(IN3, HIGH);
    digitalWrite(IN4, LOW);
    analogWrite(ENB, speedValue);
  } else if (speedValue < 0) {
    digitalWrite(IN3, LOW);
    digitalWrite(IN4, HIGH);
    analogWrite(ENB, -speedValue);
  } else {
    digitalWrite(IN3, LOW);
    digitalWrite(IN4, LOW);
    analogWrite(ENB, 0);
  }
}

void forward(int speedValue) {
  setLeftMotor(speedValue);
  setRightMotor(speedValue);
}

void backward(int speedValue) {
  setLeftMotor(-speedValue);
  setRightMotor(-speedValue);
}

void turnLeft(int speedValue) {
  setLeftMotor(-speedValue);
  setRightMotor(speedValue);
}

void turnRight(int speedValue) {
  setLeftMotor(speedValue);
  setRightMotor(-speedValue);
}

void stopRobot() {
  setLeftMotor(0);
  setRightMotor(0);
}

The program first drives forward, stops, reverses, stops again, turns left, and stops. The movement is open-loop: the program controls the motors for timed intervals but has no encoders, so it cannot know the exact distance traveled or angle turned.

What does PWM do?

Pulse-width modulation rapidly switches a motor-driver enable signal to approximate different motor speeds. The Arduino sends the PWM control signal to ENA or ENB; the motor receives its power through the driver. PWM does not make two unmatched motors identical, and a low speed may be insufficient to overcome gearbox friction.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
ELEGOO UNO R3 Project Most Complete Starter Kit, Compatible with Arduino
  • 30+ Guided Electronics Projects: Start with LEDs and build toward LCD1602 displays, RFID access, motion detection, distance sensing, motor control and environmental monitoring for STEM learning, coding clubs, classrooms and hobby projects
  • 200+ Components Across 63 Types: Includes an ELEGOO UNO R3 controller, LCD1602, RC522 RFID, RTC, HC-SR501 PIR sensor, ultrasonic sensor, DHT11, GY-521, MAX7219, keypad, joystick, relay, SG90 servo, stepper motor, breadboard and more
  • Begin Without Soldering: Pre-soldered modules, a solderless breadboard, organized storage case and small-parts box reduce setup time and help beginners move from lesson to lesson while keeping LEDs, ICs, wires and sensors easy to find
  • Learn, Modify and Create: Program the ELEGOO UNO R3 board with Arduino IDE using the included PDF tutorial and example code, then adjust sensor thresholds, timing, display text and motor behavior to turn guided lessons into original projects
  • Flexible Power and Project Setup: Includes a 9 V, 1 A power supply, breadboard power module, 9 V battery and USB cable to support controller, breadboard and module experiments without sourcing basic setup accessories separately

How do you calibrate the robot to drive straight?

First correct direction. With a forward command, both wheels must push the robot toward the front. If the robot spins, reverse the wires of the motor running backward or invert that motor’s sign in code.

Next, adjust the two speeds independently. Real motors rarely match exactly, even when they have the same model number. For example:

const int LEFT_SPEED = 160;
const int RIGHT_SPEED = 175;

Use the lower value for the stronger wheel, then test on the surface where the robot will normally run. Wheel slip, different wheel diameters, carpet, caster friction, battery voltage, and gearbox backlash change the result. Timed turns will not be perfectly repeatable without wheel encoders.

How do you add HC-SR04 obstacle avoidance?

Add obstacle detection only after forward, reverse, turns, and stopping work reliably. The simple algorithm below stops when the measured distance is below 20 cm, reverses briefly, turns right, and resumes driving.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const int TRIG_PIN = 11;
const int ECHO_PIN = 12;

long readDistanceCm() {
  digitalWrite(TRIG_PIN, LOW);
  delayMicroseconds(2);

  digitalWrite(TRIG_PIN, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG_PIN, LOW);

  unsigned long duration = pulseIn(ECHO_PIN, HIGH, 30000UL);

  if (duration == 0) {
    return 999; // No usable echo
  }

  return duration * 0.0343 / 2.0;
}

void setupSensor() {
  pinMode(TRIG_PIN, OUTPUT);
  pinMode(ECHO_PIN, INPUT);
}

void avoidObstacles() {
  long distance = readDistanceCm();

  if (distance > 0 && distance < 20) {
    stopRobot();
    delay(150);

    backward(150);
    delay(300);

    turnRight(170);
    delay(500);

    stopRobot();
  } else {
    forward(160);
  }
}

The expression duration * 0.0343 / 2.0 converts the echo time to approximate centimeters and divides by two because the ultrasonic pulse travels to the object and back. A zero-duration reading means no usable echo arrived before the timeout; treating that result as a nearby obstacle would make the robot stop unnecessarily, so the example treats it as an uncertain long-distance result.

Merge the sensor functions into the motor sketch by adding setupSensor() to setup() and replacing the timed demonstration loop with:

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

  setupSensor();
  stopRobot();
}

void loop() {
  avoidObstacles();
  delay(50);
}

Ultrasonic readings are approximate. The sensor needs a suitable reflecting surface, should point reasonably perpendicular to the obstacle, and can be affected by vibration, object shape, angle, and reading frequency. A servo-mounted sensor can compare left, center, and right readings before choosing a direction, but that is a later upgrade rather than a requirement for the first working robot.

How do you add a servo-mounted ultrasonic sensor?

The Arduino Servo library supports common hobby servos that typically position across approximately 0–180 degrees. Servos can draw considerable current, so use a separate suitable supply if the servo makes the Arduino reset, and connect the external supply ground to Arduino GND. The official Servo library documentation explains the library’s board behavior and power considerations.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

On most non-Mega Arduino boards, using the Servo library disables PWM functionality on pins 9 and 10, even if a servo is not attached to those pins. The L298N example already uses D5 and D6 for motor PWM, so it avoids that particular conflict. If a different wiring plan uses D9 or D10 for motor speed, move motor PWM to D5 and D6 and reserve D9 and D10 for ordinary digital functions.

How should you power the Arduino robot safely?

Power the motors from the battery through the motor driver, and power the Arduino through an appropriate supply path. Connect Arduino GND to motor-driver GND. The battery, motor driver, Arduino input, and optional servo supply must all be compatible with their voltage and current requirements.

Rank #4
Sale
SunFounder Elite Explorer Kit with Original Arduino® UNO™ R4 WiFi, Powered by Arduino, RoHS Compliant, Bluetooth IoT ESP32 LCD1602 OLED, Super Starter Kit, Video Courses for Beginners & Engineers
  • All-in-One Starter Kit for Beginners: Part of the Powered by Arduino program, this kit includes an original Arduino UNO R4 WiFi, 300+ high-quality components, 50+ hands-on projects (30 basic, 13 fun, and 8 IoT), and 100+ free video lessons co-created with renowned educator Paul McWhorter. Designed for beginners ages 8+, it provides a complete, step-by-step path to learn Arduino, electronics, coding, and IoT. RoHS compliant for added safety and quality, it also makes a thoughtful gift for tech enthusiasts, students, and aspiring makers for birthdays, holidays, and special occasions
  • Powerful Arduino Uno R4 WiFi Board: Upgraded from the Arduino Uno R3, the Arduino Uno R4 WiFi features a 32-bit processor, more memory, and built-in WiFi and Bluetooth, enabling connection to third-party apps for more interactive and practical projects.
  • 300+ Components for Endless Possibilities: With 300+ components and sensors, this kit is perfect for portable projects. It features step-by-step tutorials, open-source code, and compatibility with other Arduino boards like Uno R3 and Nano, offering endless customization and learning opportunities.
  • Engaging Projects for Every Skill Level: Featuring 50 projects (30 basic, 13 fun, 8 IoT) with IoT app integration like Arduino IoT Cloud , this kit supports Arduino C++ programming, making it perfect for students, teachers, and engineers to learn, code, and create at any skill level.
  • Dedicated Support for Beginners: Alongside online resources and video tutorials, SunFounder provides technical support and troubleshooting forums to help beginners solve programming challenges with ease.
  • Battery pack → motor-driver motor-voltage input.
  • Battery or regulated supply → Arduino through an appropriate input.
  • Arduino GND ↔ motor-driver GND.
  • Separate regulated supply → servo if servo current causes brownouts, with grounds connected.
  • On/off switch in series with the battery supply.

Arduino’s power guidance says the supply must account for the Arduino’s own consumption plus the maximum current required by attached components and shields. Arduino lists the Uno’s usual VIN range as approximately 7–12 V, subject to the specific board documentation; the official Arduino power-supply guidance explains the limits and selection considerations.

Do not use a rectangular 9 V PP3 battery as the default motor battery. That battery style commonly cannot supply the startup and stall current of two drive motors. Do not assume USB can power the complete robot, do not power motors from the Arduino 5 V pin, and do not assume an L298N module’s onboard 5 V regulator can power the Arduino, sensor, and servo safely.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose batteries using motor rated voltage, motor stall current, driver voltage and current limits, desired runtime, weight, physical size, regulation requirements, and safe charging requirements. Do not use unprotected lithium-ion cells without a suitable holder, charger, protection, and wiring practice. Never connect a battery backward or attach and remove motor wires while power is on. Cover exposed terminals so they cannot short against the chassis.

The official Motor Shield Rev3 documentation warns that motor current can exceed what USB supplies and requires an external motor supply. The Motor Shield Rev3 power specifications are useful as an example of why the motor supply must be designed separately from the USB connection.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What should you buy: individual parts, a kit, or official Arduino hardware?

Buy individual parts when learning component-by-component, repairing and reusing hardware, or customizing the layout matters most. Buy a complete robot kit when predictable mechanical fit and a fast classroom build matter more than choosing every component. Kits can still include weak batteries, undocumented clone boards, inefficient drivers, or kit-specific pin assignments.

Buying route Best for Limitations
Individual generic parts Lowest-cost custom learning build and repairability More compatibility and wiring decisions
Complete 2WD robot kit Fast first build, classrooms, and younger makers Instructions and replacement parts may be kit-specific
Official Arduino Uno Rev3 plus separate parts Documented Uno ecosystem and classic tutorials Does not include the chassis, motors, driver, or battery
Official Motor Shield Rev3 build Neat official form factor and two-motor control Higher cost and L298-based efficiency limitations
Uno plus TB6612FNG or DRV8833 Lower voltage loss and less heat in a custom build Requires checking the exact breakout pinout and ratings

The official Arduino Uno Rev3 store page showed a US price of $27.60 during the research period; verify the live price, stock, taxes, and regional availability before publication or purchase. An official Uno is a strong fit when documentation and support matter, but an Uno-compatible clone may cost less and can differ in USB interface, regulator, pin labels, or build quality.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The official Motor Shield Rev3 product page showed €30.20 on the global Arduino store during research. That price is region- and VAT-dependent and should not be treated as a current US price.

The Arduino Starter Kit R4 is a broad electronics-learning package containing an Uno R4 WiFi, servo, small DC motor, sensors, breadboard, LCD, and other components. The Starter Kit R4 is not necessarily the economical choice for only a wheeled robot, and a complete 2WD chassis, two drive motors, wheels, caster, motor driver, and suitable battery may still be required.

For a cheapest learning build, combine an Uno-compatible controller with generic motors, chassis, driver, sensor, holder, and switch. For the official ecosystem, choose an official Uno and use the driver’s documented pinout. For better efficiency, use a modern MOSFET driver selected against the motors’ stall current and voltage range.

How do you troubleshoot a simple Arduino robot?

The robot does not move

  1. Confirm the battery is charged and the switch is on.
  2. Measure or otherwise verify motor voltage at the driver input.
  3. Confirm Arduino GND and driver GND are connected.
  4. Confirm motors are connected to driver outputs, not Arduino pins.
  5. Check ENA and ENB jumpers or PWM wiring.
  6. Confirm the code pin numbers match the physical wiring.
  7. Increase the speed modestly if startup friction prevents movement.
  8. Inspect loose motor terminals and broken wires.
  9. Check for an overheating or protected driver.
  10. Check whether battery voltage collapses when motors start.

Only one motor works

Check the relevant enable jumper, pin assignment, terminal connection, motor, driver channel, and ground. Test each motor and driver channel independently. A motor drawing excessive current can also make one channel appear dead or cause the whole system to reset.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
REXQualis Super Starter Kit Based on Arduino UNO R3 with Tutorial and Controller Board Compatible with Arduino IDE
  • The most economical kit comes with everything compatible with Arduino to starting programming for beginners .
  • This is the upgraded starter kits come with a 9V 1A Power Adapter (At least $5.99 on amazon) to replace a 9V Battery , and the Lcd1602 module come with pin header(not need to be soldered by yourself).
  • Include High Quality Base Board base on Arduino UNO R3 compatible with Arduino IED and Sensors, Servo, Motor, ULN2003 driver board, lcds, etc.
  • Free PDF Tutorial and Datasheet are available to download from our official website or you can contact our customer service.
  • All of the Components and Integrated Circuits are individually packaged and labeled, and packing in a plastic box which is bigger enough for you.

The robot spins instead of driving straight

Check motor polarity first. Then check wheel slip, wheel diameter, gear ratio, and left/right PWM values. Once both wheels point in the same direction, calibrate separate values such as LEFT_SPEED = 160 and RIGHT_SPEED = 175. Do not expect a timed open-loop robot to drive straight on every surface.

The Arduino resets when motors start

Resets usually indicate battery sag, motor noise, servo current, an inadequate regulator, insufficient supply current, or poor ground wiring. Test with the servo disconnected and wheels lifted, use appropriate separate power paths with a common ground, add suitable decoupling near the driver and servo, and use a battery and driver capable of handling startup current.

Arduino IDE 2 cannot upload

Check the selected board, serial port, USB data cable, board package, and operating-system permissions. Close Serial Monitor and other applications that may hold the port. Press Reset once and retry. Arduino IDE 2’s official workflow covers board packages, uploads, libraries, and Serial Monitor operation.

The ultrasonic sensor returns nonsense

Check VCC, GND, TRIG, ECHO, and matching pin numbers. Aim the sensor perpendicular to a reasonably large obstacle, reduce vibration, avoid taking readings too rapidly, and handle zero-duration timeouts. An angled, soft, narrow, or distant object may produce an uncertain reading rather than an accurate distance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The servo breaks motor speed control

On an Uno, the standard Servo library affects PWM on pins 9 and 10. Move motor speed control to D5 and D6 and use other pins for direction, as in the example wiring.

What can you upgrade after the first robot works?

Useful next steps include line-following sensors, Bluetooth or Wi-Fi control, wheel encoders, a servo-mounted ultrasonic sensor, a better motor driver, rechargeable regulated power, an inertial measurement unit, and closed-loop speed control. Add one upgrade at a time so a new failure can be associated with one new component.

Final build checklist

  • The Arduino uploads the blink test successfully.
  • Both motors spin when tested separately.
  • The robot moves forward with both wheels pushing in the same direction.
  • The robot reverses, turns left, turns right, and stops.
  • Left and right speeds are calibrated for the intended surface.
  • The HC-SR04 reports plausible readings before obstacle logic is enabled.
  • The motor battery is separate from the Arduino logic path where appropriate.
  • Arduino and motor-driver grounds are common.
  • The switch, battery holder, terminals, and loose wires are secured.
  • The robot is never powered while motor wires are being changed.

Frequently Asked Questions

Can an Arduino power DC motors directly?

No. Arduino pins provide control signals, while a motor driver and suitable external battery supply the current and polarity reversal required by DC motors. Do not connect drive motors to Arduino I/O pins or power them from the Arduino 5 V pin.

Is an L298N the best motor driver for an Arduino robot?

An L298N is a practical beginner driver because it is familiar, inexpensive, and widely available, but it is not the most efficient option. TB6612FNG and DRV8833 boards generally waste less voltage and produce less heat, provided the specific board’s voltage and stall-current limits match the motors.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why does an Arduino robot turn instead of driving straight?

An Arduino robot turns when motor directions, wheel traction, wheel diameters, gear ratios, or left and right PWM speeds differ. Correct motor polarity first, then calibrate separate left and right speed values for the actual floor surface.

Can a 9 V battery run an Arduino robot car?

A rectangular 9 V PP3 battery is usually a poor choice for drive motors because it commonly cannot supply their startup and stall current. Select a battery based on motor voltage, stall current, driver limits, required runtime, and safe charging requirements.

Is ultrasonic obstacle avoidance autonomous navigation?

A basic HC-SR04 program that stops, reverses, and turns after detecting a nearby object is reactive obstacle avoidance, not autonomous navigation. Mapping and path planning require additional sensors, algorithms, and hardware.

The Bottom Line

A reliable first Arduino robot is built progressively: assemble a light 2WD chassis, connect both motors through a suitable driver, verify the Uno and each motor independently, run the drive-only sketch, calibrate the two wheels, and add the HC-SR04 only after the basics work. Careful power design and common grounding matter more than adding advanced autonomy early.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.