Obstacle Avoiding Robot using Ultrasonic Sensor & PIC Microcontroller - Tech Arbiters

Obstacle Avoiding Robot using Ultrasonic Sensor & PIC Microcontroller

Obstacle Avoiding Robot using Ultrasonic Sensor and Pic Microcontroller

Obstacle avoiding robot is a kind of robotic vehicle designed to avoid obstacles by using an ultrasonic sensor. The signal coming from the ultrasonic sensor lets the robot move in an appropriate direction to avoid obstacles.

During my graduation from the Manukau Institute of Technology, Auckland, New Zealand.

I have created this project. I would thank Dr. Zulfikar Hossain to supervise and moderate my project.

The embedded system is a combination of hardware and software. Today most of the machines worldwide are operating with the embedded system.

Obstacle avoiding robot is also known as autonomous robot or obstacle detection robot. This robot aims to detect anything in between the path and protect a property, a person or itself from damage.

In industry, autonomous robots are carrying the heavy load and moving it to another place. They are work according to programming and moving on the same path.

However, sometimes a person or an object comes across the robot and causes an accident. Hence, to protect from this kind of accident, obstacle avoiding robot is the best replacement in the industries.

In this article, we will see how working, designing, and application of obstacle avoiding robots.

What is an Obstacle Avoiding Robot?

Obstacle avoiding robot is a combination of electric motor and computer intelligence. Computer intelligence work on different computer programming software such as Proteus, MP Lab, Turbo C.

In this robot, a robotic vehicle looks like a robot car has an intelligence build into it. Hence, it can detect every time obstacle occurrence and move accordingly.

The autonomous robot is constructed using the pic microcontroller, ultrasonic sensor, and different electronics components.

An ultrasonic sensor is used to detect the obstacle and send commands to the pic microcontroller.

Depending on the input signal from the ultrasonic sensor, the pic microcontroller redirects the robot to move in an alternative direction as instructed to program.

For example, if the robot detects the obstacle on the right side using an ultrasonic sensor, then the robot will move the left side and vice versa.

Components Requirement to make an Object Avoiding Robot:

  1. Pic Microcontroller or Arduino
  2. Ultrasonic sensor or Infrared sensor
  3. Power regulator
  4. Robotic vehicle frame
  5. servo-motors
  6. Printed Circuit board (PCB)
  7. LCD display

The basic arrangements of the equipments to make an Object Avoiding Robot can see in the block diagram given below.

Block Diagram of Obstacle Avoiding Robot using Ultrasonic Sensor
Block Diagram of Obstacle Avoiding Robot using Ultrasonic Sensor

How to Make a Robot that can avoid obstacles?

The prime requirement of object avoiding robot is to avoid an obstacle in between the path. So, designing of the robot should remain according to work in an unknown environment with obstacles.

It should sense the obstacle in the way and need to avoid and after resumes its running. To perform this task, there are many sensors available that can gives an accurate result.

For the detection of the object and stopping the robot, some algorithms need to be used in the simulation system.

It is preferable to use real-time simulation software on the internet to avoid any hazards while using the working model.

The project proposes an autonomous robotic vehicle in which no remote is used for controlling the robotic actions.

It should intelligently detect obstacles present on its path through the sensors and decide based on the internal code that we set for it.

Here we are using a servo motor to rotate the sensor up to 180 degrees or 360 degrees. Microcontroller relates to DC motor through motor driver board which provide power to the actuators.

Afterward, actuators can move a robot in forwarding, Reverse, Left and Right directions as per requirement.

What is the Suitable Sensor for Obstacle Avoidance Robot?

There are many sensors are available to make an autonomous robot navigation system such as,

1. Ultrasonic sensor

Ultrasonic sensor sending and receiving the ultrasonic wave to the object. The timing difference between the sending and receiving sound waves gives a signal to the pic microcontroller.

According to the Timing of the signal, the pic microcontroller measures the distance. The speed of the sound in the air is constant (343 meters per second). Timing can be measure by timer interrupt in the microcontroller.

Hence, according to equation D = S*T, where D = DIstance of object, S = Speed of the Sound, T = Timing of the wave pic microcontroller measures the distance.

2. Infrared sensor (IR sensor)

An infrared sensor works on the same principle as an ultrasonic sensor, instead of ultrasonic wave infrared sensors releasing the beam of infrared lights.

After that, the pic microcontroller or Arduino receives the signal and controls the robot as per programming.

However, the infrared wave can not work properly during the sunlight. In addition, it can easily distract in the black color and not giving proper measurement.

Obstacle Avoiding Robots usually perform repetitive tasks with a heavy load, so there is a risk with the infrared sensors.

3. Laser

Laser is used in many robots to guide the path and obstacles. Multiple lasers need to mount on the body of the autonomous robot.

However, it is costly and complex as the microcontroller needs lots of programming to operate.

4. Cameras

One of the methods to guide autonomous robots for object detection is an HD camera. In this method, multiple cameras require creating images of the surrounding environment and detecting the object from the images.

It surely gives a clear image of the location, but algorithm and programming are again complex using digital cameras.

Nevertheless, it is suitable for the single site where robots need to work on the same task every time.

How do an Obstacle Avoiding Robot Works?

Ultrasonic sensor:

To avoid the obstacles the first step is to detect the obstacles. In this project, I have used an ultrasonic sensor for the detection task.

It should be on the front of the forehead part of the robot to detect objects easily. Sometimes more than two sensors are mandatory if the size of the robot is bigger.

The ultrasonic sensor consists of two parts. The emitter is the first one, which produces a 40 kHz sound wave.

While as a detector that detects 40 kHz sound waves and sends an electrical signal back to the microcontroller.

The ultrasonic sensors continuously emit the frequency signals; when a signal detects an obstacle, it is reflected in the receiver.

That signal further considers as an input signal for the microcontroller.

The ultrasonic sensor emits short and high-frequency signals. If they detect any object, they reflect an echo signal taken as input to the sensor through the echo pin.

From the flow chart given below, we can get a clear idea once the ultrasonic sensor signals to the pic microcontroller, how the microcontroller takes action to handle the robot’s directions.

Flow Chart of Obstacle Avoiding Robot using Ultrasonic Sensor
Flow Chart of Obstacle Avoiding Robot using Ultrasonic Sensor

Pic Microcontroller:

A microcontroller is an electronic component or a chip that can be programmed to perform various tasks.

In most electronics devices, from mobile phones and computers to heavy machinery, this chip controls the operations.

Pic microcontroller needs to mount on the Printed Circuit Board (PCB). The primary aim is to take Input signals from the sensors and give output signals to servo motors.

In addition, there are some algorithms and programming required to perform such tasks. It contains analog to digital conversance, arithmetic logic, and switching gates to control the robot.

Whenever the reflected signal comes to the microcontroller’s input pin, it changes to the high (1) from the low (0) flag.

The microcontroller starts timing as long as the input pin turns 0 again. It means the signal is not reflecting, and the path is clear.

If the object’s distance is moderate, then the robot’s speed gets reduced and will take a left turn; if an obstacle is present on the left side, it will take a right turn.

Likewise, if the object’s distance is short, the robot’s speed decreases and will turn in a backward direction and then go in the left or right direction.

Afterwards, it will generate a signal for the microcontroller to show the current status of the robot in the LCD.

Working Model of Obstacle Avoiding Robot using Ultrasonic Sensor and PIC Microcontroller
Working Model of Obstacle Avoiding Robot using Ultrasonic Sensor and PIC Microcontroller

What are the applications of Obstacle Avoiding Robot?

  1. Hyperautomation
  2. Security Purposes
  3. Automatic Guided Vehicle
  4. Helping Handicapped People
  5. Automatic Sprayer
  6. Research work at hazardous places.


In conclusion, the Obstacle Avoiding robot is a robotic vehicle that can move in different directions to avoid obstacles according to programming. The action of changing direction is depended on the selected path or the obstacles between tracks.

The overall efficiency of this system is much higher as the pic microcontroller precisely handles that operation. Ultrasonics sensors also play an important role to guide the robot in the right direction.

Last but not least, there are more sensors and techniques are still in developing mode to enhance the capability of these types of autonomous robots.

Leave a Comment