This write up is meant to guide through the steps of building a simple obstacle avoidance robot. This is the simplest type of robots, as it takes very few materials and cost to build, and it’s the best form of project for first timers. Before we go into the steps, a quick definition of what robotics is.
Robotics is a branch of and an interdisciplinary field of engineering that deals on the design, construction, operation and use of robots, which could either be programmable or autonomous (AI controlled), and capable of undertaking various tasks that would otherwise be performed by humans. This branch of engineering integrates mechanical, electrical, and computer engineering.
On the other hand, an obstacle avoidance robot is a type of autonomous robot that works effectively with the aid of sensors to basically detect obstacles and then maneuver its way around them as well as carry out other tasks. This type of robot can be programmed to avoid said obstacles or perform some actions proceeding the reading from an ultrasonic sensor. The image below is an example of an obstacle avoidance robot.
Fig.1 An obstacle avoidance robot.
This write up is targeted at those who are looking to build their own robots for the first time, or those who are looking to build something very simple such as an obstacle avoidance robot. Well, which ever category you fall into, here are the details of how to build your own, precisely an Autonomous wheeled robot. The necessary steps are listed below and would be explained subsequently.
Before you begin your robot just like every other project, it is quite important to identify and source the materials needed for it before you proceed, as this gives you a clear vision of what is or not possible in order to bring it to live. In this case, for my simple obstacle avoidance robot, the material encompass both mechanical and electrical materials, and here are the most fundamental materials necessary for it.
These are motors accompanied by series of connected gears attached to the motor in order to give it more torque, therefore more powerful movement is achieved. In this case, I had to hack the SG90 servo motor in order to fit my plan for my autonomous robot.
These are similar to geared motors, but they come with potentiometer and some with a limit, meaning they are mostly limited by the degree of rotation (180 degrees) although some can rotate 360 degrees non-stop. In this case I used a restricted type like the SG90 servo motor. The SG90 has got 3 cables, which are VCC (red), Signal (yellow or white) and Ground (black or brown).
This is a circuit board containing microprocessors or microcontroller that enables you to interface mechanical, electrical and computer language. This is a quick way for engineers, hobbyist, and students to learn and test their projects rapidly. Examples are Arduino, Raspberry pi, ESP32. In this case I used Arduino Uno.
Fig.4. Arduino Uno
This is a bare circuit board that enable you to make circuit connections with electrical components, such as resistors, potentiometers, LEDs, and any other component you might need. This is quite optional, as connections can be made without the board for this project.
The Ultrasonic sensor is a component that takes readings of distances using sound waves and then sends those raw data to the development board, which is then interpreted by the Arduino/computer language interface for the required output. The output could be to stop or start the robot or any other activity. In this case I used the HC-SR04.
Fig.6. Ultrasonic sensor HC-SR04
The motor driver is meant to interface the motors to the Arduino board with the aid of jumper wires, this gives control over the motor, such directions, speed and any other actions.
This is the power supply for the whole setup, majorly two li-ion (lithium ion) batteries connected series for more voltage value. In this case, I used two 18650, 3.7v, 3200mAh, lithium-ion batteries connected in series.
Fig.8. DC 18650, 3.7v, 3200mAh, Li-ion battery
This is a step down module that enables you to step down higher value of voltage to a lower value for component such as Arduino Uno, servo motors, gear motors, ultrasonic sensors and LCD. The two batteries connected in series give a total voltage of 7.4v, while most of the component use between 5v – 6v. Stepping down the voltage with a DC-DC buck converter helps to prevent damages of voltage sensitive components mention earlier.
Fig.9. DC-DC buck converter, voltage stepdown module LM2596
This is a display unit for your setup, showing what activity the robot would engage in at any point in time. In some cases, the LCD comes along with a backpack, which purpose is to reduce the number of pin (12pins) from the LCD to 4 pins in order to connect to the Arduino Uno with just 4 pins.
Fig.11. 16*2 I2C LCD and Backpack
These are small electrical wires with male – male, female –male, female – female end points for easy connection from one component to another. In this case I used all three type of endpoint jumper wires for different connection points.
Fig.12. Female – female jumper wires
This is a chassis or structure that holds the whole setup together, both mechanical and electrical components. In this case I 3d printed the inner chassis holding all the component and then gave the whole setup an enclosure, giving it a more presentable outward appearance.
Fig.13. Wheel robot frame
These are set of small tires for mobility of the robot, which could be two (with a ball caster) or four depending on your choice. In this case I used two 3d printed wheels and a ball caster for the support.
Fig.14. Robot wheels
The next step is to build the frame of your robot, and this depends on the type of robot you want to build, and since we are looking at an Autonomous wheeled robot, we assemble the frame and attach a wheel to it after adding the necessary components. These frames could either be a ready-made one from a store, or a DIY robot frame. In this case I not only built a customize frame, but also built an enclosure for my Autonomous wheeled robot, using 3d modelling tools (Fusion 360) and 3d printing. Below are the steps I took for that.
The first step is to launch your 3d CAD software, like SolidWorks, Fusion 360, or Onshape, depending on what you can use. In this case, I chose to use Autodesk Fusion 360, because the project was a very simple one, and also I wanted fluidity with the sleek enclosure. I imported the CAD file of the required components (both mechanical and electrical).
Fig.15. Servo motors CAD files
Fig.16. Other CAD components
The next step was modelling around the imported CAD files of the components, with surface and solid modelling techniques. This helps me to avoid tolerance issue and collision of components with the enclosure during assembly.
Fig.17. Surface modelling of enclosure
Fig.18. Surface modelling of enclosure contd
Fig.19. Robot head enclosure in progress

Fig.20. Robot head enclosure in progress contd.
Fig.21. Section analysis of 3d model front

Fig.22. Section analysis of the 3d model back

Fig.23. Transparent front view

Fig.24. Transparent back view
After the 3d modelling was done, I exported individual files of the frame and enclosure in STL format and prepared them for 3d printing.

Fig.25. STL file export in progress

Fig.26. STL file being sliced for 3d printing
After the 3d printing procedure, the next thing I did was assemble the frame or chassis together and arrange all mechanical and electrical component together. First the frame modules come together and then the mechanical components such as motors, and wheels, followed by the electrical components such as Arduino Uno, DC-DC buck converter, Motor driver, Ultrasonic sensor, LCD, batteries and jumper wires. Below is the full procedure of both mechanical and electrical connections of the assembly.
The first thing I did was assemble the 3d printed frame together and then afterwards added the mechanical and electrical components. Images below shows the results.
Fig.27. Components assembly
Fig.28. Enclosure assembly
Next I did all the electrical connections, interfacing all the components together using jumper wires. Below is a schematics of the connections

Fig.29. Autonomous wheeled obstacle avoidance robot schematics
To step down the voltage from 7.4V to 5V, turn the potentiometer on the DC-DC buck converter until the reading of your multi-meter shows 5V. The potentiometer is the screw head structure on the blue cuboid on the buck converter
The last stage of assembly was covering the whole setup with the 3d printed enclosure. See images below.
Fig.30. Front view assembly with 3d render
Fig.31. Back view of assembly
The final stage is to write, run and upload computer language programme. In this case, I made use of Arduino IDE which uses of C++ or C# programming language as its bases of codes. The code was uploaded via a USB cable connected to the computer at a certain port. See images below of the Autonomous wheeled robot at work.
Fig.32. Computer program upload in progress
Fig.33. Robot ready to be activated
An example of a typical Arduino code is written below, you can copy and paste in your Arduino IDE programme:
// Autonomous Wheeled Robot Code with I2C LCD
// Updated: Added reverse mode and idle animation
#include <Servo.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Motor driver pins
const int AIN1 = 7;
const int AIN2 = 6;
const int BIN1 = 4;
const int BIN2 = 5;
const int PWMA = 3;
Copied✓