Batch 3
Batch 3
BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE & ENGINEERING-AI
Submitted By
I
(Affiliated to J.N.T. University, KAKINADA, Approved by AICTE, Accredited by NAAC)
CERTIFICATE
This is to certify that the project report entitled “RADAR-BASED OBJECT DETECTION
SYSTEM” submitted by M. Rajesh Naik(22AR5A4301), K. Keerthi (21AR1A4335), G.
Sandhya (21AR1A4320), K. Venkata Lakshmi(21AR1A4326), in partial fulfilment for the
award of the degree of “ Bachelor of Technology ” in Computer Science & Engineering is a
record Bonafide work carried out by us under the guidance and supervision during the academic
year 2024-2025 and found worthy of acceptance to requirements of the university.
II
(Affiliated to J.N.T. University, KAKINADA, Approved by AICTE, Accredited by NAAC)
DECLARATION
Place:
Date:
SUBMITTED BY
III
ACKNOWLEDGEMENT
We express our deep sense of gratitude to Dr. NALABOTHU VENKATA RAO B.V.SC.,
Chairman of TIRUMALA INSTITUTE OF TECHNOLOGY & SCIENCES satuluru, for
creating excellent academic atmosphere and providing good infrastructural facilities to us.
We express our earnest thanks to other faculty members of department of Computer Science
and Engineering for extending their helping hands and valuable suggestions when in need.
IV
ABSTRACT
Autonomous navigation and obstacle avoidance are critical aspects of modern robotics, with
applications in industries such as surveillance, automation, and smart mobility. This project focuses
on designing and implementing an Obstacle Detection and Avoidance Robot that autonomously
navigates its environment while avoiding obstacles in real time. The system is built using an
Arduino Uno microcontroller, an L293D motor driver, ultrasonic sensors, gear motors with
robot wheels, "and additional components such as a servo motor for directional scanning and an
HC-05 Bluetooth module for remote control. The obstacle detection mechanism is powered by
ultrasonic sensors, which continuously scan the environment and relay distance measurements to
the Arduino. The microcontroller processes this data and, based on predefined conditions,
commands the motor driver to adjust the robot’s movement accordingly. The robot employs a
combination of forward, backward, and sideward motion, facilitated by the robot wheels, to
efficiently navigate around obstacles. An ultrasonic sensor mounted on a servo motor enhances
obstacle detection by scanning multiple directions. Additionally, a Bluetooth module allows for
manual operation when required. This project demonstrates a practical application of sensor
integration, real-time data processing, and autonomous control in robotics. It offers potential
use cases in autonomous delivery systems, smart transportation, and security patrolling. Future
enhancements could include the integration of computer vision and machine learning to enable
more sophisticated navigation and decision-making. Overall, this robot provides an efficient and
reliable solution for autonomous obstacle avoidance, contributing to advancements in intelligent
robotic systems
V
INDEX
1.1 Motivation 11
1.4 Scope 12
VI
5 SYSTEM DESIGN 26 – 42
5.1 System Architecture 27-29
5.2 UML Diagrams 30-38
5.3 Data Flow Diagram 39-42
6 IMPLEMENTATION & RESULTS 43– 58
6.1 INSTALLATION 44-45
6.2 Arduino code 46-48
6.3 Processing code 49-56
6.4 Results 57-58
7 METHODOLOGY AND ALGORITHMS 59 – 63
7.1 Methodology 60
7.2 Algorithms 61-63
8 TESTING 64 – 74
8.1 Hardware Testing 66-67
8.2 Sensor Accuracy Testing 68-69
8.3 Software Testing 69-70
8.4 Functionality Testing 71
8.5 Alpha Testing 72
8.6 Beta Testing 73
8.7 Performance and Stress Testing 73-74
9 CONCLUSION 75 – 76
10 FUTURE ENHANCEMENT 77 - 78
11 REFERENCES 79 – 81
7
LIST OF FIGURES
4. HARDWARE REQUIREMENTS 24
4(a).Jumper wires 24
4(b).Arduino UNO 24
4(c).Servo Motor 24
4(d).Bread board 24
4(e).Ultrasonic Sensor 24
5. SOFTWARE REQUIREMENTS 25
5(a).Arduino IDE 25
5(b).Processing Org 25
6. SYSTEM ARCHITECTURE 27
7. DATAFLOW DIAGRAM 29
9. CLASS DIAGRAM 31
16. INSTALLATION 57
8
16(b).Testing and checking wether all the connections are correct 57
17. WORKING 58
18. TESTING 65
9
CHAPTER 1
INTRODUCTION
10
1. INTRODUCTION
1.1 Motivation
The motivation behind this project is to develop a low-cost, efficient, and practical radar-
based object detection system using an ultrasonic sensor and Arduino Uno. Traditional radar
systems are expensive and complex, limiting their accessibility for small-scale applications.
This project aims to provide an affordable alternative that can be used in robotics, security, and
automation. It offers a hands-on learning experience in sensor integration, embedded systems,
and real-time data visualization, making it valuable for students, researchers, and hobbyists.
Additionally, the system can be enhanced with wireless communication, AI-based detection,
or multiple sensors, making it a versatile and scalable solution for real-world applications.
11
1.4 Scope
The scope of this project is to develop a cost-effective radar-based object detection system
using an ultrasonic sensor and Arduino Uno. The system will enable real-time object detection
by scanning the environment with a servo motor, measuring the distance to detected objects.
Designed to be affordable and scalable, the project is ideal for small-scale applications in fields
like robotics, security, and automation. It provides a valuable hands-on learning experience in
sensor technology, embedded systems, and programming. Additionally, the system can be
further enhanced with features like wireless monitoring, AI-based object detection, and the
integration of additional sensors. This project serves as a foundational model with potential
applications in collision avoidance, surveillance, and automated obstacle detection, making it
versatile and adaptable for future advancements.
The system utilizes an ultrasonic sensor to emit sound waves, which bounce off objects and
return to the sensor, allowing it to calculate the distance to detected objects. A servo motor is
used to rotate the sensor, enabling it to scan the environment at various angles, mimicking the
behavior of a radar system. The distance data is then processed and can be visualized in real-
time, offering a practical solution for applications like collision avoidance, obstacle detection,
and surveillance.
This project not only provides a hands-on learning experience in sensor integration, embedded
systems, and programming but also offers a versatile foundation for further developments such
as wireless communication, AI-based object detection, and multi-sensor integration. It aims to
make radar-based detection affordable and accessible while introducing innovative
applications in fields like robotics and security automation.
12
CHAPTER 2
LITERATURE SURVEY
13
2. LITERATURE SURVEY
Obstacle Radar-based systems use radio or sound waves to detect and track objects by
measuring the reflection or return of these waves. They are essential in fields like aviation,
navigation, and autonomous vehicles for applications such as collision avoidance and tracking.
Ultrasonic radar systems, like the one in this project, are used for short-range detection due to
their simplicity and cost-effectiveness. These systems offer affordable, compact solutions for
robotics, security, and proximity sensing, providing reliable and real-time environmental data.
• Ultrasonic Sensors: Used for short-range object detection, these sensors emit sound
waves and measure the time it takes for them to return, making them cost-effective and
simple for applications like robotics and parking systems.
• Radar Systems: Employing radio waves, radar is used for long-range detection and
tracking, commonly found in automotive applications like adaptive cruise control and
collision avoidance.
• LIDAR: Uses laser pulses to create high-resolution 3D maps for precise object
detection, typically used in autonomous vehicles, though it is more expensive and
sensitive to environmental conditions.
14
2.3 Research Papers on Radar based Systems
Several research papers have focused on designing and improving Radar based object
detection. Below are some notable works:
This paper presents the design and implementation of a radar system controlled by an
Arduino Uno. The system integrates an ultrasonic sensor with a servo motor to detect
objects within a specified range. The servo motor rotates 180 degrees, allowing the
ultrasonic sensor to scan the environment. The Arduino processes the sensor data and
provides a graphical representation of detected objects, including their distance and
position, using the Processing Integrated Development Environment (IDE). This setup
is particularly useful for applications in navigation, positioning, object identification,
mapping, and surveillance.
3. Moving Object Detection Using Ultrasonic Radar with Proper Distance, Direction,
and Object Shape
Analysis(https://www.researchgate.net/publication/345343092_Moving_Object_
Detection_Using_Ultrasonic_Radar_with_Proper_Distance_Direction_and_Obje
ct_Shape_Analysis):
15
This paper introduces a radar system capable of accurately detecting moving objects
using a single Arduino Uno and an ultrasonic sensor. The system employs algorithms
to determine the distance, direction, and shape of objects, enhancing the precision of
detection. Experiments demonstrated that the radar system achieved 100% efficiency in
detecting cylindrical objects at a distance of 5 cm, with accuracy decreasing to 30% at
17 cm. The study also notes limitations in detecting small or very close objects.
These papers collectively demonstrate the feasibility and effectiveness of using Arduino Uno
and ultrasonic sensors in developing radar-based object detection systems for various
applications.
• Autonomous Vehicles: Radar-based systems are used for collision avoidance, adaptive
cruise control, and blind-spot detection in self-driving cars.
• Robotics: They help in obstacle detection and navigation for robots, ensuring safe
movement in dynamic environments.
• Security and Surveillance: Radar systems are used in monitoring restricted areas,
detecting intruders, and providing motion detection.
• Parking Assistance: Ultrasonic radar systems are widely used in automated parking
systems to detect obstacles and assist with parallel parking.
• Smart Homes: Radar systems can be integrated into home automation for presence
detection, ensuring energy efficiency and security.
• Limited Range and Resolution: Radar systems, particularly ultrasonic sensors, have a
limited range and lower resolution, making them less effective for long-distance
detection.
• Environmental Interference: Weather conditions like rain or fog can affect the
performance of radar systems, causing signal distortion and reduced accuracy.
• Object Classification: Radar struggles to accurately classify objects with similar
characteristics, leading to challenges in differentiating between different types of
obstacles.
16
2.6 Future Enhancements and Research Directions
17
CHAPTER 3
SYSTEM ANALYSIS
18
3. SYSTEM ANALYSIS
Figure 1:Object detection using IR sensor circuit diagram & Block diagram
The existing infrared-based object detection systems are commonly used in Object detection
applications. These systems utilize infrared sensors to detect obstacles by measuring the
reflected infrared light from objects in the robot's path. The Arduino microcontroller is typically
used to process the data from the infrared sensors and adjust the robot's movement to avoid
collisions. The infrared sensors can detect objects within a specific range and are often used in
low-cost, basic robotic systems for tasks like line following and proximity sensing.
3.2 Disadvantages
19
3.3 Proposed System
The proposed system involves using an Arduino Uno microcontroller, an ultrasonic sensor,
and a servo motor for radar-based object detection. The system will detect objects in the range
of the ultrasonic sensor and utilize a servo motor to rotate the sensor, enabling 360-degree
scanning.
Figure 2:Object detection using ultra sonic sensors circuit diagram & Block diagram
3.4 Advantages
• Cost-Effective
• Simple and Easy to Implement
• Low Power Consumption
• Real-Time Object Detection
• Power on the Arduino Uno and connect all components (ultrasonic sensor, servo motor).
• Set the servo motor to its initial position (e.g., 0 degrees or a specified starting angle).
• Trigger the ultrasonic sensor to emit a pulse.
• The ultrasonic sensor sends out a sound pulse that travels through the air.
• The ultrasonic sensor waits for the pulse to reflect back after hitting an object.
20
Figure 3:Work flow in the Proposed System
• Measure the time taken for the pulse to return to the sensor.
• Calculate the distance based on the time delay using the formula:
• Store the measured distance data for further processing or display.
• Rotate the servo motor to the next position (e.g., increasing the angle by a certain step).
• Repeat steps 3 to 8 for each position of the servo motor, scanning the entire range (360
degrees).
• Display the collected distance data on a serial monitor or any connected output device
(optional).
• Detect objects by comparing distance values and trigger actions (e.g., stop a robot when
an obstacle is detected).
• Reset the system (optional) after completing the scan for the next operation.
21
CHAPTER 4
REQUIREMENT ANALYSIS
22
4. REQUIREMENT ANALYSIS
The requirement analysis involves identifying the essential hardware and software
components needed for the successful implementation of the proposed Radar based object
detection system. It ensures that the system meets the functional and non-functional
requirements necessary for smooth operation.
• Provide sufficient power to the Arduino Uno, ultrasonic sensor, and servo motor.
• The ultrasonic sensor should emit pulses and measure the time taken for the pulse to
return after hitting an object.
• Provide accurate distance measurements within the specified range of the sensor.
• The servo motor must rotate the ultrasonic sensor at predefined angles for 360-degree
scanning.
• Ensure smooth and continuous rotation of the servo motor for consistent data collection.
• Control the ultrasonic sensor to emit and receive pulses through the Arduino.
• Control the servo motor to rotate the sensor and scan the environment.
• The system should be compact and lightweight for easy integration into various
applications.
• It should have low power consumption for efficient operation, especially for battery-
powered setups.
• The components should be durable and able to withstand typical operating conditions.
• The system should be easy to assemble and maintain with minimal technical expertise
required.
• The hardware should be compatible with commonly available components (e.g.,
Arduino Uno, HC-SR04, SG90 servo).
• The system should be reliable and stable under different environmental conditions (e.g.,
temperature variations).
• The setup should be portable for use in various settings or mobile applications.
23
4.3Hardware Requirements
1. Arduino Uno: Acts as the central microcontroller for controlling the system.
2. Ultrasonic Sensor (HC-SR04): Used to measure the distance to objects by emitting
and receiving ultrasonic pulses.
3. Servo Motor (e.g., SG90): Rotates the ultrasonic sensor for 360-degree scanning.
24
4. Breadboard: For making connections between the components.
5. Jumper Wires: For connecting the components to the breadboard and Arduino.
6. LCD/Serial Monitor (optional): For displaying the distance data or detected objects
in real-time.
4.4Software Requirements
1. Arduino IDE - Used for writing, compiling, and uploading the microcontroller code.
25
CHAPTER 5
SYSTEM DESIGN
26
SYSTEM DESIGN
The System Design section provides a comprehensive overview of the architectural and
functional structure of the Radar Based Object detection System. It consists of the following
key components:
The System Architecture Diagram of the Radar based object detection system provides a
visual representation of how different hardware and software components interact to ensure
obstacle detection . The diagram is divided into four main subsystems:
27
1. Input Layer
2.Control Layer
• Arduino Uno:
o Acts as the central microcontroller.
o Controls the ultrasonic sensor by triggering pulse emission and timing the
reception of the reflected pulse.
o Controls the servo motor to rotate the ultrasonic sensor at specific angles.
o Processes the distance data and stores or transmits it for further use.
3. Output Layer
4. Power Layer
• Power Supply:
o Powers the Arduino, ultrasonic sensor, and servo motor.
o Can be powered through USB or an external power source (e.g., 5V DC).
28
5.Communication Layer
• Data Transmission:
o Sends data to external systems or a user interface for further processing or
visualization.
o Can include communication modules like Bluetooth or Wi-Fi for remote
monitoring.
29
5.2 UML DIAGRAMS
5.2.1 USE CASE DIAGRAM
The Use Case Diagram represents how external entities (actors) interact with the Radar based
object detection System.
Actors:
Use Cases:
30
5.2.2 CLASS DIAGRAM
This class diagram represents an Radar based object detection System, illustrating
interactions between sensors, controllers, and motor modules.
1. Ultrasonic Sensor
2. Servo Motor
3. Arduino Controller
1. UltrasonicSensor Class
Attributes:
• triggerPin: int
o The Arduino pin used to trigger the ultrasonic sensor.
• echoPin: int
o The Arduino pin that receives the echo signal from the ultrasonic sensor.
• distance: float
31
o Stores the calculated distance from the sensor to the detected object in
centimeters.
Methods:
2. ServoMotor Class
Attributes:
• pin: int
o The Arduino pin to which the servo motor is connected.
• angle: int
o Stores the current angle of the servo motor (typically between 0° and 180°).
Methods:
32
o Sets the servo motor to a specific angle. It takes an integer value (e.g., 0, 45, 90)
and adjusts the servo motor accordingly.
3. ArduinoController Class
Attributes:
• sensor: UltrasonicSensor
o An instance of the UltrasonicSensor class that controls the sensor.
• motor: ServoMotor
o An instance of the ServoMotor class to control the rotation of the sensor.
Methods:
33
5.2.3 SEQUENCE DIAGRAM
The sequence diagram represents the step-by-step interaction between components of the
Radar based object detection system, ensuring smooth execution and obstacle detection.
Sequence of Operations
1. System Starts
34
• UltrasonicSensor calculates the distance to the object.
3. Processing Data
4. Displaying Results
35
The following activity diagram represents the workflow of an radar based object detection
system. The system follows a sequence of steps to process commands and respond to obstacles
efficiently.
Workflow Description:
• The system is powered on, and the components (Arduino, Servo Motor, Ultrasonic
Sensor) are initialized.
• The sensor waits for the pulse to bounce back and calculates the time taken for the
return.
5. Calculate Distance
• Using the time and speed of sound, the system calculates the distance to the object.
• The system checks if the measured distance is less than a pre-set threshold.
36
8. Display Results
• The detected object’s distance and position are displayed on a Serial Monitor
or LCD.
9. Continue Scanning
• The Servo Motor moves to the next angle and repeats the process until a full
scan is completed.
• Once the scan is complete, the system either stops or restarts for continuous
monitoring.
• The Arduino Uno controls the Servo Motor and Ultrasonic Sensor, processes data,
and communicates with the output display.
37
• The Ultrasonic Sensor (HC-SR04) sends and receives ultrasonic pulses to measure the
distance of objects.
• The Servo Motor (SG90) rotates the ultrasonic sensor at different angles to scan the
surroundings.
• The measured distance and detected objects are displayed on the Serial Monitor or
LCD screen for user observation.
38
5.3 DATA FLOW DIAGRAM (DFD)
The Context Diagram represents the entire radar-based object detection system as a single
entity and shows its interactions with external components.
Entities:
1. User
o Powers ON/OFF the system.
o Monitors the detected object data.
2. Ultrasonic Sensor
o Sends ultrasonic pulses to detect objects.
o Receives echo signals and calculates the distance.
3. Servo Motor
o Rotates the ultrasonic sensor to scan the environment.
4. Output Display (Serial Monitor / LCD Screen)
o Displays detected object distance and status.
39
Process
40
5.3.2 Level 1: High-Level Data Flow
The Level 1 diagram expands on the context diagram by breaking down the systems
functionality .
Figure 14:High Level data flow diagram for Radar based object detection System.
41
5.3.3 Level 2: Detailed Data Flow
Figure 15:Detailed data flow diagram for Radar based object detection System
Subsystem Interactions:
42
CHAPTER 6
IMPLEMENTATION & RESULTS
43
6.IMPLEMENTATION
6.1 INSTALLATION
Step-by-Step Guide to Building a Radar-Based Object Detection System Using Arduino Uno
and Ultrasonic Sensor:
In this step, we will connect all the necessary components to build the radar-based object
detection system. This includes the Ultrasonic Sensor (HC-SR04), Servo Motor (SG90 or
MG995). Each connection plays a vital role in the system’s functionality.
• VCC → Arduino 5V
• GND → Arduino GND
• Trigger Pin → Arduino D9
• Echo Pin → Arduino D10
The HC-SR04 ultrasonic sensor is used to measure the distance of an object by emitting
ultrasonic waves and detecting their reflection. It has four pins:
44
• GND (Ground): Completes the electrical circuit.
• Trigger Pin: Sends out an ultrasonic pulse.
• Echo Pin: Receives the reflected signal and calculates the distance.
Connection Steps:
The servo motor is used to rotate the ultrasonic sensor in a scanning motion (0° to 180°). It
helps in detecting objects in different directions.
Connection Steps:
45
6.2ARDUINO CODE
2. Upload the following sample code to control the ultrasonic sensor and servo motor:
#include <Servo.h>
long duration;
int distance;
Servo myServo;
void setup() {
void loop() {
46
// Rotates the servo motor from 0 to 180 degrees
distance = calculateDistance(); // Calls the function for calculating the distance measured by
the Ultrasonic sensor for each degree
47
}
int calculateDistance() {
delayMicroseconds(10);
duration = pulseIn(echoPin, HIGH); // Reads the echoPin, returns the sound wave travel
time in microseconds
3.Upload the code to Arduino Uno and open the Serial Monitor (Tools > Serial Monitor)
to see the angle and distance readings.
48
6.2 PROCESSING CODE
1. Download and install Processing Software from https://processing.org.
2. Open a new Processing sketch and paste the following visualization code:
import java.awt.event.KeyEvent; // imports library for reading the data from the serial port
import java.io.IOException;
// declare variables
String angle="";
String distance="";
String data="";
String noObject;
float pixsDistance;
int index1=0;
int index2=0;
PFont orcFont;
void setup() {
smooth();
49
myPort = new Serial(this,"COM3", 9600); // starts the serial communication
myPort.bufferUntil('.'); // reads the data from the serial port up to the character '.'. So actually
it reads this: angle,distance.
void draw() {
fill(98,245,31);
noStroke();
fill(0,4);
drawRadar();
drawLine();
drawObject();
drawText();
void serialEvent (Serial myPort) { // starts reading data from the Serial Port
50
// reads the data from the Serial Port up to the character '.' and puts it into the String variable
"data".
data = myPort.readStringUntil('.');
data = data.substring(0,data.length()-1);
index1 = data.indexOf(","); // find the character ',' and puts it into the variable "index1"
angle= data.substring(0, index1); // read the data from position "0" to position of the variable
index1 or thats the value of the angle the Arduino Board sent into the Serial Port
iAngle = int(angle);
iDistance = int(distance);
void drawRadar() {
pushMatrix();
noFill();
strokeWeight(2);
stroke(98,245,31);
51
// draws the arc lines
arc(0,0,(width-width*0.0625),(width-width*0.0625),PI,TWO_PI);
arc(0,0,(width-width*0.27),(width-width*0.27),PI,TWO_PI);
arc(0,0,(width-width*0.479),(width-width*0.479),PI,TWO_PI);
arc(0,0,(width-width*0.687),(width-width*0.687),PI,TWO_PI);
line(-width/2,0,width/2,0);
line(0,0,(-width/2)*cos(radians(30)),(-width/2)*sin(radians(30)));
line(0,0,(-width/2)*cos(radians(60)),(-width/2)*sin(radians(60)));
line(0,0,(-width/2)*cos(radians(90)),(-width/2)*sin(radians(90)));
line(0,0,(-width/2)*cos(radians(120)),(-width/2)*sin(radians(120)));
line(0,0,(-width/2)*cos(radians(150)),(-width/2)*sin(radians(150)));
line((-width/2)*cos(radians(30)),0,width/2,0);
popMatrix();
void drawObject() {
pushMatrix();
strokeWeight(9);
52
pixsDistance = iDistance*((height-height*0.1666)*0.025); // covers the distance from the
sensor from cm to pixels
if(iDistance<40){
line(pixsDistance*cos(radians(iAngle)),-pixsDistance*sin(radians(iAngle)),(width-
width*0.505)*cos(radians(iAngle)),-(width-width*0.505)*sin(radians(iAngle)));
popMatrix();
void drawLine() {
pushMatrix();
strokeWeight(9);
stroke(30,250,60);
line(0,0,(height-height*0.12)*cos(radians(iAngle)),-(height-
height*0.12)*sin(radians(iAngle))); // draws the line according to the angle
popMatrix();
53
pushMatrix();
if(iDistance>40) {
else {
fill(0,0,0);
noStroke();
fill(98,245,31);
textSize(25);
text("10cm",width-width*0.3854,height-height*0.0833);
text("20cm",width-width*0.281,height-height*0.0833);
text("30cm",width-width*0.177,height-height*0.0833);
text("40cm",width-width*0.0729,height-height*0.0833);
textSize(40);
54
text(" ", width-width*0.26, height-height*0.0277);
if(iDistance<40) {
textSize(25);
fill(98,245,60);
translate((width-width*0.4994)+width/2*cos(radians(30)),(height-height*0.0907)-
width/2*sin(radians(30)));
rotate(-radians(-60));
text("30 ",0,0);
resetMatrix();
translate((width-width*0.503)+width/2*cos(radians(60)),(height-height*0.0888)-
width/2*sin(radians(60)));
rotate(-radians(-30));
text("60 ",0,0);
resetMatrix();
translate((width-width*0.507)+width/2*cos(radians(90)),(height-height*0.0833)-
width/2*sin(radians(90)));
rotate(radians(0));
text("90 ",0,0);
resetMatrix();
55
translate(width-width*0.513+width/2*cos(radians(120)),(height-height*0.07129)-
width/2*sin(radians(120)));
rotate(radians(-30));
text("120 ",0,0);
resetMatrix();
translate((width-width*0.5104)+width/2*cos(radians(150)),(height-height*0.0574)-
width/2*sin(radians(150)));
rotate(radians(-60));
text("150 ",0,0);
popMatrix();
56
6.3 RESULTS
6.3.1 Code Execution Output (Serial Monitor)
Figure 16(c):Connecting the device using USB Figure 16(d):Device is ready to work
cable
▪ Take a USB Type-B cable and insert one end into your Arduino Uno board.
▪ Connect the other end to your laptop’s USB port for programming and power supply.
▪ Write or load the obstacle detection and avoidance code into the IDE.
▪ Click Upload to transfer the code to the Arduino
57
Figure 17(a):uploading the code into arduino Figure 17(b):Arduino Trouble shooting
Figure 17(c):Uploading the Processing the code Figure 17(d):Vizualizing the output results
58
CHAPTER 7
METHODOLOGY AND
ALGORITHMS
59
7. METHODOLOGY AND ALGORITHMS
7.1 Methodology
1. Ultrasonic Sensing: Measures the distance between the sensor and objects,
enabling object detection.
2. Servo Control: Rotates the ultrasonic sensor between 0° and 180° for 360-
degree scanning.
3. Distance Measurement: Uses the time-of-flight of sound waves to calculate the
distance to obstacles.
4. Data Reporting: Sends measured distance data to the Serial Monitor for
visualization or further processing.
5. Real-Time Object Detection: Identifies objects within a predefined distance
threshold and reports their position.
6. Dynamic Scanning: The servo motor adjusts the sensor’s angle dynamically to
cover different areas.
7. Rotation and Sweep: The system rotates the sensor back and forth to scan the
environment at various angles.
➢ The system continuously scans its environment by rotating the sensor and calculating
distances.
➢ If an object is detected within a predefined range, the system reports the object’s
position and distance. The system adjusts scanning based on detected distances to
provide comprehensive environmental data.
60
7.2 Algorithms
Function safeReadUltrasonic():
sum = 0
Repeat 5 times:
Trigger ultrasonic pulse
Measure echo response time
Sum up the results
Return average distance
• This function reads the ultrasonic sensor multiple times (5 times) and calculates the
average distance to avoid errors.
• The sensor is triggered to send an ultrasonic pulse, and the return time of the echo is
measured to calculate the obstacle's distance.
• The final average reading is returned for accuracy.
Function controlServo(angle):
Initialize servo motor on pin X
Set servo to the specified angle
Wait for the servo to reach the position
Return to the calling function
• Servo Motor Initialization: The servo is set up and attached to a specific pin.
• Angle Control: The servo is moved to specific angles using the write() function.
• Delay: A delay is used to ensure the servo has enough time to reach the desired position
before moving to the next action.
61
7.2.3. Data Communication Algorithm
Function communicateData():
Initialize communication channel (e.g., UART, I2C)
Prepare the data to be transmitted
Transmit the data to the receiver
Wait for acknowledgment or response from receiver
If response received:
Process the received data or acknowledgment
Close communication channel
Return success or failure status
Function mapAngleToDistance():
Initialize servo and sensor
Set the range of angles (e.g., 0° to 180°)
• Servo Control: The servo rotates in increments to cover a specified range of angles.
62
• Distance Measurement: The ultrasonic sensor measures the distance to the nearest
object at each angle.
• Mapping: The angle-distance pairs are effectively "mapped," showing the relationship
between each angle and the corresponding distance.
Function detectAndReportObject():
Initialize sensors (e.g., ultrasonic, camera)
Initialize reporting system (e.g., LED, buzzer, or
console)
Continuously:
Read data from sensor
If object is detected:
Report detection (e.g., sound an alarm, print
message)
Log the object’s position or distance
Else:
Continue scanning for objects
• Sensor Initialization: The ultrasonic sensor and LED are initialized, and necessary pins
are set up.
• Object Detection: The algorithm checks if an object is within a specified distance (e.g.,
less than 10 cm).
• Reporting: If an object is detected, the system triggers a report (e.g., turning on an LED
and printing a message to the Serial Monitor).
• Continuous Monitoring: The loop continues to check for objects, and the detection is
reported each time an object is detected within the range.
63
CHAPTER 8
TESTING
64
8. TESTING
Testing is a critical phase in the development of the Radar based object detection system
to ensure its functionality, reliability, and performance under different conditions. Various
types of testing have been conducted to validate individual components, integration between
different modules, and overall system performance.
Figure 18(a):Final Complete device Figure 18(b):Top view to understand the connections
Figure 18(c):Testing the device by placing an Figure 18(d):Fully Completed and working radar
obstacle
65
8.1 Hardware Testing
Objective: Hardware testing ensures that all physical components of the radar-based object
detection system, including power supply, ultrasonic sensor, servo motor, and wiring, are
properly connected and functioning correctly.
Testing Approach:
• Power Supply Testing: Verified that all components receive stable voltage using a
multimeter.
• Ultrasonic Sensor Testing: Measured distance readings at various angles and object
placements.
• Servo Motor Testing: Tested smooth and accurate rotation between predefined angles
(0°, 45°, 90°, 135°, 180°).
• Wiring and Connection Testing: Checked the integrity of all circuit connections for
loose or faulty wires.
• Serial Communication Testing: Ensured correct data transmission between the
Arduino and the Serial Monitor.
• System Stability Testing: Ran the system for an extended duration to check for
overheating or performance degradation.
Expected Outcome:
Distance: 20 cm
Distance: 35 cm
Distance: 15 cm
Distance: 50 cm
66
Servo Motor Test Output:
Verified correct servo movement at different angles.
Servo Angle: 0°
Servo Angle: 45°
Servo Angle: 90°
Servo Angle: 135°
Servo Angle: 180°
No jittering or delay observed
System initialized...
Ultrasonic sensor active
Object detected at 25 cm
Object detected at 30 cm
67
8.2 Sensor Accuracy Testing
Objective: Ensure that the ultrasonic sensor provides precise and consistent distance
measurements under different conditions, minimizing errors and false readings.
Testing Approach:
• Distance Calibration Test: Place objects at known distances (e.g., 10 cm, 20 cm, 50
cm, 100 cm) and compare measured values with actual distances.
• Material Sensitivity Test: Test the sensor’s accuracy against different materials
(metal, plastic, wood, fabric) to check if readings vary.
• Angle Variation Test: Measure distances at different angles (0°, 30°, 45°, 60°, 90°) to
evaluate how sensor positioning affects accuracy.
• Environmental Condition Test: Test the sensor in different lighting conditions,
temperatures, and humidity levels to ensure stable readings.
• Repetitive Measurement Test: Take multiple distance readings at the same position
to check for consistency and noise in the data.
Expected Outcome:
68
Angle Variation Test Output:
Effect of sensor tilt on accuracy.
0° → Distance: 25 cm
30° → Distance: 25.3 cm
45° → Distance: 26.1 cm (Minor deviation)
60° → Distance: 28.5 cm (Larger deviation)
90° → No reliable reading
Trial 1: Distance 30 cm
Trial 2: Distance 30.2 cm
Trial 3: Distance 29.9 cm
Trial 4: Distance 30.1 cm
Trial 5: Distance 30 cm
Average Error: ±0.2 cm
Objective: Ensure that the radar-based object detection system's software functions correctly,
processes sensor data accurately, and performs actions based on detection logic without errors.
Testing Approach:
• Code Compilation & Debugging: Verify that the Arduino code compiles successfully
without syntax errors or warnings.
• Ultrasonic Sensor Data Processing: Ensure the sensor correctly reads and processes
distance data.
• Servo Motor Control Logic: Test if the servo motor moves according to programmed
angles.
69
• Object Detection Algorithm Test: Validate that the system correctly identifies objects
and triggers appropriate actions.
• Serial Communication Test: Check if the system sends real-time data correctly to the
Serial Monitor.
• Error Handling Test: Introduce intentional errors (e.g., disconnect the sensor) to
verify how the system handles failures.
• Integration Testing: Verify smooth interaction between the ultrasonic sensor, servo
motor, and Arduino.
Expected Outcome:
Compilation Successful
No Syntax Errors
No Warnings
Object detected at 15 cm
Object detected at 30 cm
Object detected at 50 cm
No false detections
Servo moves to 0°
Servo moves to 45°
Servo moves to 90°
Servo moves to 135°
Servo moves to 180°
Smooth movement with no jitter
70
8.4 Functionality Testing
Objective Ensure that the radar-based object detection system performs all intended functions
correctly, including object detection, distance measurement, servo motor movement, and data
communication.
Testing Approach:
• Object Detection Test: Verify that the system correctly detects objects within a
predefined range.
• Distance Measurement Test: Compare measured distances with actual object
distances to ensure accuracy.
• Servo Motor Rotation Test: Check if the servo motor scans the area correctly by
rotating to defined angles.
• Alert System Test: Ensure that an alert (buzzer or LED) is triggered when an object is
detected within a critical range.
Expected Outcome:
Object detected at 20 cm
Alert Triggered
Object detected at 100 cm (Ignored as per logic)
No false detections
Servo moves to 0°
Servo moves to 45°
Servo moves to 90°
Servo moves to 135°
Servo moves to 180°
Smooth movement with no jitter
Alert Triggered
71
8.5 Alpha Testing
Objective: Alpha testing ensures that the radar-based object detection system functions as
expected in a controlled environment before deployment. It focuses on detecting major issues,
verifying system reliability, and refining performance.
Testing Approach:
• Component Functionality Test: Verify that each hardware and software component
operates correctly.
• System Integration Test: Ensure smooth interaction between the ultrasonic sensor,
servo motor, alert system, and Arduino.
• Performance Evaluation: Check the system's responsiveness, accuracy, and speed in
detecting objects.
• Error Handling Test: Introduce minor faults (e.g., disconnect sensor, introduce
obstacles) to observe system behavior.
Expected Outcome:
If beta testers provided feedback via the serial monitor or through a logging mechanism, include
relevant feedback output, such as:
72
8.6 Beta Testing
Objective: Beta testing evaluates the radar-based object detection system in a real-world
environment with actual users to identify bugs, usability issues, and performance gaps before
final deployment.
Testing Approach:
Expected Outcome:
• Performance Testing: Evaluate the efficiency, speed, and accuracy of the radar-based
object detection system under normal operating conditions.
• Stress Testing: Assess system stability and behavior under extreme conditions, such as
high data loads, rapid servo movements, and prolonged usage.
73
Testing Approach:
• Response Time Test: Measure the time taken by the system to detect an object and
process the response.
• Accuracy Test: Compare measured distances with actual distances to ensure precision.
• Servo Movement Speed Test: Check how quickly the servo motor scans different
angles.
• Real-time Data Processing Test: Ensure that the system updates object detection and
distance data without delays.
• Power Consumption Test: Measure the system's power usage under normal
conditions.
Expected Outcome:
Figure 19:Testing Result when no Object is detetcted Figure 19:Testing result when obstacle detected
74
CHAPTER 9
CONCLUSION
75
9. CONCLUSION
The radar-based object detection system using Arduino Uno and an ultrasonic sensor has
been thoroughly tested through unit, functional, alpha, beta, performance, and stress testing.
The results confirm that the system:
Handles continuous operation with stability but may require recalibration after prolonged
use.
Performs well under normal conditions but shows minor deviations in extreme
environments.
Effectively handles errors and recovers from faults without system failure.
After comprehensive testing, the system was found to be accurate, responsive, and stable,
performing efficiently in normal conditions with minor performance variations in extreme
environments. It successfully recovers from errors and handles continuous operation without
critical failures. With slight optimizations for extreme conditions, the system is ready for real-
world deployment as a reliable radar-based object detection solution.
76
CHAPTER 10
FUTURE ENHANCEMENT
77
10. FUTURE ENHANCEMENT
Although the Radar based object detection system is capable of sensing and real-time
obstacle detection, several enhancements can be incorporated to improve its efficiency,
intelligence, and usability.
Several enhancements can be incorporated to improve the Radar based object detection
System:
78
CHAPTER 11
REFERENCES
79
11. REFERENCES
ultrasonic https://www.arduino.cc
Detailed specifications and operational guidelines for the HC-SR04 ultrasonic sensor,
guide to creating a radar system with Arduino, featuring ultrasonic sensors and servo
at: An official Arduino tutorial explaining how to control servo motors, essential for
Available at: A community forum where users discuss challenges and solutions related
with Arduino. Available at: An extensive tutorial on controlling servo motors using
https://randomnerdtutorials.com
80
9. Gesture Control in Robotics – Implementing Gesture-Based Navigation Using
81