Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
38 views13 pages

Ultrasonic Radar Project Report

The Ultrasonic Radar project utilizes Arduino and electronic components to detect objects and visualize their position and distance. It features a buzzer for alerts when objects are within 10 cm and includes a graphical interface for real-time data display. This project showcases the integration of sensors and microcontrollers for practical applications in various fields such as security and robotics.
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)
38 views13 pages

Ultrasonic Radar Project Report

The Ultrasonic Radar project utilizes Arduino and electronic components to detect objects and visualize their position and distance. It features a buzzer for alerts when objects are within 10 cm and includes a graphical interface for real-time data display. This project showcases the integration of sensors and microcontrollers for practical applications in various fields such as security and robotics.
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/ 13

DELHI TECHNOLOGICAL UNIVERSITY

(Formerly Delhi College of Engineering)


Shahbad Daulatpur, Bawana Road, Delhi 110042

Course Code: EC-106

Submitted By: Ayush Raj(24/A11/064)


Agrim Daima (24/B14/007)
ECE-1
1st Year, Semester II

1
Acknowledgement

We are deeply indebted to the Department of Electronics and


Communication Engineering for their inspiring and encouraging
guidance. Despite their busy schedule, they always made time
to address the challenges we faced during our project work.
Their continuous support and insightful advice have been
invaluable to the successful completion of this project. Their
expertise and enthusiasm were evident in every interaction. He
provided quick and precise analyses, comprehensive solutions,
and critical reviews that significantly enhanced our work. Their
ability to simplify complex concepts and provide clear direction
was instrumental in overcoming the obstacles we encountered.
Their dedication to mentoring us and his unwavering
commitment to our success are truly appreciated.
We extend our heartfelt thanks to the staff of the Department
of Electronics and Communication Engineering. Their patience,
cooperation, and assistance have been crucial in facilitating our
project work. The staff's willingness to help and their prompt
support enabled us to navigate through various administrative
and technical hurdles.
In conclusion, we express our sincere gratitude to their
collective efforts, encouragement, and support have been
pivotal in the accomplishment of this project. We are profoundly
grateful for their contributions and the positive impact they
have had on our academic journey.

2
Ultrasonic Radar Project Report
Introduction
The Ultrasonic Radar project is a practical implementation of radar-like
technology using Arduino and basic electronic components. It aims to
detect objects within a specified range and visualize their position and
distance on a graphical interface. This project incorporates improvements
such as the addition of a buzzer that rings when an object is detected
within the range, enhancing its functionality compared to traditional
designs.

The core components used in this project include:

 Arduino Uno R3: A microcontroller board for processing data.

 Ultrasonic Sensor: Measures the distance to nearby objects by


emitting sound waves and receiving their echoes.

 Servo Motor: Rotates the ultrasonic sensor to cover a wider area.

 Buzzer: Provides an audible alert when an object is detected within


10 cm.

 Breadboard and Jumper Wires: Facilitate circuit connections.

 Java Processing Code: Visualizes the radar data on a computer


screen.

This report elaborates on the project's design, working principles, and


outcomes, while leaving placeholders for images to illustrate various
aspects of the system.

Aim
The objective of this project is to develop a radar system capable of
detecting objects under challenging conditions and determining their
distance and position with precision. The addition of a buzzer enhances its
usability by providing audible feedback for nearby obstacles.

Components Used

1. Arduino Uno R3

2. Ultrasonic Sensor (HC-SR04)

3. Servo Motor

4. Buzzer

3
5. Breadboard

6. Jumper Wires

7. Arduino Connector

Circuit Description

The circuit consists of an Arduino Uno R3 connected to an ultrasonic


sensor, servo motor, buzzer, and other components via a breadboard. The
ultrasonic sensor is mounted on the servo motor, which rotates to scan
the surroundings. The Arduino processes distance data from the sensor
and controls the servo motor's rotation. If an object is detected within 10
cm, the buzzer rings to alert the user.

4
Working Principle
1. Distance Measurement:

o The ultrasonic sensor emits sound waves through its trigger


pin.

o These waves reflect off nearby objects and return to the


sensor's echo pin.

2. Servo Motor Rotation:

o The servo motor rotates from 0° to 90° and back, scanning the
surroundings.

o At each angle, the ultrasonic sensor measures distances.

3. Buzzer Alert:

o If an object is detected within 10 cm, the Arduino activates the


buzzer.

4. Visualization:

o Data (angle and distance) is sent to a computer via serial


communication.

o A Java Processing code visualizes this data as a radar-like


display.

Arduino Code
5
Below is the Arduino sketch used in this project:

#include <Servo.h>

#define trigPin 8
#define echoPin 9
#define buzzer 7 // Buzzer connected to pin 7

long duration;
int distance;

Servo myservo;

int calculateDistance() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;
return distance;
}

void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(buzzer, OUTPUT); // Set buzzer pin as output
myservo.attach(11);
Serial.begin(9600);
}

void loop() {
int i;
for (i = 0; i <= 90; i++) {
myservo.write(i);
delay(15);
int dist = calculateDistance();

Serial.print(i);
Serial.print(",");
Serial.print(dist);
Serial.print(".");

// Activate buzzer if object is detected within 10 cm


if (dist > 0 && dist <= 10) {
digitalWrite(buzzer, HIGH);
} else {
digitalWrite(buzzer, LOW);

6
}
}

for (i = 90; i >= 0; i--) {


myservo.write(i);
delay(15);
int dist = calculateDistance();

Serial.print(i);
Serial.print(",");
Serial.print(dist);
Serial.print(".");

// Activate buzzer if object is detected within 10 cm


if (dist > 0 && dist <= 10) {
digitalWrite(buzzer, HIGH);
} else {
digitalWrite(buzzer, LOW);
}
}
}

Java Processing Code


The following code visualizes radar data in real-time:

import processing.serial.*; // imports library for serial communication


import java.awt.event.KeyEvent; // imports library for reading the data from the
serial port
import java.io.IOException;
Serial myPort; // defines Object Serial
// defubes variables
String angle="";
String distance="";
String data="";
String noObject;
float pixsDistance;
int iAngle, iDistance;
int index1=0;
int index2=0;
PFont orcFont;
void setup() {

size (1600, 900); // ***CHANGE THIS TO YOUR SCREEN RESOLUTION***


smooth();
myPort = new Serial(this, "COM3", 9600); // starts the serial communication

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

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


// calls the functions for drawing the radar
drawRadar();
drawLine();
drawObject();
drawText();
}
void serialEvent (Serial myPort) { // starts reading data from the Serial Port
// 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
distance= data.substring(index1+1, data.length()); // read the data from position
"index1" to the end of the data pr thats the value of the distance

// converts the String variables into Integer


iAngle = int(angle);
iDistance = int(distance);
}
void drawRadar() {
pushMatrix();
translate(width/2, height-height*0.074); // moves the starting coordinats 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);

8
// Replace the angle lines in drawRadar() with:
line(-width/2, 0, width/2, 0); // 0 degrees (horizontal line)
line(0, 0, (-width/2)*cos(radians(15)), (-width/2)*sin(radians(15)));
line(0, 0, (-width/2)*cos(radians(30)), (-width/2)*sin(radians(30)));
line(0, 0, (-width/2)*cos(radians(45)), (-width/2)*sin(radians(45)));
line(0, 0, (-width/2)*cos(radians(60)), (-width/2)*sin(radians(60)));
line(0, 0, (-width/2)*cos(radians(75)), (-width/2)*sin(radians(75)));
line(0, 0, (-width/2)*cos(radians(90)), (-width/2)*sin(radians(90)));

line((-width/2)*cos(radians(30)), 0, width/2, 0);


popMatrix();
}
// Modify drawLine() function:
void drawLine() {
pushMatrix();
strokeWeight(9);
stroke(30, 250, 60);
translate(width/2, height-height*0.074);
// Map the angle to fill the semicircle (0-90 degrees to 0-180 degrees)
float displayAngle = map(iAngle, 0, 90, 0, 180);
line(0, 0, (height-height*0.12)*cos(radians(displayAngle)), -(height-
height*0.12)*sin(radians(displayAngle)));
popMatrix();
}

// Modify drawObject() function:


void drawObject() {
pushMatrix();
translate(width/2, height-height*0.074);
strokeWeight(9);
stroke(255, 10, 10);
pixsDistance = iDistance*((height-height*0.1666)*0.025);
if (iDistance<40) {
// Map the angle to fill the semicircle
float displayAngle = map(iAngle, 0, 90, 0, 180);
line(pixsDistance*cos(radians(displayAngle)), -
pixsDistance*sin(radians(displayAngle)),
(width-width*0.505)*cos(radians(displayAngle)), -(width-
width*0.505)*sin(radians(displayAngle)));
}
popMatrix();
}

void drawText() { // draws the texts on the screen

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

9
} 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);
textSize(40);
text("N_Tech ", width-width*0.875, height-height*0.0277);
text("Angle: " + iAngle +" ", width-width*0.48, height-height*0.0277);
// Replace the existing distance text code in drawText() with this:
text("Distance: ", width-width*0.28, height-height*0.0277);
if (iDistance<40) {
text(iDistance +" cm", width-width*0.15, height-height*0.0277);
}

textSize(25);
fill(98, 245, 60);
// Add these angle labels in drawText() after "fill(98, 245, 60);"
// 0 degrees
translate((width-width*0.5)+width/2*cos(radians(0)), (height-height*0.0907)-
width/2*sin(radians(0)));
rotate(radians(0));
text("0", 0, 0);
resetMatrix();

// 15 degrees
translate((width-width*0.5)+width/2*cos(radians(15)), (height-height*0.0907)-
width/2*sin(radians(15)));
rotate(-radians(-75));
text("15", 0, 0);
resetMatrix();

// 30 degrees
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();

// 45 degrees

10
translate((width-width*0.5)+width/2*cos(radians(45)), (height-height*0.09)-
width/2*sin(radians(45)));
rotate(-radians(-45));
text("45", 0, 0);
resetMatrix();

// 60 degrees
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();

// 75 degrees
translate((width-width*0.505)+width/2*cos(radians(75)), (height-height*0.085)-
width/2*sin(radians(75)));
rotate(-radians(-15));
text("75", 0, 0);
resetMatrix();

// 90 degrees
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();

popMatrix();
}

Team Members
1. Ayush raj(24/A11/064)

2. Agrim daima(24/B14/007)

All team members are students at Delhi Technological University.

11
Results
The Ultrasonic Radar successfully detects objects within its range and
provides audible alerts through the buzzer when obstacles are close
(within 10 cm). The radar visualization effectively displays real-time data
on a graphical interface.

Conclusion
This project demonstrates how sensors and actuators can be integrated
with microcontrollers to create functional systems for object detection and
visualization. The addition of a buzzer enhances its practicality by

12
providing immediate feedback for close obstacles. Such systems have
potential applications in security systems, robotics navigation, and
autonomous vehicles.

13

You might also like