All projects

Personal project

ROS 2 Differential-Drive Robot from Scratch

My first robot built from the ground up: wiring, power and motor control, driven over ROS 2.

  • Hardware

My contributions

  • Built a two-wheel differential-drive robot from scratch, through two hardware prototypes.
  • Wired the power and motor electronics, and linked a Raspberry Pi 4 to an Arduino Uno over UART.
  • Ran ROS 2 across a host PC and the Pi, with keyboard teleoperation driving the motors.

My first attempt at building a working robot on real hardware, from the chassis up. The software is deliberately simple, keyboard teleoperation; the point was to learn the electronics: power, motor drivers, wiring and getting a computer to talk to a microcontroller reliably.

Driving the robot with ROS 2 keyboard teleoperation.

Hardware

Two DC motors with rubber wheels and a castor, on a two-layer acrylic body. The first prototype drove the motors through an L298N driver from a separate 7 V supply, with a 12 V power bank for the electronics. The second swapped in an Arduino motor shield, which performed better and simplified the wiring.

How it talks

ROS 2 runs on both a host PC and an onboard Raspberry Pi 4 on the same network. A teleoperation node on the PC maps W, A, S and D to drive commands and publishes them on a topic. A node on the Pi subscribes and forwards each command over UART to an Arduino Uno, which sets the motor speeds and directions.

From keyboard to wheels: host PC, Raspberry Pi, Arduino and motor driver.
From keyboard to wheels: host PC, Raspberry Pi, Arduino and motor driver.

The robot was also modelled in URDF for simulation in Gazebo. Encoder feedback and a PID speed loop were the planned next step.