Obstacle Avoiding Robot Car Using Arduino

by Autobotix in Circuits > Robots

32 Views, 0 Favorites, 0 Comments

Obstacle Avoiding Robot Car Using Arduino

WhatsApp Image 2025-06-04 at 5.03.32 PM.jpeg
WhatsApp Image 2025-06-04 at 5.03.32 PM.jpeg
WhatsApp Image 2025-06-04 at 5.04.53 PM.jpeg
WhatsApp Image 2025-06-04 at 5.08.38 PM.jpeg
WhatsApp Image 2025-06-04 at 5.06.53 PM.jpeg

In this exciting DIY project, we’ll build an Obstacle Avoiding Robot Car using Arduino and an ultrasonic sensor. This smart robot is designed to navigate its environment autonomously by detecting and avoiding obstacles in real-time, making it a fantastic learning experience for robotics enthusiasts, beginners, and engineering students.

What Makes This Project Awesome?

  1. Autonomous Navigation: The robot uses an ultrasonic sensor (HC-SR04) to continuously scan the path ahead. When it detects an obstacle, it automatically stops, turns, and finds a clear path without any manual intervention.
  2. Simple & Affordable Components: Built with widely available parts like Arduino Nano, L293D motor driver, ultrasonic sensor, and DC motors, this project is budget-friendly and easy to assemble.
  3. Reuses Existing Chassis: We’ll be using the same robust chassis from the previous hand gesture-controlled car project, saving time and enhancing modularity.
  4. Hands-On Learning: This project teaches the basics of sensor integration, motor control, and embedded programming, perfect for students working on robotics mini-projects or science exhibitions.
  5. Expandable Platform: The design is flexible, allowing you to add features like Bluetooth control, line following sensors, or even voice commands in the future.

How It Works

The ultrasonic sensor emits high-frequency sound waves and measures the time taken for the echo to return after hitting an object. This distance data is sent to the Arduino, which decides whether to keep moving forward or take evasive action by controlling the motors through the L293D driver. The logic is simple yet effective, ensuring the car can avoid obstacles and continue its journey smoothly.


You can purchase the complete Autobot car kit used in this project here to get all the mechanical components in one package.

Supplies

Components List for Obstacle Avoiding Robot Car Project

  1. Auto-Botix Robot Chassis (with wheels, screws, and spacer pack)
  2. BO Motors (Straight or geared) x 2
  3. Wheels (Compatible with BO Motors) x 2
  4. Lithium-Ion Cells (e.g., 18650, 3.7V) x 2
  5. 2-Cell Battery Holder (for Lithium-Ion Cells, 2A rated) x 1
  6. Custom Built PCB (for clean wiring and component mounting)
  7. Arduino Nano (main microcontroller for processing sensor data and controlling motors)
  8. Ultrasonic Sensor (HC-SR04) (for obstacle detection and distance measurement)
  9. ⚙️ L293D Motor Driver IC (to drive and control the DC motors)
  10. Screws, Nuts, and Spacers (for assembly and mechanical support)
  11. Jumper Wires and Connectors (for electrical connections)

Gather All Mechanical Parts

WhatsApp Image 2025-05-29 at 1.29.21 PM.jpeg

Before starting the assembly, make sure you have all the mechanical components of the car ready. As shown in the image above, collect the chassis plates, wheels, BO motors, screws, spacers, battery holder, and other necessary mounting hardware. This step will help ensure a smooth and efficient assembly process.


Want to skip the hassle of collecting parts?

🚗 Buy the Complete Obstacle Avoiding Car Kit


Attach the BO Motor to the Side Panel

WhatsApp Image 2025-05-29 at 1.30.54 PM.jpeg
WhatsApp Image 2025-05-29 at 1.30.54 PM (1).jpeg
WhatsApp Image 2025-05-29 at 1.30.55 PM.jpeg

In this step, mount the BO motor onto one of the side panels using screws. Align the motor shaft with the cutout on the panel, and fix it securely using two screws through the mounting holes on the motor. Make sure the motor wires are facing outward for easy connection later.

Repeat this process for the second motor on the opposite panel.

Attach the Side Panel to the Base Panel

WhatsApp Image 2025-05-29 at 1.49.52 PM.jpeg
WhatsApp Image 2025-05-29 at 1.49.52 PM (1).jpeg
WhatsApp Image 2025-05-29 at 1.49.52 PM (2).jpeg

Now, it's time to assemble the car frame. Take the side panel with the attached BO motor and align it with the slot on the black base panel as shown in the image. Carefully slide the side panel into the corresponding slots and secure it using screws or spacers if needed.

Make sure the motor wires are facing inward toward the base so they can be easily routed later during wiring.

Repeat this step for the other side panel in the next step.

Attach the Top Panel to the Side Panels

WhatsApp Image 2025-05-29 at 2.21.06 PM.jpeg
WhatsApp Image 2025-05-29 at 2.36.49 PM.jpeg
WhatsApp Image 2025-05-29 at 2.36.49 PM (1).jpeg

Once both side panels are properly mounted to the base, it's time to secure the top frame. Take the curved black panel (top panel) and align its slots with the tabs on the yellow side panels.

Gently press the top panel down into the side panels until it locks firmly into place. Ensure both BO motors and wires are properly enclosed and that nothing is obstructing the fit.

Fixing the Middle Side Panel

WhatsApp Image 2025-05-29 at 2.54.39 PM.jpeg
WhatsApp Image 2025-05-29 at 2.54.38 PM.jpeg

In this step, the middle side panels are inserted vertically between the upper panel and the base panel. Carefully align the notches and slots provided on both the upper and base panels, and gently slide the middle side panels into place so that they are firmly seated. It is important to ensure that both side panels are parallel and symmetrical to maintain the structural balance of the assembly. Also, double-check the clearance for the wires to ensure they can be routed properly without any obstruction. Make sure the panels are fully inserted and not slanted, as any misalignment at this stage can cause issues during the fitting of the remaining components.

Attaching the Front Eye Component

fbed20b594f2f985628b0c61e5913661d1823731.jpeg
WhatsApp Image 2025-06-04 at 5.13.31 PM.jpeg
WhatsApp Image 2025-06-04 at 5.13.31 PM (1).jpeg
WhatsApp Image 2025-06-04 at 5.13.31 PM (2).jpeg
WhatsApp Image 2025-05-29 at 3.01.59 PM.jpeg
WhatsApp Image 2025-06-04 at 5.13.31 PM (3).jpeg
WhatsApp Image 2025-06-04 at 5.13.32 PM.jpeg

In this step, the front eye component is attached to the front side of the car chassis. Although it includes slots designed to hold an ultrasonic sensor, the current version of the project does not utilize the sensor. However, this feature can be used in an upgraded version if obstacle detection is required. Align the component with the designated cutouts on the front panel and securely insert it into place. Ensure it fits properly and is firmly held, as this component forms part of the car’s structural frame and can support future sensor installations.

Fixing All Screws With Spacers

WhatsApp Image 2025-05-29 at 3.08.33 PM (2).jpeg
WhatsApp Image 2025-05-29 at 3.08.33 PM (1).jpeg
WhatsApp Image 2025-05-29 at 3.08.33 PM.jpeg

In this step, all the necessary screws are fixed throughout the car’s structure to firmly secure each component in place. Where required, spacers are added between layers or panels to maintain proper alignment and provide structural stability. These spacers help ensure that the chassis remains evenly assembled and allow enough clearance for wiring or future component additions. Make sure each screw is tightened appropriately, but avoid over-tightening to prevent damage to the material. This step completes the mechanical assembly of the car chassis, making it ready for further electronic integration.

Attaching the Wheels to BO Motors

WhatsApp Image 2025-05-29 at 3.16.18 PM.jpeg
WhatsApp Image 2025-05-29 at 3.16.18 PM (2).jpeg

In this step, the wheels are carefully placed onto the shafts of the BO motors on both sides of the car. Ensure that the wheels are firmly pressed onto the motor shafts so that they fit snugly and rotate without slipping. This provides the car with the necessary traction for movement. Make sure both wheels are aligned properly to maintain balance and allow smooth, straight motion. With the wheels attached, the basic mobility setup of the car is now complete.

Placing the Castor Wheel on the Front Side of the Base Plate

WhatsApp Image 2025-05-29 at 3.24.36 PM.jpeg
WhatsApp Image 2025-05-29 at 3.24.36 PM (1).jpeg

In this step, the castor wheel is mounted onto the front side of the base plate. The castor wheel provides support and balance to the car, allowing it to turn smoothly while maintaining stability. It is positioned at the front side of the base, opposite the side where the BO motors and wheels are attached. Secure the castor wheel using appropriate screws, ensuring it can rotate freely. This completes the three-wheel configuration of the car chassis.

Assembling All Electronics on the Chassis

WhatsApp Image 2025-06-04 at 5.37.45 PM.jpeg
WhatsApp Image 2025-06-04 at 5.30.03 PM.jpeg
WhatsApp Image 2025-06-04 at 5.33.49 PM.jpeg

In this step, we will gather all the electronic components and securely mount them onto the Auto-Botix chassis. Proper placement and wiring are crucial for the stable operation of the robot.

🧰 What to Do:

  1. Place the Custom PCB on the top platform of the chassis. Use screws and spacers to fix it securely.
  2. Connect the DC Motors to the motor terminals of the L293D driver. Use screw terminals or solder wires firmly.
  3. Secure the 2A Battery Holder on the lower platform or the rear of the chassis using double-sided tape or cable ties.
  4. Place the Lithium-Ion Cells into the holder and double-check polarity to avoid short circuits.
  5. Connect all jumper wires from the sensor, Arduino, motor driver, and power supply according to your circuit diagram.
  6. Neatly arrange and bundle the wires to avoid tangling or pulling during movement.


Powering Up and Final Check ✅

WhatsApp Image 2025-06-04 at 5.41.40 PM.jpeg
WhatsApp Image 2025-06-04 at 5.41.40 PM (1).jpeg
WhatsApp Image 2025-06-04 at 5.41.40 PM (2).jpeg

Now that all the electronics are mounted and wired, it’s time to bring your robot to life! In this step, we'll connect the batteries to the circuit and perform a complete system check before uploading the final code.

⚡ What to Do:

  1. Insert the Lithium-Ion Cells into the battery holder carefully. Ensure correct polarity (+ and -).
  2. Connect the Battery Holder Wires to the power input terminals of your custom PCB or directly to the VIN and GND pins of the Arduino (depending on your setup).
  3. Double-check all connections:
  4. Make sure motor wires are connected to the L293D outputs.
  5. Verify ultrasonic sensor connections to Arduino (VCC, GND, Trigger, Echo).
  6. Confirm Arduino and motor driver are powered properly.
  7. Look for any loose wires or short circuits before switching on power.
  8. Once you're confident everything is connected properly, turn on the power by switching on the battery (or inserting the plug).
  9. Check for indicator LEDs (on Arduino or custom PCB) to confirm the system is receiving power.


Test Your Obstacle Avoiding Robot! 🚗💨

WhatsApp Image 2025-06-04 at 5.06.53 PM.jpeg

Now that everything is wired up and powered correctly, and your code is uploaded — you’re ready to bring your robot to life!

🛠️ What to Do:

  1. Place your robot car on a flat surface with enough space to move freely.
  2. Power on the robot by connecting the battery or turning on the switch.
  3. Place an obstacle (like a box, hand, or bottle) in front of the ultrasonic sensor.
  4. Watch as the robot automatically stops and changes direction to avoid the obstacle!

🧠 What to Expect:

  1. The car should move forward freely until it detects an obstacle.
  2. Once an object is detected within a certain range (e.g., 15–20 cm), the car will stop, turn, and choose a new direction.
  3. It will continue navigating around obstacles without any manual input.