Skip to content

Australia’s journal of technology & business

How to Make an Arduino Based Robot at Home: Complete Guide Using Arduino Robotic Kits

A step-by-step guide to building an obstacle-avoiding robot car with an Arduino Uno, an L298N motor driver and an ultrasonic sensor, from choosing a kit to wiring, coding and testing.

Small two-wheeled Arduino robot car with an ultrasonic sensor on a workbench beside jumper wires and tools

Here is how to make an Arduino based robot at home: mount two geared DC motors on a chassis, connect them to an Arduino Uno through an L298N motor driver, add an HC-SR04 ultrasonic sensor, then upload code that drives forward and turns away from obstacles. Most kits need no soldering.

Get the Briefing, free →

How to Make an Arduino Based Robot: What You Will Build

You will build a two-wheel-drive robot car that drives forward, measures the distance to whatever is ahead and turns away before it hits it. It is the classic first project because it teaches the three basics of all robots: sensing the world, deciding what to do, and moving motors in response.

The brain is an Arduino Uno R3, a board built around the ATmega328P microcontroller running at 16 MHz, with 14 digital input and output pins, six of which can produce PWM signals, and six analog inputs. That is plenty for two motors and a sensor, with pins to spare for later upgrades.

If you have wondered how to make a robot without an engineering degree, this is the gentlest path in. The same sense, decide and act loop runs inside far larger machines, from the mobile robots in our guide to robotics in warehouse material handling to industrial arms. Browse more builds and explainers in our Robotics & Automation section.

Should You Start with Arduino Robotic Kits or Loose Parts?

If you are learning how to make an Arduino-based robot for the first time, start with a kit. Arduino robotic kits bundle matching motors, wheels, a driver, a sensor and a chassis, so you spend your time learning rather than hunting for parts. Buy loose parts once you know what you want to change.

There are two broad kit styles. Generic two-wheel or four-wheel car kits use an Uno-compatible board and the same L298N and HC-SR04 parts described in this guide. Educational robots are more polished. Arduino Alvik, Arduino’s own robot for schools, runs on an Arduino Nano ESP32, can be programmed in MicroPython or the Arduino language, and includes a line-following sensor array, a time-of-flight distance sensor, a six-axis motion sensor and colour sensors.

In Australia, electronics retailers such as Core Electronics and Jaycar sell Arduino boards, robot chassis and kits. Compare what each kit includes, whether it needs soldering, and whether it comes with clear instructions and example code. Check current prices on the retailer’s own site, because they change often.

Kit or loose parts: which suits you?
OptionBest forTrade-off
Generic car kitHobbyists and first-time builders who want to learn the wiringInstructions vary in quality, and parts may need small adjustments
Educational robot such as Arduino AlvikSchools, younger students and anyone who wants to focus on codingLess hands-on wiring, higher cost than a basic kit
Loose partsBuilders who want a custom design or already own some partsMore time sourcing, checking compatibility and mounting

Which Parts Do You Need?

You need an Arduino Uno or compatible board, an L298N motor driver module, two geared DC motors with wheels, a caster wheel, a chassis plate, an HC-SR04 ultrasonic sensor, jumper wires, a battery pack for the motors, a power source for the Arduino and a USB cable. A small screwdriver set and cable ties finish the toolkit.

Parts list for a two-wheel obstacle-avoiding robot
PartWhat it doesNotes
Arduino Uno R3 or compatibleRuns your program and reads the sensorAny Uno-compatible board works with this guide
L298N motor driver moduleLets the low-power Arduino control higher-current motorsBased on ST’s L298 dual full-bridge driver chip
Two geared DC motors with wheelsDrive the robot and steer it by changing speedThe yellow “TT” gear motors in most kits are fine
Caster or ball wheelSupports the front or back so the robot balancesUsually included with the chassis
HC-SR04 ultrasonic sensorMeasures distance to objects aheadRated for roughly 2 cm to 4 m
Battery pack for motorsPowers the motors through the driverFour to six AA cells or a suitable rechargeable pack
Power for the ArduinoKeeps the board running separately from the motorsA USB power bank or a 9 V battery to the barrel jack
Jumper wires and cable tiesConnect the parts and keep wires tidyMale-to-female leads suit the sensor and driver pins

The L298N module is built on ST’s L298 dual full-bridge driver, which accepts standard logic-level signals and can drive DC motors, relays and steppers. Each side of the chip controls one motor, letting you set its direction and speed independently.

Step 1: How to Construct a Simple Robot Chassis

To construct the chassis, screw the two motors to the underside of the plate, push the wheels onto the motor shafts, fit the caster at the other end, then mount the battery holder, the L298N module and the Arduino on top. Keep heavy parts low and central so the robot does not tip when it turns.

Many beginners ask how to construct a simple robot that actually drives straight. The answer is mostly mechanical: mount both motors square to the plate, make sure the wheels are pushed fully on, and check that neither wheel rubs on the chassis. Small differences between motors are normal, and you will balance them in code later.

  • Fit the motors with their shafts pointing outwards and their wire tabs facing in.
  • Attach the caster so the chassis sits level when all wheels touch the bench.
  • Mount the HC-SR04 at the front, facing forward and clear of the wheels.
  • Leave access to the Arduino’s USB port so you can upload code without dismantling anything.
  • Use cable ties to keep wires away from the wheels.

Step 2: Wire the Motors, Driver and Power Safely

Connect each motor to one pair of L298N output terminals, the motor battery to the driver’s power input, and six Arduino pins to the driver’s control inputs. Then join the Arduino ground to the driver ground. Without that shared ground, the control signals have no common reference and the motors will behave erratically.

Keep motor power and Arduino power separate. The Arduino Project Hub version of this build warns in its code comments not to power motors from the Arduino, and not to power the Arduino from the motor driver. Motors draw surges of current that can reset or damage the board. A power bank on the USB port is the simplest way to run the Arduino.

Suggested wiring between the Arduino Uno and the L298N
L298N pinConnect toPurpose
ENAArduino pin 5 (PWM)Left motor speed
IN1Arduino pin 7Left motor direction
IN2Arduino pin 8Left motor direction
ENBArduino pin 6 (PWM)Right motor speed
IN3Arduino pin 9Right motor direction
IN4Arduino pin 10Right motor direction
OUT1 and OUT2Left motor wiresDrive the left wheel
OUT3 and OUT4Right motor wiresDrive the right wheel
Power input (often labelled 12V)Motor battery positiveMotor supply
GNDMotor battery negative and Arduino GNDShared ground

Remove the small jumpers on ENA and ENB if your module has them, so the Arduino controls speed through PWM. On the Uno, pins 3, 5, 6, 9, 10 and 11 support PWM, which is why the enable pins use 5 and 6. The L298 also loses some voltage inside the chip, so your motors will run a little slower than the battery voltage suggests.

Step 3: Add the Ultrasonic Sensor So the Robot Can See

Wire the HC-SR04’s VCC pin to the Arduino’s 5V pin, GND to GND, TRIG to pin 12 and ECHO to pin 11. The sensor works like a bat: it sends a short burst of ultrasound and times how long the echo takes to return. Your code turns that time into a distance in centimetres.

When the TRIG pin receives a pulse of at least 10 microseconds, the module sends eight ultrasonic cycles at 40 kHz and raises the ECHO pin for as long as the sound takes to travel out and back. Sound travels at about 343 metres per second in room-temperature air, or 0.0343 centimetres per microsecond. Multiply the echo time by 0.0343 and divide by two, because the sound made a return trip.

The sensor works best on flat, hard surfaces facing it. Soft fabric, thin chair legs and objects at sharp angles can reflect too little sound, so expect the occasional missed obstacle. Readings under about 2 cm are unreliable, which is one reason to set your turning distance well above that.

Step 4: How to Code a Robot with the Arduino IDE

To code the robot, install the free Arduino IDE, select the Arduino Uno board and its USB port, then write a sketch with two parts: setup, which runs once to configure the pins, and loop, which runs forever. In the loop, read the distance, decide whether the path is clear, and set the motors.

The Arduino software page offers the desktop Arduino IDE 2 and a free browser-based Cloud Editor, so you can work on Windows, macOS, Linux or a Chromebook. Learning how to code a robot is mostly about breaking behaviour into small, named functions you can test one at a time.

  • Define names for each pin at the top of the sketch, such as the enable, input, trigger and echo pins, so the code reads clearly.
  • In setup, set the six motor pins and the TRIG pin as outputs, the ECHO pin as an input, and start the serial monitor at 9600 baud for debugging.
  • Write a distance function that sets TRIG low briefly, high for 10 microseconds, then low, measures the ECHO pulse with the pulseIn function and returns the time multiplied by 0.0343 and divided by two.
  • Write motor functions for forward, backward, turn left, turn right and stop. Each one sets the IN pins high or low for direction and uses analogWrite on the enable pins for speed, from 0 to 255.
  • In loop, read the distance. If it is more than about 25 cm, drive forward. If not, stop, reverse briefly, turn for a fraction of a second, then check again.
  • Add a short delay of around 50 milliseconds at the end of each loop so the sensor’s echoes do not overlap.

Print each distance reading to the serial monitor while you test. Seeing the numbers change as you move your hand in front of the sensor is the fastest way to confirm that wiring and code agree before the wheels ever touch the floor.

Step 5: Test, Calibrate and Fix Common Problems

Test in stages: first the sensor alone using the serial monitor, then the motors with the robot propped up so the wheels spin freely, then short runs on the floor. Fix one problem at a time. Most first-build faults come from a loose jumper wire, a missing shared ground, a flat battery or a motor wired backwards.

Calibrate on a smooth floor. If the robot drifts, lower the speed value for the faster motor until it tracks straight. If it turns too far or not far enough, change the turn time. If it stops too late, raise the obstacle distance. Write down each change so you can undo it.

Troubleshooting a first Arduino robot
SymptomLikely causeFix
One wheel spins the wrong wayMotor wires reversedSwap that motor’s two wires at the L298N terminals
Motors hum but do not turnSpeed value too low or weak batteriesRaise the PWM value or fit fresh batteries
Arduino resets when motors startBoard and motors sharing a supplyPower the Arduino separately and join the grounds
Distance always reads zeroTRIG and ECHO swapped or not connectedCheck the sensor wiring against your pin names
Robot hits soft obstaclesFabric absorbs the ultrasoundRaise the turning distance or add a second sensor type
Upload failsWrong board or port selectedChoose Arduino Uno and the correct port in the IDE

Where Can You Take Your Robot Next?

Once the basic robot works, add one upgrade at a time: a servo that sweeps the sensor left and right, infrared sensors for line following, wheel encoders for accurate distance, or a Bluetooth module for phone control. Each upgrade teaches a new idea in sensing or control without starting from scratch.

These ideas scale up. Line following is the ancestor of the guided vehicles in factories, wheel encoders underpin precise movement, and remote control leads to teleoperation. In medicine, surgeon-controlled systems use far more advanced versions of these ideas, as our explainer on what robotic surgery is explains.

  • Servo scanning: mount the HC-SR04 on a small servo and pick the clearest direction before turning.
  • Line following: add infrared reflectance sensors and steer to keep a dark line centred.
  • Encoders: count wheel rotations so the robot can drive set distances and turn set angles.
  • Wireless control: add a Bluetooth module and drive the robot from a phone app.
  • New brains: move to a board with Wi-Fi, such as an ESP32-based Arduino, for app or cloud control.

How Do You Build Safely at Home?

Build safely by disconnecting batteries before changing wires, never shorting battery terminals, using the right charger for rechargeable packs, and supervising children around tools, small parts and batteries. Lithium batteries can overheat or catch fire if damaged or charged incorrectly, so store and charge them away from flammable materials.

  • Disconnect the motor battery whenever you change the wiring.
  • Check polarity before connecting any battery to the driver or the Arduino.
  • Keep coin and button batteries well away from young children.
  • Work in a ventilated space if you solder, and use a stand for the hot iron.

Build Your First Robot This Weekend

Now you know how to make an Arduino based robot: assemble a simple chassis, wire the motors through an L298N with separate power and a shared ground, add an HC-SR04 sensor, write a sense, decide and act loop, then test and tune it step by step. It is a small project that teaches the foundations of every robot.

Pick a kit or gather the parts, set aside an afternoon and build it. When it works, choose one upgrade from the list above. For more projects and the bigger picture on automation, explore Robotics & Automation, read how robots move goods in warehouse material handling, and subscribe to the Briefing for new guides every weekday.

Sources

  1. UNO R3 Arduino Documentation
  2. Arduino Alvik Arduino Education
  3. Software: Arduino IDE and Cloud Editor Arduino
  4. L298 dual full-bridge driver STMicroelectronics
  5. Obstacle detecting Robot Arduino Project Hub
Share this article
Muhammad Muzammil Qureshi, co-founder and Editor-in-Chief of TechTimes.com.au

About Muhammad Muzammil Qureshi

Muhammad Muzammil Qureshi is the co-founder and Editor-in-Chief of TechTimes.com.au. He has spent 17 years building software for businesses, from lead developer to chief technology officer. He writes about AI, SaaS, cloud and the technology decisions business owners face.

More from Muhammad Muzammil Qureshi →

Questions and answers

Frequently asked questions

Straight answers to the questions readers ask most about this topic.

Want more like this?

Get five stories that matter to Australian business and tech in your inbox every weekday morning.

Do I need to solder to build this robot?
Usually not. Most Arduino robot car kits use screw terminals on the motor driver and jumper wires with push-on connectors for the board and sensor. Some kits ship motors without wires attached, which does need a few solder joints, so check the product description before you buy if you want a completely solder-free build.
How long does it take to make an Arduino robot?
A first build from a kit usually takes an afternoon to a day, including assembly, wiring, uploading code and testing. Loose-part builds take longer because you have to source and fit everything yourself. Allow extra time for troubleshooting, which is normal and part of the learning, especially when calibrating the motors to drive straight.
Which Arduino board is best for a beginner robot?
The Arduino Uno R3 or a compatible board is the most common choice because it has enough pins, is widely documented and works with almost every tutorial and kit. If you want Wi-Fi or Bluetooth later, an ESP32-based board such as the Arduino Nano ESP32 is a good next step, though pin layouts and voltages differ.
What batteries should power the robot?
Use a separate pack for the motors, such as four to six AA cells or a suitable rechargeable pack, and power the Arduino from a USB power bank or a 9 V battery to its barrel jack. Join the grounds. Avoid running motors from the Arduino’s own 5V pin, because motor current surges can reset or damage the board.
What programming language does Arduino use?
Arduino sketches are written in the Arduino language, which is based on C and C++, using the free Arduino IDE or the browser-based Cloud Editor. Each sketch has a setup function that runs once and a loop function that repeats. Some boards, such as the Arduino Nano ESP32 inside Arduino Alvik, can also be programmed in MicroPython.
Why does my robot not drive in a straight line?
Small differences between motors, wheels and friction make one side faster. Check that both motors are mounted square and the wheels do not rub, then lower the PWM speed value for the faster side in your code until the robot tracks straight. For precise straight driving, add wheel encoders and adjust each motor’s speed automatically.
Is an Arduino robot a good project for kids?
Yes, with adult supervision. Building a robot teaches basic electronics, coding and problem solving in a hands-on way. Younger children may prefer an educational robot with block-based coding, while teenagers can handle wiring and text code. Keep small parts and button batteries away from young children, and supervise any soldering or battery charging.
What can I learn after building this robot?
Good next steps are servo scanning, line following with infrared sensors, wheel encoders for accurate movement and wireless control by Bluetooth or Wi-Fi. Each teaches a new idea in sensing or control. After that, you could explore robot kits with cameras, motion sensors or arms, or learn about robotics frameworks used in research and industry.
Where can I find more robotics projects on TechTimes?
TechTimes.com.au publishes robotics guides and explainers in its Robotics & Automation section, alongside sections on IoT, Artificial Intelligence and Software & SaaS. TechTimes is an independent Australian technology and business publication, published by GrowBizNest. Every article has a named author, and facts are checked against primary sources such as manufacturer documentation.
How can I get new TechTimes robotics guides by email?
Subscribe to the Briefing, the free TechTimes newsletter, which delivers five stories that matter to Australian business and tech every weekday at 7am AEST. If you have built an interesting robot or have expert knowledge to share, you can pitch an original, unpublished, on-topic article through the TechTimes Write For Us page.