MyRoboPath
Mobile Robots & AMRs
Est. 5 Hours
Budget: $25 - $38

Obstacle-Avoiding Rover with Ultrasonic HC-SR04

Construct a 2-wheel drive autonomous rover that scans its surroundings with an ultrasonic distance sensor on a mini servo and navigates rooms without bumping into obstacles.

An essential milestone project for every robotics engineer! This mobile robot features a 2WD acrylic chassis, dual DC gearmotors with an H-Bridge driver, and an ultrasonic distance scanner mounted on an SG90 servo. The microcontroller measures distances, looks left and right when an obstacle is detected, and steers into the clearest path.

Bill of Materials (BOM) & Components

ComponentSpecificationsQtyEstimated Cost
2WD Smart Robot Chassis KitAcrylic base, 2x TT yellow gearmotors, 2 wheels, 1 caster wheel1$12.00
Arduino Uno or NanoATmega328P microcontroller running obstacle avoidance algorithm1$6.00
TB6612FNG or L298N Motor Driver ModuleDual H-Bridge to drive left and right DC gearmotors1$4.00
HC-SR04 Ultrasonic Sensor + SG90 Servo BracketRotates sensor 180° to scan left/right before turning1$4.50
2x 18650 Li-ion Battery Holder (7.4V) or 4x AA Battery PackPower source with master ON/OFF toggle switch1$4.00

Electrical & Architecture Summary

Arduino PWM pins control Left/Right motor direction and speed on the driver. HC-SR04 is mounted on the SG90 servo. 7.4V battery pack powers motors directly with a 5V regulated feed to the Arduino.

Figure 3: Complete wiring diagram: Battery distribution, H-Bridge motor driver, SG90 scanning servo, and HC-SR04 sensor.
Figure 3: Complete wiring diagram: Battery distribution, H-Bridge motor driver, SG90 scanning servo, and HC-SR04 sensor.Wiring Schematic

Step-by-Step Assembly & Configuration

1

Chassis & Gearmotor Assembly

Duration: 1.5 Hours

Mount the dual TT gearmotors to the acrylic chassis plate using the included metal brackets. Push on the rubber wheels and bolt the front swivel caster wheel.

Step 1: Assembled 2WD chassis with TT gearmotors and caster wheel.
Step 1: Assembled 2WD chassis with TT gearmotors and caster wheel.
Checklist:
  • Solder 100nF ceramic capacitors across motor terminals to suppress brush electrical noise.
  • Attach red and black stranded hookup wires to each motor.
  • Secure battery holder to the bottom plate for low center of gravity.
2

Mounting the Pan-Scanning Sensor Tower

Duration: 1 Hour

Mount the SG90 servo upright at the front center of the top chassis plate. Attach the HC-SR04 sensor bracket to the servo horn.

Checklist:
  • Zero the servo at 90° (facing straight ahead) before fixing the bracket with the central screw.
  • Route sensor jumper wires loosely so they do not tangle during 180° pan rotations.
3

Wiring Motor Driver and Microcontroller

Duration: 1 Hour

Connect motor outputs to the driver terminals, and interface driver logic pins (IN1, IN2, IN3, IN4, ENA, ENB) to the microcontroller digital pins.

Checklist:
  • Connect Arduino Pins: IN1 -> D4, IN2 -> D5, IN3 -> D6, IN4 -> D7.
  • Connect Servo Signal -> D11, HC-SR04 Trig -> D12, Echo -> D13.
  • Verify common ground between battery pack, motor driver, and Arduino GND.
4

Uploading Navigation & Obstacle Scanning Code

Duration: 1.5 Hours

Flash the navigation state machine: Drive forward -> Detect obstacle (<20cm) -> Stop & Reverse -> Look Left -> Look Right -> Compare distances -> Turn into clearer side.

Checklist:
  • Test motor rotational directions: verify forward command drives both wheels forward.
  • Place rover on floor and test reaction to furniture and walls.
Engineering Tip: Add a small 100ms reverse pulse before turning to prevent the rover from getting wedged against corners.