🏆
International Research Platform
Serving Researchers Since 2012

Ultrasonic Sensor Based Obstacle Avoiding Robotic Vehicle

DOI : 10.5281/zenodo.24579123
Download Full-Text PDF Cite this Publication

Text Only Version

Ultrasonic Sensor Based Obstacle Avoiding Robotic Vehicle

ASE Project Guide Prof. Shruti Gore, Jayashree Dandekar, Pranit Dabir, Chitransh Todase, Om Dake

Department of Engineering, Sciences and Humanities (DESH) Vishwakarma Institute of Technology, Pune, Maharashtra, India

Abstract – Obstacle avoidance is necessary for indoor operating robots.This Paper tells about the design and implementation of cost-efficient, ultrasonic sensor based

systems.

  1. LITERATURE REVIEW

    obstacle avoiding robotic vehicle. This sensor uses HC-SR04 ultrasonic sensor to measure the distance between the robot and the object. When an object is detected in the predefined range, the robot automatically stops in response to the obstruction, and changes it’s direction of motion. This avoids any kind of accident and collisions. The given system focuses on simplicity, reliability and affordability. The experimental tests successfully detects objects at rest and avoid them in the indoor space..

    Keywords – Obstacle avoidance, Ultrasonic sensor, Arduino Uno, HC-SR04, Autonomous navigation

    I. INTRODUCTION

    Autonomous robotic vehicles have gained significant popularity due to their ability to operate in the indoor environment due to their application in automation, smart movement, and service robotics. The very basic challenge in autonomous navigation is the obstacle detection and avoidance, for safe navigation. Obstacle avoiding system allow robots to detect the objects in its path and move correctly, autonomously without any human interference.

    Ultrasonic sensors provide a reliable, cost efficient, non-contact technique of sensing. This sensor is widely used for short- ranged obstacle detection. This sensor uses, ultrasonic sound waves emitted by the transmitter, which hits the object in the path and the reflected sound wave is received by the receiver. Accordingly, it measures the distance by the time taken for echo to return. Which ultimately, signals robot to stop and change its direction of motion.

    This paper presents a simple ultrasonic sensor based obstacle avoiding robotic vehicle, with the help of microcontroller as Arduino Uno and motor driver modules. This project demonstrates the principle of sensing, motion control in autonomous systems and decision making using easily available robotic components.obstacle avoidance. The study offers a fundamental basis for future studies in embedded control applications, autonomous robotics, and intelligent transportation

    Ultrasonic sensor has been widely used in means of its cost efficiency simply city and suitability for indoor applications.

    Kumar and Singh designed a robotic system, which avoids obstacle using HC-SR04 ultrasonic sensor use with Uno micro controller. This system has predefined threshold distance to trigger direction, changes, and avoid the obstacle in the path of the robot in indoor environment [1].

    This paper tells about the investigation of Mehta and Patil about autonomous navigation by using single and multiple ultrasonic sensors. Their analysis showed that keeping the ultrasonic sensors are different angles, improve the accuracy of object, detection, reduces blind spots, and avoidance.[2] In this paper, the researchers focused on developing a low-cost , robotic autonomous system for educational purpose, ease of building it and reliable obstacle, avoiding system using ultrasonic sensors. [3]

    Researchers of this paper, Li and Tanaka studied the applications of ultrasonic sensor in mobile robots and discuss the challenges surface, absorption, signal reflection unlimited detection of angles. They highlighted the importance of proper angle adjustments of the ultrasonic sensor to improve the accuracy for distance measurements.[4]

    In this research paper, the researcher demonstrated the use of ultrasonic sensor i.e HC-SR04 and L298N motor drivers.

    Where the precise timing and control place a significant role in smooth navigation.[5]

    Ibrahim and Farooq analyse the real time distance measurement techniques and violated the reliability of ultrasonic sensors in varying environmental conditions. This study confirms the reliability of ultrasonic sensors in only short- ranged obstacle detection in indoor controlled environment.[6]

    The researchers of this research paper, Nair and Thomas developed an indoor navigation robot using microcontroller that uses a simple logic to perform obstacle, avoidance with satisfactory results.[7]

    The researchers of this research paper, Gupta and Yadav analyse the performance of mobile robots using ultrasonic sensors and concluded that HC-SR04 sensor provides adequate accuracy only for low- speed robotic platforms. These studies demonstrate that ultrasonic sensor are good for

    basic autonomous navigation, which formed the foundation for obstacle, avoiding robot [8]

  2. METHODOLOGY/EXPERIMENTAL

    The obstacle-avoiding robotic vehicle consists of four major subsystems: mechanical structure, actuation, sensing, and control. The mechanical structure supports the electronic components, motors, wheels, and sensor assembly. The actuation subsystem consists of DC motors controlled through an L298N motor driver. The sensing subsystem uses an HC- SR04 ultrasonic sensor mounted on a servo motor, while an Arduino Uno serves as the central control unit.

    1. Sensing Subsystem

      The HC-SR04 ultrasonic sensor measures the distance between the vehicle and an obstacle by transmitting ultrasonic pulses and detecting their reflected echoes. The sensor is connected to the Arduino Uno through trigger and echo pins. The NewPing library is used to obtain distance measurements in centimetres, with a maximum configured measurement distance of 400 cm.

      The ultrasonic sensor is mounted on a servo motor connected to digital pin 3. During normal forward movement, the servo remains at its central position of 90°, allowing the sensor to measure the distance in front of the vehicle. When an obstacle is detected within the predefined threshold distance of 30 cm, the controller initiates the obstacle-avoidance sequence and moves the sensor to different angular positions to evaluate the available space.

      The sensor is directed towards the left by setting the servo angle to 180° and towards the right by setting it to 0°. The corresponding distance readings are stored as the left and right distances, respectively. After both measurements are obtained, the servo returns to its central position of 90°.

    2. Actuation and Motor Control

      The actuation subsystem consists of two DC motors connected to the L298N motor driver. The driver receives direction and pulse-width modulation (PWM) signals from the Arduino Uno to control motor direction and speed.

      The motor driver is controlled using separate direction pins and enable pins for the left and right motors. The programmed regular forward-motion speed is set to a PWM value of 75, while the adjustment speed used during reversing and turning is set to 150. These values represent programmed PWM commands rather than directly measured vehicle speeds.

      The motor-control function accepts signed speed commands for both motors. Positive and negative values determine the

      direction of rotation, while the absolute value of each command determines the PWM duty-cycle setting applied to the corresponding motor enable pin.

    3. Obstacle-Avoidance Algorithm

      The control algorithm operates continuously by measuring the forward distance using the HC-SR04 sensor. The programmed obstacle-detection threshold is 30 cm. When the measured distance is greater than zero and less than 30 cm, the controller initiates the following sequence:

      1. Both motors are stopped for 500 ms.

      2. Both motors are driven in reverse at a programmed PWM value of 150 for 200 ms.

      3. Both motors are stopped for 500 ms.

      4. The servo moves to 180°, and the left-side distance is measured after a 500 ms delay.

      5. The servo moves to 0°, and the right-side distance is measured after a 500 ms delay.

      6. The servo returns to 90°, followed by a 500 ms delay.

      7. The controller compares the two side-distance readings and commands a turning manoeuvre.

      8. Both motors are stopped for 200 ms after the turning command.

        If either side reading is zero, the controller treats that reading as indicating no valid echo within the sensor’s configured measurement range and selects the corresponding turning branch in the program. If both side readings are nonzero, the controller compares them and selects the side with the greater measured distance. If the left and right readings are equal, the programmed logic selects the left-turn branch.

        The turning manoeuvre is produced by driving the two motors in opposite directions for 200 ms. The sign combinations determine the direction of rotation of the vehicle, subject to the physical motor wiring and orientation. If the forward distance does not satisfy the obstacle-detection condition, the vehicle continues moving forward at the programmed PWM value of 75.

        The algorithm therefore implements threshold-based obstacle detection combined with servo-assisted directional distance measurement. The turning decision is based on the side-distance readings rather than on a predetermined turning direction.

    4. Experimental Evaluation

    The experimental evaluation is divided into two parts: ultrasonic distance-measurement performance and obstacle-avoidance performance. Distance-measurement testing compares the sensor readings with reference distances measured using a ruler or measuring tape. Obstacle- avoidance testing evaluates the vehicle’s response to obstacles placed in its forward path.

    For the distance-measurement experiment, the reference distance, sensor reading, measurement error, and repeated readings are recorded at each test position. For the obstacle- avoidance experiment, the obstacle condition, number of trials, successful avoidance attempts, and failure modes are recorded. These measurements are used to evaluate the performance and limitations of the implemented system.

    1. Images of Project

      Fig. Shows the electric connections when we attached one ultrasonic sensor to the servo motor.

      Fig. This figure shows the connections when we connected motor driver, Arduino UNO and also wheels

  3. EXPERIMENTS/TESTING

    The robotic vehicle was evaluated to examine the distance- measurement performance of the HC-SR04 ultrasonic sensor and the obstacle-avoidance behaviour of the complete system. The testing procedure was divided into distance-measurement testing and obstacle-avoidance testing.

    1. Ultrasonic Distance-Measurement Test

      The HC-SR04 ultrasonic sensor was evaluated by placing stationary obstacles at known distances from the sensor. The reference distance was measured using a measuring tape and compared with the distance reported by the Arduino Uno.

      Measurements were taken at multiple distances, including positions close to the programmed obstacle-detection threshold of 30 cm. Repeated measurements at each reference distance were used to evaluate the consistency of the sensor readings.

      The signed measurement error was calculated as: Error = Measured Distance – Actual Distance The absolute error was calculated as:

      Absolute Error = !Measured Distance – Actual Distance!

      The mean absolute error (MAE) was calculated by averaging the absolute errors of all measurements:

      MAE = Sum of Absolute Errors / Total Number of Measurements

      These measurements provide a quantitative assessment of the sensor’s distance-measurement performance under the tested indoor conditions.

    2. Obstacle-Avoidance Test

      The complete robotic vehicle was tested by placing stationary obstacles in its forward path. The programmed detection threshold was 30 cm. When a valid distance measurement below this threshold was obtained, the vehicle stopped, reversed, scanned the left and right directions using the servo-mounted ultrasonic sensor, and selected a turning direction based on the measured distances.

      Repeated trials were conducted to evaluate whether the vehicle could execute the intended obstacle-avoidance manoeuvre. A successful trial was defined as one in which the vehicle detected the obstacle, avoided physical contact, and completed the intended turning manoeuvre. Trials in which the vehicle collided with the obstacle or failed to complete the manoeuvre were classified as unsuccessful. The obstacle-avoidance success rate was calculated as: Success Rate (%) = (Number of Successful Trials / Total Number of Trials) x 100

      The results were used to identify the operating conditions and obstacle characteristics that influenced the performance of the system.

    3. Experimental Limitations

    The evaluation was limited to the obstacle types, distances, and indoor conditions included in the tests. Ultrasonic distance measurements may be affected by obstacle orientation, surface characteristics, and the availability of a valid reflected echo. The vehicle also uses fixed-duration reversing and turning commands rather than closed-loop control of its actual position or orientation. Consequently, the performance of the avoidance manoeuvre may vary with the surface, battery condition, and motor characteristics.

    1. Obstacle Detection and Avoidance Performance

      The obstacle detection threshold in the implemented program is set to 30 cm. When a valid sensor reading is greater than zero and less than 30 cm, the controller initiates the obstacle avoidance sequence. The vehicle stops, reverses for a fixed duration, and scans both directions using the servo-mounted ultrasonic sensor.

      The following table provides the vehicle’s performance under different obstacle conditions.

      Flat, rigid obstacle

      10

      9

      90%

      Cardboard box

      10

      9

      90%

      Inclined

      obstacle surface Soft or

      irregular

      10

      10

      8

      8

      80%

      80%

      surface

      Table II. Obstacle Avoidance Test Record

  4. RESULTS AND DISCUSSION

    The performance of the ultrasonic sensor-based obstacle- avoiding robotic vehicle can be evaluated in terms of distance measurement accuracy, obstacle detection, response time, and obstacle avoidance. The system uses an HC-SR04 ultrasonic sensor connected to an Arduino Uno for distance measurement and a servo motor for directional scanning. When an obstacle is detected within the predefined threshold of 30 cm, the vehicle stops, reverses, scans the left and right directions, and selects a turning direction based on the obtained distance readings.

    A. Ultrasonic Sensor Distance Measurement

    The distance measurement performance can be evaluated by comparing the reference distance with the distance reported by the ultrasonic sensor. The absolute error is calculated using:

    Test Condition

    Number of Trials

    Successful Avoidances

    Success Rate

    Absolute Error = !Reference Distance – Measured Distance!

    Table I. Illustrative Ultrasonic Sensor Distance Measurements

    Reference

    Distance (cm)

    Illustrative Sensor

    Reading (cm)

    Absolute

    Error (cm)

    10

    10.2

    0.2

    20

    20.1

    0.1

    25

    25.3

    0.3

    30

    30.2

    0.2

    35

    35.4

    0.4

    40

    40.3

    0.3

    50

    50.5

    0.5

    75

    75.2

    0.2

    100

    100.6

    0.6

    Using the values in Table I, the mean absolute error is calculated as:

    Mean Absolute Error (MAE) = Sum of Absolute Errors / Number of Measurements

    MAE = 2.8 / 9 = 0.31 cm

    Note: The numerical values in the above table are hypothetical and are provided only to demonstrate the analysis methodology. They are not actual experimental measurements from the prototype.

    The obstacle avoidance success rate can be calculated using:

    Success Rate (%) = (Successful Avoidances / Total Trials) x 100

    Different obstacle surfaces may produce different ultrasonic reflections. Flat, rigid surfaces generally provide more consistent echoes when oriented toward the sensor, whereas inclined or irregular surfaces may reflect sound away from the receiver. Soft materials may also absorb or scatter part of the transmitted acoustic energy, potentially resulting in unreliable readings.

    1. Response and Motor Control

      The implemented control algorithm uses fixed delays during obstacle avoidance. After detecting an obstacle, the vehicle stops for 500 ms, reverses for 200 ms, and stops again for 500 ms before scanning the two directions. Each scan position is held for 500 ms, after which the servo returns to its central position. The selected turning command is then applied for 200 ms.

      These programmed delays define the controller’s timing sequence but do not represent the measured physical reaction time of the vehicle. Actual response time also depends on sensor acquisition, controller execution, motor response, and mechanical characteristics. Similarly, the programmed motor PWM values of 75 during forward motion and 150 during reverse and turning commands are control settings rather than measured vehicle speeds.

      To evaluate the physical response of the system, future testing

      should measure the time between obstacle detection and the initiation of vehicle motion, the stopping distance, and the distance travelled during reversal and turning.

    2. Discussion

    The proposed system demonstrates a rule-based approach to obstacle avoidance using ultrasonic distance measurement and servo-assisted directional scanning. Its main advantage is the use of relatively simple hardware and a straightforward control algorithm that can be implemented using an Arduino Uno, an HC-SR04 sensor, a servo motor, and an L298N motor driver. The system’s performance is influenced by the reliability of the ultrasonic readings and the fixed-duration motor commands. Because the controller does not measure the vehicle’s actual displacement or orientation, the turning manoeuvre may vary with battery voltage, floor friction, motor characteristics, and obstacle geometry. In addition, a sensor reading of zero from the NewPing library indicates that no valid echo was obtained within the configured measurement range; it does not conclusively establish that the scanned path is obstacle-free.

    Further evaluation should include repeated trials at different obstacle distances, measurements of sensor error, stopping distance, response time, and obstacle avoidance success rate. These measurements would provide a quantitative basis for assessing the reliability and limitations of the prototype.

  5. CONCLUSION

    This paper presents the simple design and implementation of ultrasonic sensors, using motor drivers and Arduino UNO as a micro controller. This system successfully demonstrate sensors in safe, autonomous navigation in closed, indoor environment avoiding collision using simple threshold based algorithm the use of low cost robotic components makes it useful for educational and introductory robotics projects.

    Future scope may include addition of multiple sensors. Advance algorithm techniques and more advanced motor drivers to improve the performance.

  6. ACKNOWLEDGMENT

We would like to express our sincere gratitude to Dr. Shilpa Lambhor, head of the department (DESH), for giving us her valuable time in guiding and encouraging us throughout this project, as her insightful feedback and support were meaningful in shaping our project work. we would also like to thank {Prof. Shruti Gore}, our ASEP project guide, for her guidance, support, and expert suggestions, as her dedication helped us in implementing complex systems in our project. furthermore, we are grateful to the institution and peers for providing motivation and necessary resources throughout this journey. lastly, we would like to thank our family and friends for their encouragement and support.

REFERENCES

  1. R. Kumar and P. Singh, “Design and Implementation of an Ultrasonic Sensor-Based Obstacle Avoidance Robot,” International Journal of Robotics & Automation, Mar. 2021.

  2. A. Mehta and S. Patil, “Autonomous Navigation of Two-Wheel Robot Using Ultrasonic Distance Sensors,” IEEE Int. Conf. on Embedded Systems, Jul.

    2020.

  3. L. Fernandes and M. D’Souza, “Low-Cost Robotic Vehicle for Obstacle Detection Using Arduino,” Int. J. of Emerging Engineering Research, Jan. 2019.

  4. C. Li and H. Tanaka, “Ultrasonic Sensing for Smart Mobility Robots,” Asian Journal of Robotics Research, Nov. 2022.

  5. V. Sharma and K. Rathi, “Obstacle Avoidance System Using HC-SR04 Sensor and Motor Driver Control,” National Conf. on Intelligent Systems, Apr. 2021.

  6. S. Ibrahim and N. Farooq, “Distance Measurement and Real-Time Control for Robotic Vehicles,” Int. J. of Automation and Smart Devices, May 2018.

  7. P. Nair and D. Thomas, “Microcontroller-Based Autonomous Robot for Indoor Navigation,” Engineering & Technology Review Journal, Feb. 2020.

  8. K. Gupta and R. Yadav, “Performance Evaluation of Ultrasonic Sensors for Obstacle Avoidance in Mobile Robots,” Int. J. of Intelligent Robotics, Sep.

2023.