Sei sulla pagina 1di 24

ARDUINO BASED RADAR SYSTEM

A Synopsis

Submitted in partial fulfillment of the requirement for the award of Degree of Bachelor of
Engineering in Electronics and Communication Engineering
BE VII Sem

Submitted to:-

RAJIV GANDHI PROUDYOGIKI VISHWAVIDYALAYA,


BHOPAL (M.P.)
Submitted By:
Students Name:-Nikhil Prasad Enrollment No 0808EC141050
Students Name:-Nitin Jain Enrollment No 0808EC141054
Students Name:-Kamlesh Bairagi Enrollment No 0808EC141034

Under the Supervision of:

Guide Name:- Mr. Aashish sharma sir


Designation:- Professor

IPS Academy, Indore


Institute of Engineering and Science
Department of Electronics & Communication Engineering
Session: 2017-18

1
IPS ACADEMY INDORE
INSTITUTE OF ENGINEERING & SCIENCE
DEPARTMENT OF ELECTRONICS AND COMMUNICATION
ENGINEERING

CERTIFICATE

This is to certify that the work embodies in the synopsis entitled ARDUINO BASED RADAR
SYSTEM being submitted by Nikhil Prasad (Roll No.: 0808EC141050), NitinJain (Roll
No.: 0808EC141054), Kamlesh Bairagi (Roll No: 0808EC141034) for partial fulfillment of the
requirement for the award of Bachelor of Engineering in Electronics and Communication
Engineering BE VII Sem to Rajiv Gandhi Proudyogiki Vishwavidyalaya, Bhopal (M.P.), during the
academic year 2017-18 is a record of bonafide piece of work, carried out by them under our
supervision and guidance in the Department of Electronics and Communication Engg., IPS
Academy, IES Indore (M.P.).

Approved and Supervised by: Forwarded By:

Mr. Aashish sharma Sir Prof. Rupesh Dubey


Professor H.O.D. of EC
Department of EC

2
DECLARATION

We Nikhil Prasad (Roll No.: 0808EC141050), Nitin Jain (Roll No.: 0808EC141054),
Kamlesh Bairagi (Roll No: 0808EC141034), the students of Bachelor of Engineering in Electronics
and Communication Engineering, session: 2017-18, IPS Academy, IES Indore (M.P.), hereby
declare that the work presented in this Synopsis entitled ARDUINO BASED RADAR SYSTEM
is the outcome of our own work, is bonafide and correct to the best of our knowledge and this work
has been carried out taking care of Engineering Ethics.

Nikhil Prasad
Enrollment No.: 0808EC141050

Nitin Jain
Enrollment No.: 0808EC141054

Kamlesh Bairagi
Enrollment No.: 0808EC141034

Date:

3
ACKNOWLEDGEMENT

We want to thanks our Project Supervisor Aashish Sharma, Professor, Department of Electronics and
Communication Engineering, Faculty of Engineering, IES IPS ACADEMY. For his encouragement
and for giving us permission to involve with this electronics project. We have done our project
according to his direction. We are also grateful to our respected teachers.

We thank all staffs of our departmental lab for their help during working period. We are extremely
grateful to our parents, family member and friends for their support, constant love and sacrifice.

Finally, we beg pardon for our unintentional errors and omission if any.

4
ABSTRACT

This project aims at designing and executing the advanced development in embedded systems for
energy saving of lights. Nowadays, human has become too busy, and is unable to find time even to
switch the lights wherever not necessary. The present system is like the lights will be switched on in
the evening before the sun sets and they are switched off the next day morning after there is
sufficient light on the outside. But the actual timing for these lights to be switched on are when there
is absolute darkness. With this, the power will be wasted up to some extent. This paper gives the best
solution for electrical power wastage. Also the manual operation of the lighting system is completely
eliminated.

5
CONTENTS:

1. CHAPTER1 INTRODUCTION8
1.1. DEFINITION OF RADAR.8

2. CHAPTER 2 COMPONENTS NEEDED..9-11


2.1. ARDUINO UNO..9
2.2. SG 90 SERVO METER..10
2.3. ULTRASONIC SENSOR HC SR04.11

3 CHAPTER3 .BUILDING OF DEVICE12-13


3.1CIRCUIT SCHEMATICS..12
3.2 STEPS INVOLVED...13

4. CHAPTER 4 SOFTWATE DESCRIPTION14-21


4.1 SOURCE CODES ..15
4.2 PROCESSING CODES17
4.3 RADAR OUTUT..21

5. CHAPTER 5 APPLICATIONS AND ADVANTAGES OF RADAR.22-23


5.1 APPLICATION OF RADAR22
5.2 ADVANTAGES OF RADAR...22
5.3 REFERENCES..23

6
LIST OF FIGURES

1. Fig.2.1 Arduino UNO9

2. Fig.2.2 Ultrasonic Sensor.10

3. Fig.2.3 Servo Motor..11

4. Fig3.1 Circuit Diagram.12

5. Fig.3.2 Radar System13

6. Fig.4.1 Arduino IDE.14

7. Fig.6.1 Radar Outut..21

7
CHAPTER -1
INTRODUCTION

1.1 DEFINITION OF RADAR

RADAR is an object detection system which uses radio waves to determine the range,
altitude and direction of objects. The radar transmits pulses of radio waves or
microwaves which bounce off any object in their path. Arduino is a single-board
microcontroller to make using electronics in multidisciplinary projects more
accessible. This project aims at making a RADAR that is efficient, cheaper and
reflects all the possible techniques that a radar consists of. Ultrasonic sensor transmits
the signal in all direction and if any obstacle that is target is detected then echo pulse
sense. The beauty of the project is it saves the target data and moves the camera in the
target direction. Furthermore, this project can be enhanced by using a laser gun. When
the target is detected then at this proper direction gun is fired. Arduino controller and
ultrasonic sensor is the base of this project.
Radar was developed secretly for military use by several nations in the period before
and during World War II. A key development was the cavity magnetron in the UK,
which allowed the creation of relatively small systems with sub-meter resolution. The
term RADAR was coined in 1940 by the United States Navy as
an acronym for RAdio Detection And Ranging or RAdio Direction And Ranging. The
term radar has since entered English and other languages as a common noun,losing all
capitalization.
Keywords: GSM, Ultrasonic sensor, Arduino, Servo motor

8
CHAPTER-2
COMPONENTS NEEDED

2.1 ARDUINO
The Arduino microcontroller is an easy to use yet powerful single board
computer that has gained considerable traction in the hobby and professional
market.
The Arduino is open-source, which means hardware is reasonably priced and
development software is free

FIG2.1 ARDUINO UNO

9
2.2 ULTRASONIC TRANSMITTER AND RECIVER

Ultrasonic sensors (also known as transceivers) work on a principle similar to


radar or sonar which evaluate attributes of a target by interpreting the echoes
from radio or sound waves respectively.
Ultrasonic sensors generate high frequency sound waves and evaluate the
echo which is received back by the sensor.

FIG2.2 ULTRASONIC SENSOR

FEATURES
Use for motion or distance sensing
Frequency: 40kHz 1.0kHz
Capacitance: 2000Pf 20%
Transmitter: bandwidth 5.0kHz/100Db, sound pressure level 112Db/40
1.0kHz
10
2.3 SERVO MOTOR

A servomotor is a rotary actuator that allows for precise control of angular position,
velocity and acceleration. It consists of a suitable motor coupled to a sensor for
position feedback. It also requires a relatively sophisticated controller, often a
dedicated module designed specifically for use with servomotors. Servomotors are
not a different class of motor, on the basis of fundamental operating principle, but
uses servomechanism to achieve closed loop control with a generic open loop motor.
Servomotors are used in applications such as robotics, CNC machinery or automated
manufacturing.

FIG2.3 SERVO MOTOR

11
CHAPTER-3

BUILDING THE DEVICE

3.1 Circuit Schematics


We connected the Ultrasonic Sensor HC-SR04 to the pins number 10 and 11 and the
servo motor to the pin number 12 on the Arduino Board.

FIG3.1 CIRCUIT DIAGRAM

12
3.2 STEPS INVOLVED

First I made a cardboard stand for connecting the Ultrasonic sensor to the
Servo motor. I folded it like its shown on the picture below, glued it and
secured to the servo motor using a screw like this
Also I attached a pin header on which I soldered 4 jumper wires for
connecting the sensor.
Finally I secured the servo motor to the Arduino Board using an elastic band.

FIG3.2 RADAR SYSTEM

13
CHAPTER-4

SOFTWARE DESCRIPTION

Arduino is an open source computer hardware and software company, project, and
user community that designs and manufactures single-board
microcontrollers and microcontroller kits for building digital devices and interactive
objects that can sense and control objects in the physical world. The project's products
are distributed as open-source hardware and software, which are licensed under
the GNU Lesser General Public License (LGPL) or the GNU General Public
License (GPL),[1] permitting the manufacture of Arduino boards and software
distribution by anyone. Arduino boards are available commercially in preassembled
form, or as do-it-yourself kits.
Arduino board designs use a variety of microprocessors and controllers. The boards
are equipped with sets of digital and analog input/output (I/O) pins that may be
interfaced to various expansion boards (shields) and other circuits. The boards feature
serial communications interfaces, including Universal Serial Bus (USB) on some
models, which are also used for loading programs from personal computers. The
microcontrollers are typically programmed using a dialect of features from the
programming languages C and C++. In addition to using traditional compiler
toolchains, the Arduino project provides an integrated development environment
(IDE) based on the Processing language project.

FIG4.1 AUDRINO IDE

14
4.1 SOURCE CODES
Now we need to make a code and upload it to the Arduino Board that will enable the
interaction between the Arduino and the Processing IDE.

Heres the Arduino Source Code with description of each line of the code:
1. // Includes the Servo library
2. #include <Servo.h>.
3.
4. // Defines Tirg and Echo pins of the Ultrasonic Sensor
5. const int trigPin = 10;
6. const int echoPin = 11;
7. // Variables for the duration and the distance
8. long duration;
9. int distance;
10.
11. Servo myServo; // Creates a servo object for controlling the servo motor
12.
13. void setup() {
14. pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
15. pinMode(echoPin, INPUT); // Sets the echoPin as an Input
16. Serial.begin(9600);
17. myServo.attach(12); // Defines on which pin is the servo motor attached
18. }
19. void loop() {
20. // rotates the servo motor from 15 to 165 degrees
21. for(int i=15;i<=165;i++){
22. myServo.write(i);
23. delay(30);
24. distance = calculateDistance();// Calls a function for calculating the distance
measured by the Ultrasonic sensor for each degree
25.
26. Serial.print(i); // Sends the current degree into the Serial Port
27. Serial.print(","); // Sends addition character right next to the previous value
needed later in the Processing IDE for indexing
28. Serial.print(distance); // Sends the distance value into the Serial Port
29. Serial.print("."); // Sends addition character right next to the previous value
needed later in the Processing IDE for indexing
30. }
31. // Repeats the previous lines from 165 to 15 degrees
32. for(int i=165;i>15;i--){
33. myServo.write(i);

15
34. delay(30);
35. distance = calculateDistance();
36. Serial.print(i);
37. Serial.print(",");
38. Serial.print(distance);
39. Serial.print(".");
40. }
41. }
42. // Function for calculating the distance measured by the Ultrasonic sensor
43. int calculateDistance(){
44.
45. digitalWrite(trigPin, LOW);
46. delayMicroseconds(2);
47. // Sets the trigPin on HIGH state for 10 micro seconds
48. digitalWrite(trigPin, HIGH);
49. delayMicroseconds(10);
50. digitalWrite(trigPin, LOW);
51. duration = pulseIn(echoPin, HIGH); // Reads the echoPin, returns the sound
wave travel time in microseconds
52. distance= duration*0.034/2;
53. return distance;
54. }

16
4.2 PROCESSING CODES

Now we will receive the values for the angle and the distance measured by the sensor
from the Arduino Board into the Processing IDE using the SerialEvent() function
which reads the data from the Serial Port and we will put the values of the angle and
the distance into the variables iAngle and iDistance. These variable will be used for
drawing the radar, the lines, the detected objects and some of the text.

Heres the complete Processing Source Code of the Arduino Radar:

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


2. import java.awt.event.KeyEvent; // imports library for reading the data from the
serial port
3. import java.io.IOException;
4.
5. Serial myPort; // defines Object Serial
6. // defubes variables
7. String angle="";
8. String distance="";
9. String data="";
10. String noObject;
11. float pixsDistance;
12. int iAngle, iDistance;
13. int index1=0;
14. int index2=0;
15. PFont orcFont;
16.
17. void setup() {
18.
19. size (1920, 1080);
20. smooth();
21. myPort = new Serial(this,"COM4", 9600); // starts the serial communication
22. myPort.bufferUntil('.'); // reads the data from the serial port up to the character
'.'. So actually it reads this: angle,distance.
23. orcFont = loadFont("OCRAExtended-30.vlw");
24. }
25.
26. void draw() {
27.
28. fill(98,245,31);
29. textFont(orcFont);
30. // simulating motion blur and slow fade of the moving line

17
31. noStroke();
32. fill(0,4);
33. rect(0, 0, width, 1010);
34.
35. fill(98,245,31); // green color
36. // calls the functions for drawing the radar
37. drawRadar();
38. drawLine();
39. drawObject();
40. drawText();
41. }
42.
43. void serialEvent (Serial myPort) { // starts reading data from the Serial Port
44. // reads the data from the Serial Port up to the character '.' and puts it into the
String variable "data".
45. data = myPort.readStringUntil('.');
46. data = data.substring(0,data.length()-1);
47.
48. index1 = data.indexOf(","); // find the character ',' and puts it into the variable
"index1"
49. 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
50. 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
51.
52. // converts the String variables into Integer
53. iAngle = int(angle);
54. iDistance = int(distance);
55. }
56.
57. void drawRadar() {
58. pushMatrix();
59. translate(960,1000); // moves the starting coordinats to new location
60. noFill();
61. strokeWeight(2);
62. stroke(98,245,31);
63. // draws the arc lines
64. arc(0,0,1800,1800,PI,TWO_PI);
65. arc(0,0,1400,1400,PI,TWO_PI);
66. arc(0,0,1000,1000,PI,TWO_PI);
67. arc(0,0,600,600,PI,TWO_PI);
68. // draws the angle lines
18
69. line(-960,0,960,0);
70. line(0,0,-960*cos(radians(30)),-960*sin(radians(30)));
71. line(0,0,-960*cos(radians(60)),-960*sin(radians(60)));
72. line(0,0,-960*cos(radians(90)),-960*sin(radians(90)));
73. line(0,0,-960*cos(radians(120)),-960*sin(radians(120)));
74. line(0,0,-960*cos(radians(150)),-960*sin(radians(150)));
75. line(-960*cos(radians(30)),0,960,0);
76. popMatrix();
77. }
78.
79. void drawObject() {
80. pushMatrix();
81. translate(960,1000); // moves the starting coordinats to new location
82. strokeWeight(9);
83. stroke(255,10,10); // red color
84. pixsDistance = iDistance*22.5; // covers the distance from the sensor from cm
to pixels
85. // limiting the range to 40 cms
86. if(iDistance<40){
87. // draws the object according to the angle and the distance
88. line(pixsDistance*cos(radians(iAngle)),-
pixsDistance*sin(radians(iAngle)),950*cos(radians(iAngle)),-
950*sin(radians(iAngle)));
89. }
90. popMatrix();
91. }
92.
93. void drawLine() {
94. pushMatrix();
95. strokeWeight(9);
96. stroke(30,250,60);
97. translate(960,1000); // moves the starting coordinats to new location
98. line(0,0,950*cos(radians(iAngle)),-950*sin(radians(iAngle))); // draws the line
according to the angle
99. popMatrix();
100. }
101.
102. void drawText() { // draws the texts on the screen
103.
104. pushMatrix();
105. if(iDistance>40) {
106. noObject = "Out of Range";
107. }
19
108. else {
109. noObject = "In Range";
110. }
111.fill(0,0,0);
112. noStroke();
113. rect(0, 1010, width, 1080);
114. fill(98,245,31);
115. textSize(25);
116. text("10cm",1180,990);
117. text("20cm",1380,990);
118. text("30cm",1580,990);
119. text("40cm",1780,990);
120. textSize(40);
121. text("Object: " + noObject, 240, 1050);
122. text("Angle: " + iAngle +" ", 1050, 1050);
123. text("Distance: ", 1380, 1050);
124. if(iDistance<40) {
125. text(" " + iDistance +" cm", 1400, 1050);
126. }
127. textSize(25);
128. fill(98,245,60);
129. translate(961+960*cos(radians(30)),982-960*sin(radians(30)));
130. rotate(-radians(-60));
131. text("30",0,0);
132. resetMatrix();
133. translate(954+960*cos(radians(60)),984-960*sin(radians(60)));
134. rotate(-radians(-30));
135. text("60",0,0);
136. resetMatrix();
137. translate(945+960*cos(radians(90)),990-960*sin(radians(90)));
138. rotate(radians(0));
139. text("90",0,0);
140. resetMatrix();
141. translate(935+960*cos(radians(120)),1003-960*sin(radians(120)));
142. rotate(radians(-30));
143. text("120",0,0);
144. resetMatrix();
145. translate(940+960*cos(radians(150)),1018-960*sin(radians(150)));
146. rotate(radians(-60));
147. text("150",0,0);
148. popMatrix();

20
4.3 RADAR OUTUT

Heres the final appearance of the radar:

FIG.4.1 RADAR OUTUT

21
CHAPTER-5

APPLICATION AND ADVANTAGES OF RADAR

5.1 APPLICATIONS OF RADAR

MILITARY
REMOTE SENSING
AIR TRAFFIC CONTROL
HIGHWAY SECURITY
NAVIGATION
SHIP SECURITY
SACE(SATTELITES)

5.2 ADVANTAGES OF RADAR

The radar can see through the medium consisting of fog, snow, rain, darkness,
clouds etc.

Radar signal can penetrate and see through insulators

.It can help find out following parameters of object or target:


Range
Angular Position
Location of Target
Velocity of Target

It can distinguish fixed as well as moving target types.

22
23
5.3 REFERNCES

[1]

[2]

[3]

[4]

[5]

[6]

[7]

[8]

24