Prof. PhD eng. ec. ȚARCĂ Radu Cătălin [611642]
OBJECTS
RADAR
COORDINATOR:
Prof. PhD eng. ec. ȚARCĂ Radu Cătălin
STUDENT: [anonimizat]
2020
1
CONTENT
1. Introduction ………………………….. ………………………….. ……………………….. 2
2. Components ………………………….. ………………………….. ……………… 3
2.1 Arduino ………………………….. ………………………….. ………………………….. …. 3
2.2 Ultrasonic sensor ………………………….. ………………………….. ………………… 4
2.3 Servo motor ………………………….. ………………………….. ……………………….. 5
2.4 Breadboard ………………………….. ………………………….. ………………………… 6
3. Functionality ………………………….. ………………………….. ……………………….. 7
4. Radar graphics ………………………….. ………………………….. …………………… 10
5. Conclusion ………………………….. ………………………….. …………………………. 15
Webography ………………………….. ………………………….. ………………………….. . 16
Bibliography ………………………….. ………………………….. ………………………….. 16
2
1. Introduction
I would like to introduce my project by presenting a short history about radars.
Radar technology was discovered by Heinrich Hertz when he experimented the using of radio
waves in his laboratory in 1887. He discovered through the experiments that these waves are
reflected by only some of the materials even that he sent the waves through many different
materials. 13 years later , Nikola Tesl a had a big discovery by noticing that radio waves that can be
detected are produced by large objects. So he anticipate that such echoes could be used in the naval
industry to find the pos ition of ships . Sir Robert Alexander Watson -Watt was the one that patented
the Radar under British patent law.
The word radar is coming from the term "radio detection and ranging". A radio wave is
known as an electromagnetic radiation. A radar is working by sending out a radio signal that will
bounce back off the target as a radio echo. The radar is capable of measuring the distance to the
target from the radar set. Main components of each radar are a transmitter, an antenna, a receiver,
and an indicator or a screen. As an example a radio wave strikes a ship and part of the wave is
coming back to the radar receiver . The echo signal is detected by the antenna. The returning echo
is sent to the receiver, where its strength is amplified. The echo can be seen on the indicator as an
image. The distance to a target is determined by the time it takes the signal to reach the target and
the echo to return. Radio signals travel at a known speed of 300 kilometers per second. If we send
a radio signal and it comes back in one second it means that the target must be half the distance ,
or 150 kilometers away.
Based on this radar principle I’ve got my idea for the project. In order to accomplish this
project I’ve used arduino environment with a n ultrasonic sensor and a servo motor. To simulate a
radar I prepared a stand where the servo motor to stand and on top of it I put the ultrasonic sensor.
The servo motor will rotate and the sensor will get the distance through the objects around. The
sensor and the motor where programme d in the arduino ide and the graphics that will show the
radar movement and objects distance where done in the processing software.
3
2. Components
In this section I will cover the components selection that I use in order to make this project.
2.1 Arduino
Fig. 1 Arduino nano board
Arduino is a well-known platform with a user -friendly software and hardware. An arduino
board is capable to read inputs as a color code identified by a sensor or a Facebook message and
turn it into an output like turn ing a LED in a sp ecific color or publishing something on a social
website . A board can be programmed to send a set of instructions to the microcontroller located
on the board. In order to do so you can use the Arduino Software and the Arduino programming
language . Because of its simple user friendly experience , it has been used in a large number of
different kind of applications . The software is simple to use for beginners, and also powerful for
advanced users. Can be used on any well know operating system . Everyone can use it to build
instruments that are at a low cost and a way to prove physics principles and chemistry at school or
at home, or to start to create automated systems or robots . Designers are build ing prototypes for
the clients to interact with , artists and musicians use it to experime nt with new ways of using
musical instruments. Arduino is the key tool in learn ing new things. Anyone, at any age can start
doing whatever they want by just following t he st ep by step instructions , or asking online where
is a large Arduino community. In the process of working with microcontrollers , Arduino simplifies
it, and it offers some advantage for everyone over other systems:
4
Inexpensive – In comparison to other microcontroller platforms , Arduino boards are
relatively inexpensive .
Cross -platform – The Arduino Software (IDE) runs on Windows, Macintosh OSX, and
Linux operating systems.
Simple, clear programming environment – The Arduino Software (IDE) is e asy-to-use
for beginners, yet flexible enough for advanced users to take advantage of as well.
Open source and extensible software – The Arduino software is published as open source
tools, available for extension by experienced programmers.
Open source a nd extensible hardware – The plans of the Arduino boards are published
under a Creative Commons license.
2.2 Ultrasonic sensor
Fig. 2 Ultrasonic sensor
Ultrasonic sensor or also known as an ultrasonic transducer uses non -contact ultrasound sonar
to me asure the distance to an object. It consists in one ultrasonic transmitter, one receiver , both
resembling like two speakers , and a c ontrol circuit. The work ing principle is very simple, the
transmitter emit a high frequency ultrasonic sound, which hit any solid objects that is nearby, and
the receiver gets the return echo. The time duration until the signal its takes to send and receive d
the waves will determine how far the object is from the sensor . The distance of the object is
measured without damaging the object and giving a accurate and precise position . That received
echo is then processed by the control unit which will calculate the time difference between the
signal being transmitted and received. This time can be used to calculate the distance between the
5
sensor and the reflecting object . The ultrasonic sensor comes with a wide range of applications
mainly targeting distance and direction measurements. Following are some important applications:
measurement of the speed and direction
mobile w ireless charging
medical ultrasonography
alarms for burglars
water d epth measurement
testing in a non -destructive manner
2.3 Servo motor
Fig. 3 Servo motor
Servo motor is a devices that rotate or push with great precision parts that are attached to it .
Servos are used in many of the things at home like toys, electronics or even greater machines like
cars and airplanes. For the bigger machines , servos are responsible for the back and forth levers
movements or to adjust and control steering.
A servo is simple and so reliable, which is a feature of them . Inside a servo is a small direct
current motor which is similar to what is inside a toy. The motor use a battery for the power and
spin at high rotations per minute, but unfortunately torque is lackin g. Multiple gears are slowing
down the motor speed while at the same time increasin g the torque. T he design of the gears
6
converts the speed of the motor to a much slower speed but also create more torque. Gears in a
servo motor are inexpensive and makes th em lighter and cheaper.
2.4 Breadboard
Fig. 4 Breadboard
A breadboard is a solderless device on which circuit elements can be placed. It is possible to
use it in the early stages of the design, for testing. There is nothing sticking on this which allows
easy circuit modification or error correction. In order to use the board the electronic components
or electronic circuits has to be inserted inside the holes and also if we connect multiple wires on
the same row it can intercommunicate . The breadboard connects all the holes by strips of metal
underneath. On the br eadboard the structure of the holes is not random, the top and bottom rows
are connected horizontally and the remaining holes are connected vertically. As I sad, breadboards
are not for production circuits, because there are some limitations in resistance and operate only
on low frequencies, usually less than 10 MHz.
7
3. Functionality
In this section I will cover the connections between components and then show how the code
was made so the components to work properly and display the data that I was looking for.
Fig. 6 Schematic of the circuits
In Fig. 6 are described the connections between all the components used in the project.
First of all I’ve connect the 5V and ground port of the arguing board to the breadboard in order to
give the components electricity. After this, I’ve connected the servo motor ground and 5V cable
to the breadboard. The servo motor comes with a third cable which is the signal and that one I
connected it to the pin 12 f rom the arduino board. For the ultrasonic sensor, I also connect the
positive and negative ports on the breadboard and after that the ultrasonic sensor comes with two
different ports, one is the trigger pin which I’ve connected to the pin 10 and the second one is the
echo pin which I’ve connected to the pin 11 of the arduino board.
8
After creating all the connections I’ve registered the components in the arduino ide.
1. #include <Servo.h>.
2. Servo myServo;
3. const int trigPin = 10;
4. const int echoPin = 11;
5. long duration;
6. int distance;
I’ve included the library for the servo motor and I’ve initialize it. After, I’ve assigned the
trigger pin and the echo pin from the ultrasonic sensor to the specific pin that each one was inserted
on the arduino board. The two constants duration and distance will be use later in code to store the
data from the ultrasonic sensor.
1. void setup() {
2. pinMode(trigPin, OUTPUT);
3. pinMode(echoPin, INPUT);
4. Serial.begin(9600);
5. myServo.attach(12);
6. }
Setup function sets the trigPin and echoPin roles, as a emitter and receiver. Serial is being set
to de number 9600 which represents the port that will communicate later with the graphics in the
processing software ide. The servo motor object is being assigned to the port that the signal cable
was plugged into arduino.
1. int calculateDistance(){
2. digitalWrite(trigPin, LOW);
3. delayMicroseconds(2);
4. digitalWrite(trigPin, HIGH);
5. delayMicroseconds(10);
6. digitalWrite(trigPin, LOW);
7. duration = pulseIn(echoPin, HIGH);
8. distance= duration*0.034/2;
9. return distance;
10. }
9
Calculate Distance function is responsible with the response from the ultrasonic sensor. In the
beginning the trigPin is set to low/clear for two microseconds, after that is set to high and emit a
ultra sound wave for the duration of ten microseconds. The value that is bounced back from the
object is stored in the duration constant. To calculate the distance I multiplied the duration signal
with 0.034 which is the cm/microsecond speed of the sound divided by two because the signal
duration is twice, one way to the object and one way back.
1. void loop() {
2. for(int i=15;i<=165;i++){
3. myServo.write(i);
4. delay(30);
5. distance = calculateDistance();
6. Serial.print(i);
7. Serial.print(",");
8. Serial.print(distance);
9. Serial.print(".");
10. }
11.
12. for(int i=165;i>15;i –){
13. myServo.write(i);
14. delay(30);
15. distance = calculateDistance();
16. Serial.print(i);
17. Serial.print(",");
18. Serial.print(distance);
19. Serial.print(".");
20. }
21. }
The loop function rotates the servo motor from 15 degrees to 165 degrees and back so the
ultrasonic sensor can scan the environment in a 155 degrees angle. First for function goes from 15
to 165 and set the servo motor value for every value in a delay of 30 milliseconds .
CalculateDistance function is called and return the current distance to an object in that angle. The
Serial.print methods, print the angle and the distance in the serial port, and the dot and comma are
only to distinguish the data in the processing ide whe n I will do the graphics.
10
4. Radar graphics
In this section I will describe how the design of the radar was made and how the processing
ide is communicating with arduino and get data from different sensors.
1. Serial myPort;
2. String angle="";
3. String distance="";
4. String data="";
5. String noObject;
6. float pixsDistance;
7. int iAngle, iDistance;
The graphics are made in processing ide, a tool that works very well with arduino. I start the
code by initialize the myPort object which will communi cate with the serial port defined in the
arduino program. I also defined some variables that will be use later in the code.
1. void setup() {
2. size (1920, 1080);
3. smooth();
4. myPort = new Serial( this,"COM7", 9600);
5. myPort.bufferUntil('.');
6. }
The setup function set the resolution of the window where the radar will be. Smooth method
is from the processing libraries and its purpose is to draw all geometric figures with smooth edges.
MyPort is initialized as a new port with the port number of the ardu ino board and the serial position
defined in the arduino program, so by doing this the two applications can communicate with each
other. The bufferUntil method reads data from the serial port up to the character “.” so this explain
why in arduino code I se nd all data in that format with dot and comma.
1. void drawRadar() {
2. pushMatrix();
3. translate(960,1000);
4. noFill();
5. strokeWeight(2);
11
6. stroke(98,245,31);
7. arc(0,0,1800,1800,PI,TWO_PI);
8. arc(0,0,1400,1400,PI,TWO_PI);
9. arc(0,0,1000,1000,PI,TWO_PI);
10. arc(0,0,600,600,PI,TWO_PI);
11. line(-960,0,960,0);
12. line(0,0, -960*cos(radians(30)), -960*sin(radians(30)));
13. line(0,0, -960*cos(radians(60)), -960*sin(radians(60)));
14. line(0,0, -960*cos(radians(90)), -960*sin(radians(90)));
15. line(0,0, -960*cos(radians(120)), -960*sin(radians(120)));
16. line(0,0, -960*cos(radians(150)), -960*sin(radians(150)));
17. line(-960*cos(radians(30)),0,960,0);
18. popMatrix();
19. }
The drawRadar function create the lines specific to a radar in which the curso r can navigate a
show where are objects identified, at which distance and grade. First of all, using the translate
method, I set the location where the object to be positioned. NoFill and strokeWeight methods are
displaying the lines of the radar as the sp ecific weight, without filling the spaces between them.
The stroke color code represents green. Every arc method represents the coordinates for the four
curved lines of the radar from up to down. Line methods represent the coordinates for the lines in
the radar that show at specific positions the degrees angle.
Fig. 7 Radar lines
1. void drawLine() {
2. pushMatrix();
3. strokeWeight(9);
4. stroke(30,250,60);
5. translate(960,1000);
6. line(0,0,950*cos(radians(iAngle)), -950*sin(radians(iAngle)));
12
7. popMatrix();
8. }
The drawLine function creates the line that will move from 15 to 165 degrees on the radar. In
the function I’ve set the weight, color and bottom position of the line. The top position that will
move the line contain dynamic coordinates b ased on the servo motor angle. On every angle change
the line will get new coordinates.
Fig. 8 Radar cursor line
1. void drawObject() {
2. pushMatrix();
3. translate(960,1000);
4. strokeWeight(9);
5. stroke(255,10,10);
6. pixsDistance = iDistance*22.5;
7. if(iDistance<40){
8. line(pixsDistance*cos(radians(iAngle)), –
pixsDistance*sin(radians(iAngle)),950*cos(radians(iAngle)), –
950*sin(radians(iAngle)));
9. }
10. popMatrix();
11. }
DrawObject function creates a red line wi th the same style as the one above but this line will
be displayed on the radar on a dynamic height based on the response from the sensor. First of all,
I’ve set the bottom position of the line, the weight and the red color. I got the distance of 22.5 pixe l
for one cm by dividing the line used height of 900 by 40 which will be the maximum value
registered for the distance. The radar graphic will represent only values to maximum 40 cm. The
line method set the coordinates of the line by taking into account th e height of the line based on
13
the ultrasonic sensor response and the top of the line coordinates based on the degree of the servo
motor.
Fig. 9 Object line
1. void drawText() {
2. if(iDistance>40) {
3. noObject = "Out of Range";
4. }
5. else {
6. noObject = "In Range";
7. }
8. text("10cm",1180,990);
9. text("20cm",1380,990);
10. text("30cm",1580,990);
11. text("40cm",1780,990);
12. text("Object: " + noObject, 240, 1050);
13. text("Angle: " + iAngle +" °", 1050, 1050);
14. text("Distance: ", 1380, 1050);
15. translate(961+960*cos(radians(30)),982 –
960*sin(radians(30)));
16. rotate(-radians( -60));
17. text("30°",0,0);
18. resetMatrix();
19. translate(954+960*cos(radians(60)),984 –
960*sin(radians(60)));
20. rotate(-radians( -30));
21. text("60°",0,0);
22. resetMatrix();
23. translate(945+960*cos(radians(90)),990 –
960*sin(radians(90)));
24. rotate(radians(0));
25. text("90°",0,0);
14
26. resetMatrix();
27. translate(935+960*cos(radians(120)),1003 –
960*sin(radians(120)));
28. rotate(radians( -30));
29. text("120°",0,0);
30. resetMatrix();
31. translate(940+960*cos(radians(150)),1018 –
960*sin(radians(150)));
32. rotate(radians( -60));
33. text("150°",0,0);
34. }
DrawText function is responsible will all the texts from the interface. For the distance text,
every text where set on a default position. The object confirmation text is based on the if statement
result and the angle is based on the response from the servo motor. For each point that show the
angle of the radar line I’ve set the coordinates and rotate them in place.
Fig 10. Radar texts
15
5. Conclusion
In conclusion, radars developed since its discovery and nowadays are a technology that is
vital in many industries. Before the development of the radars, the system was used only for
military and war purposes. Now radars make our life easier and safer, from cars that can self –
drive, airplanes that can be tracked on the sky, ships that can navigate on the sea to submarines
that can avoid obst acles and navigate in deep waters. Also this radar technology, helps the
research companies like Nasa or others to get outside our planet and discover new planets, map
there surfaces using radars or monitor the space planets and objects movements.
Knowing the value of the radar, this project was interesting for me and a real challenge,
because of the arduino environment that was entirely new for me. Arduino is a great platform
for such type of projects and in my case matched perfectly and allowed me to rep licate a radar
in its original form. The purpose of the project was to create a kind of a radar, but the result
satisfied me greater that I was expecting. Also the arduino ide platform is a great tool and easy
to use. The processing ide was the greatest be cause allowed me to build the design that
symbolize perfectly the idea of a radar interface.
16
Webography
1. http://teacher.scholastic.com/activities/explorations/bats/libraryarticle.asp?ItemID=234&S
ubjectID=110&categoryID=3
2. https://www.arduino.cc/en/guide/introduction
3. https://www.arrow.com/en/research -and-events/articles/ultrasonic -sensors -how-they-
work -and-how-to-use-them -with-arduino
4. https://www.electronics -lab.com/project/using -sg90 -servo -motor -arduino/
5. https://en.wikipedia.org/wiki/History_of_radar
Bibliography
1. Introduction to radar systems, McGraw -Hill Education; 3 edition (December 20,
2002), Merrill S kolnik
2. Arduino: Mastering Basic Arduino, Createspace Independent Publishing Platform , 2017,
Steve Gold
Copyright Notice
© Licențiada.org respectă drepturile de proprietate intelectuală și așteaptă ca toți utilizatorii să facă același lucru. Dacă consideri că un conținut de pe site încalcă drepturile tale de autor, te rugăm să trimiți o notificare DMCA.
Acest articol: Prof. PhD eng. ec. ȚARCĂ Radu Cătălin [611642] (ID: 611642)
Dacă considerați că acest conținut vă încalcă drepturile de autor, vă rugăm să depuneți o cerere pe pagina noastră Copyright Takedown.
