0% found this document useful (0 votes)
15 views46 pages

Group3 Redar

The document outlines a capstone project report for a 'Radar System using Arduino' created by students at V.J. Shinde Polytechnic Dharashiv. The project aims to develop a cost-effective radar prototype utilizing an ultrasonic sensor and servo motor, with real-time data visualization on a computer. It emphasizes educational value in embedded systems and practical applications in various fields such as robotics and automation.

Uploaded by

ziddanfaqeer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views46 pages

Group3 Redar

The document outlines a capstone project report for a 'Radar System using Arduino' created by students at V.J. Shinde Polytechnic Dharashiv. The project aims to develop a cost-effective radar prototype utilizing an ultrasonic sensor and servo motor, with real-time data visualization on a computer. It emphasizes educational value in embedded systems and practical applications in various fields such as robotics and automation.

Uploaded by

ziddanfaqeer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 46

Radar System using arduino

MAHARASTRA STATE BOARD OF


TECHNICAL EDUCATION, MUMBAI

V.J Shinde POLYTECHNIC DHARASHIV

CAPSTONE PROJECT REPORT


Branch: Computer Engineering

Academic Year : 2024-2025 Semester: VI

Class : CO6-I

Course Title : Capstone Project - Execution & Report Writing Course Code : 22060

Project Title : Radar System using

arduino Mentor / Guide : MRS.Ghatule

D.B. Team Members :

Sr. No Enrolment No. Roll No. Name

1 2215570036 07 Shaikh Muskan


2 2215570037 08 Faqeer Ziddan
3 2215570038 09 Pathan Jishan

V.J.Shinde POLYTECHNIC DHARASHIV 1


Radar System using arduino

MAHARASTRA STATE BOARD OF


TECHNICAL EDUCATION, MUMBAI

V.J Shinde POLYTECHNIC DHARASHIV


CERTIFICATE

-This is to certify that.


Shaikh Muskan
Faqeer Ziddan
Pathan Jishan

from V.J. Shinde Polytechnic Dharashiv ( 1557 ) Institute having Enrolment No: -
221557006,2215570037,2215570038has completed project in course Capstone Project
Execution & Report Writing ( 22060 ) having title “Radar System Using Arduino”
during the academic year 2024-2025 , The project completed in a group consisting of four
persons under the guidance of the Faculty Guide.

Project Guide Head of Department Principal


MRS.Ghatule D.B. MRS.VijapureS.D Mr.Deshmukh.P.R

V.J.Shinde POLYTECHNIC DHARASHIV 2


Seal Of Institute
Radar System using arduino

꧁ ACKNOWLEDGEMENT ꧂

We are grateful to MSBTE for giving us the strength, knowledge and


understanding to complete this project.

We would like to express our special thanks of gratitude to CPE Guide –


MRS.Ghatule D.B., for his proper guidance, invaluable support, patience, time in
our CPE-project. So, We are really thankful to him.
In this project We got more information about “CPE”. We came to know about
so many new things. Due to this CPE-project.
Also, our gratitude goes to our friends and our family for their help. we would
also like to thank our Head of Department [HOD]- MRS.VijapureS.Dsir who
patiently saw us to the completion of this CPE-project.
We are thankful to all of them who supported us in this project. It wouldn’t have
been without them.

Yours Sincerely,
Shaikh muskan
Faqeer ziddan
Pathan jishan

V.J.Shinde POLYTECHNIC DHARASHIV 3


Radar System using arduino

“ V.J.Shinde POLYTECHNIC DHARASHIV ”

❖ ABSTRACT :

The Radar System Using Arduino is a cost-effective prototype designed to simulate


the functionality of conventional radar systems through the integration of an ultrasonic sensor and a servo
motor, controlled via an Arduino microcontroller. This system operates by emitting ultrasonic waves,
measuring the time delay of the echo from objects in its path, and calculating distances accordingly.
Mounted on a rotating servo, the sensor scans its surroundings within a 180-degree arc, allowing real-time
object detection.

Data collected from the sensor is transmitted to a computer, where it is visualized using graphical interfaces
developed in Processing IDE. The result is a live radar-like display that marks detected objects at their
respective distances and angles. The project provides an excellent platform for learning about embedded
systems, sensor technology, and real-time data visualization. It holds significant educational value and
potential applications in robotics, security systems, and smart automation.

By mimicking real-world radar operations with readily available and inexpensive components, the project
bridges theoretical knowledge and practical implementation. This hands-on learning tool empowers students
and enthusiasts to explore advanced concepts in electronics and programming within an accessible and
engaging framework.

V.J.Shinde POLYTECHNIC DHARASHIV 4


Radar System using arduino

꧁ INDEX꧂

 Contents

1 Introduction
1.1 Title of the Micro-Project...............................................8
1.2 Rationale.........................................................................8
1.3 Aim/Benefit of the micro project...................................8
1.3.1 Aim of Project....................................................8
1.3.2 Benefit of Project...............................................9
1.4 Scope..............................................................................9
1.5 Objective......................................................................10
1.6 Course outcomes addressed.........................................10
1.7 Literature Survey............................................................11
2 General Behaviour
2.1 Initiative........................................................................12

2.2 Resource Required.............................................................12

2.3 Software requirments.......................................................13-14

2.4 Specification....................................................................14

3 System Analysis
3.1 Study of current/Existing system...................................15

3.2 Feasibility study.............................................................16

3.2.1 Technical feasibility...........................................16


3.2.2 Economical feasibility........................................16
3.3 Operation feasibility….......................................16

V.J.Shinde POLYTECHNIC DHARASHIV 5


Radar System using arduino

4 System Design
4.1 System Architecture.......................................................17

4.2 Hardware Design........................................................18-19

4.3 Software design..........................................................20

5 System Requirement
5.1 Functional Requirement.........................................................21
5.2 Non-Functional Requirement..............................................22
5.3 Explicit Requirement.............................................................23
5.4 Implicit Requirement..........................................................24

6 Skill developed/learning outcomes..................................................25

7 Application........................................................................................26

8 Working Principal..........................................................................27-31

9 Actual Codes................................................................................32-34

10 Processing Code............................................................................35-41

11 Actual Outputs............................................................................42-43

12 Conclusion....................................................................................44

13 References.......................................................................................45

V.J.Shinde POLYTECHNIC DHARASHIV 6


Radar System using arduino

1.0 INTRODUCTION:

1.1 Title of Capstone Project:

To create a report on “Radar System Using Arduino”

1.2 Rationale:

In an age where security and automation are of increasing importance, radar


systems play a vital role in a wide range of fields, from defense to civil engineering,
automotive safety, and even domestic automation. Traditional radar systems, while effective,
are expensive and often inaccessible for smaller-scale applications or educational purposes.
Using Arduino, a low-cost open-source microcontroller, we can develop a simplified and
functional radar system that mimics real-world radar capabilities. This project promotes
learning in embedded systems, sensors, microcontroller programming, and real-time data
visualization, providing a strong foundation for advanced systems.

1.3 Aim/Benefits of the Capstone Project:

1.3.1 Aim of Capstone Project:

To design and develop a prototype radar system using Arduino and ultrasonic
sensors that can scan its surroundings, detect objects in a given range, and graphically represent their
location in real time.

V.J.Shinde POLYTECHNIC DHARASHIV 7


Radar System using arduino

1.3.2 Benefits of Radar System Uisng Arduino:

- Helps students and hobbyists understand the working of radar systems.


- Provides practical exposure to sensor integration and microcontroller programming.
- Encourages innovative thinking for home or industrial automation solutions.
- Cost-effective solution for experimental setups and small surveillance systems.
- Enhances programming and hardware interfacing skills.

1.4 Scope:

The project is limited to the creation of a short-range 2D radar using an


ultrasonic sensor mounted on a servo motor. It does not involve RF-based radar principles, but rather
mimics radar scanning using distance measurement techniques. The project can be extended to cover 3D
mapping, wireless data transmission, or integration with AI for object recognition. Its simplicity and
affordability make it suitable for educational institutions, project exhibitions, and prototype development.

V.J.Shinde POLYTECHNIC DHARASHIV 8


Radar System using arduino

1.5 Objectives:

- To simulate a basic radar system using Arduino and ultrasonic sensor.

- To develop a motor-driven scanning mechanism using a servo motor.

- To collect and transmit distance data to a computer for visualization.

- To display radar output in a 2D graphical format using Processing or similar tools.

- To ensure the radar system operates reliably and accurately within defined parameters.

1.6 Course Outcomes:

- Understand the fundamentals of sensors and microcontroller interfacing (CO1).

- Develop embedded C/C++ code for data acquisition and device control (CO2).

- Design basic electronic circuits for system integration (CO3).

- Analyze and visualize data collected from hardware systems (CO4).

V.J.Shinde POLYTECHNIC DHARASHIV 9


Radar System using arduino

1.7 LITERATURE SURVEY

A review of existing projects and literature reveals that many researchers

and hobbyists have successfully implemented ultrasonic-based distance measurement systems using

Arduino. Projects on platforms like GitHub and Hackster.io show implementations of similar systems used

for obstacle avoidance in robots, distance measurement, and environmental mapping. Scholarly articles

highlight the limitations and benefits of such systems compared to traditional radar. Technologies like

LIDAR and IR sensors are also compared to ultrasonic sensors, showcasing the simplicity and cost-

effectiveness of the latter for basic applications.

V.J.Shinde POLYTECHNIC DHARASHIV 10


Radar System using arduino

2.0 General Behaviour

2.1 Initiative:

The project was initiated to combine theoretical knowledge of embedded


systems with practical application. It was driven by the motivation to explore real-time systems
and their use in security and automation. The initiative also aimed to provide hands-on
experience in microcontroller programming and sensor interfacing..

2.2 Resources Required:

Hardware Requirements:

- Arduino Uno microcontroller board

- HC-SR04 Ultrasonic Distance Sensor

- SG90 Servo Motor

- Breadboard and connecting wires

- Power supply (Battery or USB)

- Computer with Arduino IDE installed

- Processing IDE or similar platform for radar display

- Resistors, capacitors (optional for signal conditioning)

V.J.Shinde POLYTECHNIC DHARASHIV 11


Radar System using arduino

Software Requirements:

1. Arduino IDE

Purpose: To write, compile, and upload code to the Arduino Uno board.

Version: 1.8.x or higher (compatible with Arduino Uno)

Platform: Windows, macOS, or Linux

Features Used:

Serial communication

Libraries like Servo.h

Code debugging and uploading

2. Processing IDE

Purpose: To create a graphical radar interface that reads and visualizes serial data from Arduino in real-
time.

Version: 3.x or higher

Platform: Windows, macOS, or Linux

Features Used:

Serial communication library

Graph plotting for radar sweep and object

detection Real-time data rendering

V.J.Shinde POLYTECHNIC DHARASHIV 12


Radar System using arduino

3. Drivers for Arduino Uno

Purpose: Ensures the computer can communicate with the Arduino board via USB.

Included with: Arduino IDE installation, or can be installed manually.

Note: Ensure drivers are installed correctly to avoid port detection issues.

4. USB Serial Port Monitor (optional)


Purpose: Used for debugging serial data sent from Arduino.

Alternatives: Built-in Serial Monitor in Arduino IDE or tools like PuTTY or RealTerm.

5. Libraries Used

Servo.h (Arduino Library for controlling servo motors)

Serial (Processing and Arduino built-in library for data communication)

2.3 Specification:

- Measurement Range: 2 cm to 400 cm

- Sensor Operating Voltage: 5V DC

- Servo Rotation Angle: 0° to 180°

- Radar Update Frequency: ~10 readings per second

- Display: Graphical 2D radar representation on computer screen

V.J.Shinde POLYTECHNIC DHARASHIV 13


Radar System using arduino

3.0 System Analysis

3.1 Study of Current/Existing System:

Commercial radar systems use radio waves and are

expensive and complex. Alternatives such as LIDAR and IR-based systems also require high-

end hardware and software. The Arduino-based radar system offers a simplified version using

ultrasonic sensing, ideal for beginners. It does not match the precision of RF radar but serves

well for educational and small-scale detection systems..

V.J.Shinde POLYTECHNIC DHARASHIV 14


Radar System using arduino

Feasibility Study

3.1.1 Technical Feasibility:

The project uses well-documented and widely available components.


Arduino Uno supports interfacing with servo motors and ultrasonic sensors. Programming is done
using open-source IDEs.

3.1.2 Economical Feasibility:

Total project cost is approximately $20-$30. This includes all hardware


components and free software. Thus, it is financially feasible for students and schools.

3.1.3 Operational Feasibility:

The system requires basic knowledge of electronics and programming. The radar can be operated with a
simple setup and does not require frequent calibration or maintenance, making it operationally feasible.

V.J.Shinde POLYTECHNIC DHARASHIV 15


Radar System using arduino

4.0 System Design :-

The System Design for the Radar System using Arduino outlines the architecture, hardware
connections, software flow, and visualization setup. This section focuses on creating a robust and
functional design that meets the defined objectives.

4.1 System Architecture


The radar system consists of the following components and interactions:

1. Input Subsystem:
o Ultrasonic Sensor (e.g., HC-SR04): Sends ultrasonic waves and receives
the reflected echo to calculate the distance of objects.
o Servo Motor (Optional): Rotates the sensor to cover a specified
angular range (e.g., 0°–180°) for scanning.

2. Processing Subsystem:
o Arduino Microcontroller: Receives data from the ultrasonic
sensor, processes it to calculate distances, and controls the servo
motor.

3. Output Subsystem:
o Visualization Interface (PC/Display): Displays radar data in real- time using
a graphical interface (e.g., Processing IDE or LCD).

Alert System (Optional): LEDs or buzzers for warnings when objects are detected

V.J.Shinde POLYTECHNIC DHARASHIV 16


Radar System using arduino

4.2 Hardware Design


Hardware Components

1. Arduino Board: Acts as the brain of the system.


2. Ultrasonic Sensor (HC-SR04): Measures distances by emitting and
receiving ultrasonic waves.
3. Servo Motor: Rotates the ultrasonic sensor to scan the environment (optional
for a static system).
4. LCD Display: Displays distance and object detection data (optional if not using a
PC interface).
5. Power Supply: Supplies power to the Arduino and connected components.
6. Jumper Wires and Breadboard: For easy connections during prototyping.

V.J.Shinde POLYTECHNIC DHARASHIV 17


Radar System using arduino

 Circuit Diagram

 Connections for Ultrasonic Sensor (HC-SR04):


o VCC → 5V on Arduino.
o GND → GND on Arduino.
o Trigger Pin → Digital Pin (e.g., D9).
o Echo Pin → Digital Pin (e.g., D10).
 Connections for Servo Motor:
o Signal Pin → Digital Pin (e.g., D6).
o VCC → 5V on Arduino.
o GND → GND on Arduino.
 Optional LCD Connections (16x2 LCD):
Connect via I2C module or standard pin configuration

V.J.Shinde POLYTECHNIC DHARASHIV 18


Radar System using arduino

4.3 Software Design

The software involves coding in Arduino IDE to control the hardware and transmit data to a
visualization tool.

Flowchart

1. Initialize Components: Set up the ultrasonic sensor, servo motor, and


serial communication.

2. Start Scanning:
o Rotate the servo motor to a specific angle (for rotational scanning).
o Trigger the ultrasonic sensor to emit pulses.
o Measure the time of echo return and calculate distance.

3. Process Data:
o Map the distance and angle for object localization.
o Send data to the visualization tool or display.

4. Display Results:
o Update the radar visualization in real-time.
o Trigger alerts for objects in the critical range.

5. Repeat Scanning: Continue the process to cover the desired range.

V.J.Shinde POLYTECHNIC DHARASHIV 19


Radar System using arduino

5.0 Requirements of Radar System Using Arduino

5.1 Functional Requirements

1) These define the behavior of the system under specific conditions:

2) Arduino must control servo movement precisely between 0° to 180°.

3) The ultrasonic sensor must measure distance within 2cm to 400cm.

4) Real-time data must be transmitted to the PC via serial port.

5) Processing must display a radar-like graphical output.

6) The radar system must update data continuously during operation.

V.J.Shinde POLYTECHNIC DHARASHIV 20


Radar System using arduino

5.2 Non-Functional Requirements

1) These relate to system performance and usability:

2) Real-time Operation: The radar must respond and display object data with minimal delay.

3) User Interface: Graphical output should be clear, intuitive, and responsive.

4) Portability: The system should be compact and easy to transport.

5) Accuracy: Distance measurements should be consistent and within 5% margin of error.

6) Maintainability: Code should be modular and easy to debug or extend.

V.J.Shinde POLYTECHNIC DHARASHIV 21


Radar System using arduino

5.3 Implicit Requirements

These are clearly stated, measurable, and directly requested or needed for the radar system to
function as intended:

1. Object Detection:

The system must detect objects using the HC-SR04 ultrasonic sensor.

2. Servo Rotation:

The servo motor must rotate the sensor across a range of 0° to 180°.

3. Distance Measurement:

The sensor must measure the distance between itself and an object, and send this data to
the Arduino.

4. Serial Communication:

The Arduino must send angle and distance data to the PC via USB serial.

5. Radar Display:

The Processing IDE must graphically visualize real-time data in a radar-like interface.

6. Power Supply: The system must operate on USB or 5V battery power.

7. Real-time Operation:

The radar must detect and display object data continuously and without manual input
during runtime.

8. Component Integration:

Arduino, ultrasonic sensor, and servo motor must be physically and logically integrated.

V.J.Shinde POLYTECHNIC DHARASHIV 22


Radar System using arduino

5.4 Explicit Requirements

These are not directly stated but are necessary for the system to work effectively and be usable:

1. Calibration:

The system should automatically or manually calibrate sensor readings for accuracy.

2. Error Handling:

The code should handle cases where no object is detected or if invalid readings occur.

3. Responsiveness:

The system should respond to environmental changes with minimal lag.

4. User-Friendly Interface:

The graphical interface should be clear and easy to understand, even for non-technical users.

5. Compact Design:

The hardware layout should be organized, safe, and compact for ease of use and portability.

6. Modular Code Design:

The code should be modular for easy updates, upgrades, or integration with other systems.

7. Data Consistency:

The system should consistently transmit accurate and timely data without interruptions.

8. Noise Reduction:

The software should smooth noisy data or filter out invalid distance spikes caused by echo misreads.

V.J.Shinde POLYTECHNIC DHARASHIV 23


Radar System using arduino

6.0 Skill Developed / Learning Outcomes of Project

Skills Developed / Learning Outcomes (in Short)

1. Arduino Programming: Learn to code microcontrollers for sensor and motor control.
2. Sensor Interfacing: Gain hands-on experience with ultrasonic sensors (HC-SR04)
for distance measurement.
3. Servo Motor Control: Control servo motors for scanning and rotation.
4. Data Communication: Implement serial communication to transfer data
between Arduino and PC.
5. GUI Development: Create graphical user interfaces (GUIs) using
Processing for real-time radar visualization.
6. Problem Solving & Debugging: Troubleshoot hardware and software issues
for smooth system operation.
7. Radar System Concepts: Understand the basics of radar systems, object detection,
and robotics.
8. Project Management: Learn to plan, design, and build a complete system
from scratch.
9. Real-Time Data Processing: Handle real-time sensor data and visualize it effectively.
10. Documentation: Develop skills in documenting and presenting technical project

V.J.Shinde POLYTECHNIC DHARASHIV 24


Radar System using arduino

7.0 Application of Restaurant Management System

- Robotics: Obstacle detection and navigation

- Security: Intruder detection in restricted zones

- Vehicles: Parking assistant systems

- Education: Learning tool for embedded systems

- Home Automation: Smart object tracking


Radar System using arduino
8.1. Working Principal :-

 How It Works:

1. Arduino Code:

o Controls the servo motor to rotate the ultrasonic sensor between

angles (15° to 165° and back).

o Measures the distance to objects using the HC-SR04 ultrasonic sensor.

o Sends angle and distance data to the PC via the serial port in the format

<angle>,<distance>..

2. Processing Code:

o Reads the serial data from the Arduino.

o Parses the data into angle and distance values.

o Visualizes the data on a radar-like interface with:

 Concentric arcs representing distance ranges.

 A rotating "sweep line."

 Red blips indicating detected objects.

o Displays angle and distance as text.


Radar System using arduino
 Setup Steps

1. Hardware Setup:

o Connect the servo motor to pin 12 of the Arduino.

o Connect the HC-SR04 sensor to pins 10 (Trig) and 11 (Echo) as defined

in the Arduino code.

o Ensure your Arduino is powered via USB.

2. Software Setup:

o Upload the Arduino code to your Arduino board using the Arduino IDE.

o Open the Processing IDE on your computer

o Adjust the COM port in the myPort line of the Processing code to match

your Arduino's port (e.g., COM7 on Windows, /dev/ttyUSBx on

Linux/Mac).

Run the Processing code to see the radar visualization


Radar System using arduino
 Expected Output:-

 Radar Display:

o A circular screen with concentric arcs representing different

distance ranges.

o A rotating green line representing the radar sweep.

o Red dots/blips for detected objects based on angle and distance.

 Text Display:

o Angle of the current radar sweep.

o Distance of detected objects.

o System label as "Radar System."

5.2 The radar system operates in the following sequence:

1. Triggering the Ultrasonic Sensor:


o The Arduino sends a pulse to the Trig pin of the ultrasonic sensor,
initiating the emission of an ultrasonic wave.

o The sensor waits for the pulse to reflect off any nearby object and return
to the Echo pin.

o The time it takes for the pulse to return is measured.


Radar System using arduino

2. Calculating the Distance:


o Using the formula:-

Distance=Time×Speed of Sound2\text{Distance} = \frac{\text{Time} \times

1. Visualization:
o Processing receives the angle and distance data and creates a radar-
like display on the screen.
o The system visually represents the detected objects by drawing lines
that indicate the distance and angle at which the objects are detected
Radar System using arduino

1. Servo Control:

o The servo motor is controlled by the Arduino to rotate the ultrasonic


sensor through different angles (typically 15° to 165°).
o This allows the system to scan a wide area and measure distances at
various angles.
2. Data Transmission:

o The Arduino sends the angle and distance data to the


o Processing software over serial communication.

3. Visualization:

o Processing receives the angle and distance data and creates a radar-
like display on the screen.
o The system visually represents the detected objects by drawing lines
that indicate the distance and angle at which the objects are detected.

30
Radar System using arduino

9.0Actual Code :

 Arduino Code :-

#include <Servo.h>

const int trigPin = 10; const


int echoPin = 11; const int
servoPin = 12;

long duration; int


distance; Servo
myServo;

void setup()
{ pinMode(trigPin,
OUTPUT);
pinMode(echoPin, INPUT);
Serial.begin(9600);
myServo.attach(servoPin);
}

void loop() {
// Sweep from 15 to 165 degrees
sweepServo(15, 165, 1);
// Sweep back from 165 to 15 degrees
sweepServo(165, 15, -1);
}

void sweepServo(int startAngle, int endAngle, int step) {


for (int angle = startAngle; angle != endAngle; angle += step) {
myServo.write(angle);
delay(30);
distance = calculateDistance();
31
Radar System using arduino

if (distance > 0) { // Only print if distance is valid


Serial.print(angle);
Serial.print(",");
Serial.print(distance);
Serial.print(".");
}
}
}

int calculateDistance()
{ digitalWrite(trigPin,
LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

if (duration == 0) {
return -1; // No valid reading
} else {
return duration * 0.034 / 2;
}
}

32
Radar System using arduino

 Description of Ardunio code :-

This Arduino code is designed to control a basic radar system using an ultrasonic sensor (HC-SR04) and
a servo motor. Here's how it works:

1. Initialization:

The servo motor is connected to pin 12.

The ultrasonic sensor's trigger and echo pins are connected to pins 10 and 11 respectively.

The Servo library is used to control the servo's angle.

2. Servo Movement:

The servo motor continuously sweeps from 15° to 165° and then back from 165° to 15°, simulating a
radar sweep.

3. Distance Measurement:

At each angle, the ultrasonic sensor sends a pulse and measures the distance to the nearest object.

Distance is calculated using the time it takes for the echo to return.

4. Data Output:

If a valid distance is detected, the Arduino sends the angle and distance in the format angle,distance. via
serial communication.

This data can be read and visualized by a computer using Processing or other software to simulate a
radar interface.

33
Radar System using arduino

 Processing code :-

import processing.serial.*;
import java.awt.event.KeyEvent;
import java.io.IOException;

Serial myPort;
String angle = "";
String distance = "";
String data = "";
String noObject;
float pixsDistance;
int iAngle = 0, iDistance = 0;
int index1 = 0;
int index2 = 0;
PFont orcFont;

boolean objectDetected = false; // Flag to check if an object is


detected long detectionTime = 0; // Time when the object was
detected
long pauseDuration = 1000; // Pause duration in milliseconds (6 seconds)

void setup() {
size(1200, 700); // **CHANGE THIS TO YOUR SCREEN RESOLUTION**
smooth();
myPort = new Serial(this, "COM7", 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);

// Simulating motion blur and slow fade of the moving line


noStroke();
34
Radar System using arduino
fill(0, 4);
rect(0, 0, width, height - height * 0.065);

35
Radar System using arduino

fill(98, 245, 31); // Green color

// Calls the functions for drawing the radar


drawRadar();
drawLine();
drawObject();
drawText();

// Resume scanning after 6 seconds if paused


if (objectDetected && millis() - detectionTime > pauseDuration)
{ objectDetected = false; // Reset the flag
}
}

void serialEvent(Serial myPort)


{ if (objectDetected) {
return; // Stop updating if an object is detected and within the pause duration
}

// 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); // Reads the data from position "0" to position of the variable index1
(angle)
distance = data.substring(index1 + 1, data.length()); // Reads the data from position "index1" to the end
(distance)

// Converts the String variables into Integer


iAngle = int(angle);
iDistance = int(distance);

// Check if an object is within range


if (iDistance < 40) {
objectDetected = true; // Pause the radar sweep

36
Radar System using arduino

detectionTime = millis(); // Record the time of detection


}
}

void drawRadar() {
pushMatrix();
translate(width / 2, height - height * 0.074); // Moves the starting coordinates to new location
noFill();
strokeWeight(2);
stroke(98, 245, 31);

// 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);

// Draws the angle lines


line(-width / 2, 0, width / 2, 0);
for (int angle = 30; angle <= 150; angle += 30) {
line(0, 0, (-width / 2) * cos(radians(angle)), (-width / 2) * sin(radians(angle)));
}

popMatrix();
}

void drawObject() {
pushMatrix();
translate(width / 2, height - height * 0.074); // Moves the starting coordinates to new location
strokeWeight(10); // Makes the dot more visible
stroke(255, 10, 10); // Red color for the dot

// Converts the distance in cm to pixels


pixsDistance = iDistance * ((height - height * 0.1666) * 0.025);

// Limits the range to 40 cm


37
Radar System using arduino

if (iDistance < 40) {


// Draws a red dot at the calculated position
point(pixsDistance * cos(radians(iAngle)), -pixsDistance * sin(radians(iAngle)));
}
popMatrix();
}

void drawLine() {
pushMatrix();
strokeWeight(9);
stroke(30, 250, 60);
translate(width / 2, height
-
line(0, 0, (height - height * 0.12) * cos(radians(iAngle)), -(height - height * 0.12) *
sin(radians(iAngle)));
popMatrix();
}

void drawText() { // Draws the text on the screen


pushMatrix();
if (iDistance > 40)
{ noObject = "Out of
Range";
} else {
noObject = "In Range";
}

fill(0, 0, 0);
noStroke();
rect(0, height - height * 0.0648, width, height);
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);

38
Radar System using arduino

textSize(40);

39
Radar System using arduino

text("GPD Radar System", width - width * 0.875, height - height * 0.0277);


text("Angle: " + iAngle + " °", width - width * 0.48, height - height * 0.0277);
text("Dist: ", width - width * 0.28, height - height * 0.0277);
if (iDistance < 40) {
text(" " + iDistance + " cm", width - width * 0.225, height - height * 0.0277);
}

textSize(25);
fill(98, 245, 60);
for (int angle = 30; angle <= 150; angle += 30) {
translate((width / 2) * cos(radians(angle)), -(width / 2) *
sin(radians(angle))); rotate(-radians(90 - angle));
text(angle + "°", 0, 0);
resetMatrix();
}
popMatrix();
}

40
Radar System using arduino

 Description of Processing Code :-

1. Serial Communication:

Connects to the Arduino via the specified COM port (COM7) at 9600 baud.

Reads angle and distance data sent in the format angle,distance.

2. Data Parsing:

Splits the serial input into angle and distance values.

Converts the strings into integers (iAngle, iDistance).

3. Radar Visualization:

Simulates a sweeping radar screen with:

Green arc lines (range rings).

Rotating radar line (sweep).

Red dots for detected objects.

Limits visual range to 40 cm for accurate and clean display.

4. Object Detection & Pause Logic:

If an object is detected within 40 cm, the radar sweep pauses for 1 second, mimicking real radar
behavior.

41
Radar System using arduino

5. User Interface:

Displays real-time angle and distance readings.

Shows “In Range” or “Out of Range” messages.

Labels at 10, 20, 30, and 40 cm for better scale visibility.

42
Radar System using arduino

Actual Output :

 When object is detected

 Description of output :-
 Key Elements:-

Green Sweeping Arc: Represents the radar scanning area.

Red Dots: Indicates detected object(s) within a certain distance (e.g., <40 cm).

 Angle and Distance Display:

Angle: 165°: Shows the current angle of the servo during the sweep.

Dist -: May be blank or updated shortly (usually shown with the object distance, such as "Dist: 19 cm").

Text Labels: Indicate distance rings like 10cm, 20cm, etc., which help measure how far the object

 Behavior:

When an object is detected within the critical range (e.g., <40 cm), a red dot appears at its
location on the radar. The system temporarily pauses for a short time (as coded) to highlight
detection clearly.

43
Radar System using arduino

 When no Object Detected :-

 Description of output :-

 Key Elements :-

Green Sweep Line: Continues scanning through the defined angles.

No Red Dots: No object detected within the radar's defined detection range.

 Angle and Distance :-

Angle: 17°: Shows current servo position.

Dist: 19 cm: Indicates no object close enough to trigger pause logic (if detection threshold is set to
< 15–20 cm).

Behavior: The radar sweep runs continuously without pausing, as nothing is detected within the
critical range. The system just displays real-time scanning with no red dots plotted on the radar
field.

44
Radar System using arduino

10.0 Conclusion:

The Radar System Using Arduino project provides a comprehensive learning


experience by combining various engineering concepts, including sensor interfacing, motor control, data
communication, and real-time visualization. It allows you to explore fundamental technologies used in radar
systems and robotics, while developing practical skills in Arduino programming, hardware integration, and
GUI development

Through this project, you not only gain hands-on experience with ultrasonic sensors and servo motors but
also learn how to design and implement a real- time system that communicates and visualizes data
effectively. This makes the project an excellent introduction to embedded systems, offering valuable
insights into object detection, distance measurement, and radar-like applications.

In conclusion, this project enhances your problem-solving abilities, boosts your understanding of radar
technologies, and helps you gain proficiency in both hardware and software development—skills that are
essential for anyone interested in the field of electronics, robotics, and embedded systems

45
Radar System using arduino

11.0 References:

1. Arduino Official Documentation – https://www.arduino.com

2. Processing Language – https://processing.org

3. HC-SR04 Ultrasonic Sensor Datasheet – SparkFun Electronics

4. Banzi, M., & Shiloh, M. Getting Started with Arduino, Maker Media

5. Techiesms – Radar System using Arduino and Processing (YouTube)

6.Instructables – Arduino Radar System Project Gui

46

You might also like