Documente Academic
Documente Profesional
Documente Cultură
RADAR SYSTEM
A Project Report Submitted
For Partial Fulfilment of the
Requirements for the Degree of
BACHELOR OF TECHNOLOGY
In
Electronics & Communication Engineering
By
VIVEK SHUKLA
BHARAT LAL YADAV
PRAVEEN KUMAR YADAV
RINKI PANDEY
CERTIFICATE
YADAV, RINKI PANDEY have carried out the project work presented in this project report
entitled “RADAR SYSTEM” for the award of Bachelor of Technology in Electronics &
Communication from Dr.A.P.J Abdul Kalam Technical University, Lucknow under our
guidance. The project report embodies results of original work, and studies are carried out by the
student themselves and the contents of the project report do not form the basis for the award of
any other degree to the candidate or to anybody else from this or any other University/Institution.
Signature
Signature
Mr.Pankaj Prajapati
Prof. Rajesh Maheshwari
(Guide)
(Head of ECE Department)
ii
ABSTRACT
The proposed system "ultrasonic radar for the object detection, distance and the speed measurement”
employs an ultrasonic module that includes an ultrasonic transmitter and receiver along with the
89c52 microcontroller. It operated by transmitting 40 kHz frequency pulse which is not audible to
the human ear. Module rotate with step angle of the stepper motor with specific angle for a specific
time interval, microcontroller receive an echo signal back as response of the transmitted signal by
transmitter and the distance between the object and system is measured by calculating time interval
taken by the signal to transmit and the echo reception. Whereas the detected signal is shifted toward
the module or away from the module which give the information about the speed of that detected
object which is shown on PPI DISPLAY.
iii
ACKNOWLEDGEMENT
First and foremost, we would like to thank our supervisor of this project, Mr. Rajesh
Maheswari for his valuable guidance and advice. He guided us greatly to work in this project. His
willingness to motivate us helped tremendously. Next we thank Mr. Pankaj Prajapati & Mr.
Dawar Hussain Rizvi for without their helping hands the project would be complete. Besides, we
would like to thank authority of AIMT, Lucknow for providing us with a good environment and
facilities to complete this project. It gave us an opportunity to participate & complete the project.
Finally an honorable mention goes to our families and for their understanding and support in
completing this project. Without help of those mentioned above, this project could not have been
completed.
…................................... .....................................
Vivek Shukla Bharat Lal Yadav
................................... .......................................
Praveen Kumar Yadav Rinki Pandey
iv
TABLE OF CONTENTS
Page No.
Certificate ii
Abstract iii
Acknowledgements iv
List of Tables viii
List of Figures ix
CHAPTER 1: INTRODUCTION 1-4
1.1 A BRIEF INTRODUCTION 1
1.2 ORGANIZATION OF THE REPORT 2
1.3 LITERATURE SURVEY 3
1.3.1 The Idea 3
CHAPTER 2: RADAR REVIEW 5-24
2.1 DESCRIPTION OF RADAR 5
2.2 RADAR PRINCIPLE 6
2.3 BASIC DESIGN OF A RADAR SYSTEM 7
2.3.1 Major Parts of a Radar System 8
2.4 HISTORICAL OVERVIEW 9
2.5 PHYSICAL FUNDAMENTALS OF THE RADAR PRINCIPLE 10
2.5.1 Advantages 11
2.6 PRINCIPLE OF MEASUREMENT 11
2.6.1 Distance – Determination 11
2.6.2 Direction – Determination 12
2.6.3 Transfer of Bearing Information 13
2.7 THE RADAR RANGE EQUATION 13
2.7.1 Argumentation / Derivation 13
2.8 WAVES AND FREQUENCY RANGE 14
2.8.1 A and B Band 15
2.8.2 C – Band 16
2.8.3 D – Band 16
2.8.4 E / F Band 16
2.8.5 G – Band 16
2.9.6 I / J Band 16
v
2.8.7 k – Band 17
2.8.8 V – Band 17
2.8.9 W – Band 17
2.9 RADAR COVERAGE 18
2.10 CLASSIFICATION OF RADAR SYSTEMS 19
2.10.1 Depending on Technologies 19
2.10.2 Primary Radar 20
2.10.3 Usage 20
2.10.4 Secondary Surveillance Radar 21
2.11 APPLICATIONS OF RADAR 22
CHAPTER 3: INTRODUCTION TO THE COMPONENTS USED 25-31
3.1 INTRODUCTION TO ARDUINO UNO 25
3.2 AVR ATMEGA 328 27
3.3 CRYSTAL OSCILLATOR 27
3.4 STEPPER MOTOR 28
3.4.1 Features 29
3.4.2 Advantages of Stepper Motor 29
3.4.3 Applications 30
3.5 VOLTAGE REGULATOR 30
3.6 ULTRASONIC SENSOR 31
3.6.1 Ultrasonic Sensor HC- SR04 31
vi
5.3.1 HARDWARE 47
5.3.2 SOFTWARE 48
5.4 CIRCUIT SETUP 48
5.5 FIRST AVR PROGRAM 51
CHAPTER 6: PRACTICAL IMPLEMENTATION 64-72
6.1 BOOT LOADING THE ATMEGA 328 64
6.2 CONNECTING THE STEPPER MOTOR 66
6.3 CONNECTING THE ULTRASONIC SENSOR 67
6.4 USING THE ARDUINO IDE 68
6.5 USING THE PROCESSING SOFTWARE 70
6.6 PROBLEM FECED 71
6.6.1 Making own Arduino Board 71
6.6.2 Communicating with Arduino through PC 71
6.6.3 Programing the Arduino to Display the RADAR Screen 72
CHAPTER 7: PRACTICAL IMPLEMENTATION 73-118
7.1 ATMEGA-16 CODING ( LCD DISPLAY) 73
7.2 ATMEGA-16CODING (STEPPER MOTOR) 116
7.3 ARDUINO CODING FOR ULTRASONIC SENSOR 117
CHAPTER 8: PRESENT AND FUTURE SCOPE OF PROJECT 119-127
8.1 APPLICATION IN AIR FORCE 120
8.2 NAVAL APPLICATIONS 121
8.3 APPLICATIONS IN ARMY 122
8.4 METEROLOGICAL APPLICATIONS 123
8.5 A LOOK AT THE FINAL PROJECT 124
8.6 REFERENCES 127
vii
LIST OF TABLE
viii
LIST OF FIGURES
ix
Figure 4.13 Etched copper plate . . . . . . . . . . . . . . . . . . . . . . . . . 42
Figure 4.14 Removing the ink . . . . . . . . . . . . . . . . . . . . . . . . . 43
Figure 5.1 Ultrasonic transmitter and receiver pair . . . . . . . . . . . . . . . . . . . . . . . . . 44
Figure 5.2 AT Mega 16 IC . . . . . . . . . . . . . . . . . . . . . . . . . 46
Figure 5.3 AVR Chip . . . . . . . . . . . . . . . . . . . . . . . . . 47
Figure 5.4 AVRISP MKII pins . . . . . . . . . . . . . . . . . . . . . . . . . 49
Figure 5.5 ATmega 328p pin out . . . . . . . . . . . . . . . . . . . . . . . . . 49
Figure 5.6 AVRISP MKII holes . . . . . . . . . . . . . . . . . . . . . . . . . 50
Figure 5.7 AVRISP MKII circuit to program ......................... 51
Figure 5.8 Creating a new project in AVR studio 5 . . . . . . . . . . . . . . . . . . . . . . . . . 52
Figure 5.9 Naming your project . . . . . . . . . . . . . . . . . . . . . . . . . 53
Figure 5.10 AVR studio blank template C file . . . . . . . . . . . . . . . . . . . . . . . . . 54
Figure 5.11 RED Led connected port C5 . . . . . . . . . . . . . . . . . . . . . . . . . 55
Figure 5.12 Hex the check box, make sure it’s checked . . . . . . . . .. . . . . . . . . . 62
Figure 6.1 Circuit diagram for boot loading ATmega 328 . . . . . . . . . . . . . . 64
Figure 6.2 Connecting the servo motor . . . . . . . . . . . . . . . . . . . . . . . . . 65
Figure 6.3 Connecting ultrasonic sensor to Arduino . . . .. . . . . . . . . . 67
Figure 6.4 Working of ultrasonic sensor . . . . . . . . . . . . . . . . . . . . . . . . . 68
Figure 6.5 Selecting the board in Arduino IDE . . . . . . . . . . . . . . . . . . . . . . . . . 69
Figure 6.6 Processing Software . . . . . . . . . . . . . . . . . . . . . . . . . 70
Figure 6.8 Display Radar Screen . . . . . . . . . . . . . . . . . . . . . . . . . 72
Figure 8.1 Driverless Car. . . . . . . . . . . . . . . . . . . . . . . . . 119
Figure 8.2 Air force Applications. . . . . . . . . . . . . . . . . . . . . . . . . 120
Figure 8.3 Naval Applications . . . . . . . . . . . . . . . . . . . . . . . . . 121
Figure 8.4 Army Applications . . . . . . . . . . . . . . . . . . . . . . . . . 122
Figure 8.5 Weather Radar . . . . . . . . . . . . . . . . . . . . . . . . . 123
Figure 8.6 The Final Project. . . . . . . . . . . . . . . . . . . . . . . 124
Figure 8.7 Arduino UNO LCD display. . . . . . . . . . . . 125
Figure 8.8 Final Project Radar Screen. . . . . . . . . . . . . . . . . . 126
x
Chapter 1
INTRODUCTION
RADAR is an object detection system which uses radio waves to determine the range,
altitude, direction, or speed of objects. Radar systems come in a variety of sizes and have different
performance specifications. Some radar systems are used for air-traffic control at airports and others
are used for long range surveillance and early-warning systems. A radar system is the heart of a
missile guidance system. Small portable radar systems that can be maintained and operated by one
person are available as well as systems that occupy several large rooms.
Radar was secretly developed by several nations before and during World War II. The
term RADAR itself, not the actual development, was coined in 1940 by the United States Navy as
an acronym for radio Detection and Ranging. The term radar has since entered English and other
languages as the common noun radar, losing all capitalization.
The modern uses of radar are highly diverse, including air traffic control, radar astronomy, air-
defense systems, antimissile systems; marine radars to locate landmarks and other ships; aircraft
1
anti-collision systems; ocean surveillance systems, outer space surveillance
and rendezvous systems; meteorological precipitation monitoring; altimetry and flight control
systems; guided missile target locating systems; and ground-penetrating radar for geological
observations. High tech radar systems are associated with digital signal processing and are capable
of extracting useful information from very high noise levels.
Chapter 1 gives a brief introduction of the project covered. It contains the basics of a RADAR and
the other tools and components used for completion of this project.
Chapter 2 aims at the literature survey of the project consisting of the basic idea of the project, and
how we got the idea to make this project, all the help like websites, journals etc.
Chapter 3 covers the list of the components used in the projects and how to use them.
Chapter 6 covers the implementation of the project like boot loading to make own Arduino board,
software used and the problems faced during the course of action.
Chapter 8 deals with the present as well as the future scope of the project, like how we can make use
of this project for the betterment of the mankind.
2
1.3 Literature Survey
Army, Navy and the Air Force make use of this technology. The use of such technology has
been seen recently in the self-parking car systems launched by AUDI, FORD etc. And even the
upcoming driverless cars by Google like Prius and Lexus.
The project made by us can be used in any systems the customer may want to use like in a car, a
bicycle or anything else. The use of Arduino in the project provides even more flexibility of usage
of the above-said module according to the requirements.
The idea of making an Ultrasonic RADAR came as a part of a study carried out on the working and
mechanism of “Automobiles of Future”. Also, being students of ECE, we have always been curious
about the latest ongoing technology in the world like Arduino, Raspberry Pi, Beagle-Bone boards
etc. And hence this time we were able to get a hold of one of the Arduino boards, Arduino UNO R3.
So, knowing about the power and vast processing capabilities of the Arduino, we thought of making
it big and a day to day application specific module that can be used and configured easily at any
place and by anyone.
3
and as well as protection of the vehicles at the same time to prevent accidents or minor scratches to
the vehicles.
The three major radar resources are shown in Figure. The challenge of the RRM arises when the
radar resources are not enough to assist all the tasks in all the functions. Lower priority tasks must
encounter degraded performance due to less available resources, or the radar may not execute some
tasks at all. Each task in the radar requires a certain amount of time, energy and computational
resource. The time is characterized by the tactical requirements, the energy is limited by the
transmitter energy, and the RRM computer limits the computational resource. All of those limitations
have impacts on the performance of the radar resource management.
An additional challenge is that since the RRM deals with many radar subsystems, evaluation of the
RRM algorithms must be done under a more complex and detailed radar model. A general MFR
resource management system model is shown in Figure 3. It performs the following steps:
• Get a radar mission profile or function setup;
• Generate radar tasks;
• Assign priorities to tasks by using a prioritization algorithm;
• Manage available resources by a scheduling algorithm so that the system can meet the requirements
of all radar functions;
• When there are no detections in the course of non-surveillance tasks, a re-look may be scheduled
based on its priority and elapsed time since the last scheduling of the same task;
• The radar scheduler considers radar beams, dwell time, carrier frequency, PRF, energy
4
Chapter 2
RADAR REVIEW
High-power radar, using large dish antennas, has been used to measure distances to the moon, other
planets, asteroids, and artificial satellites. From unmanned space probes, radar has been used to map
Venus, whose surface is obscured at visible wave lengths by a thick layer of clouds. Radar has been
employed by NASA (the U.S. National Aeronautics and Space Administration) to make highly
detailed topographical maps of the earth's surface as well.
Most radar systems determine position in two dimensions: azimuth (compass bearing) and radius
(distance). The display is in polar coordinates. A rotating antenna transmits RF pulses at defined
intervals. The delay between a transmitted pulse and the echo, or return pulse, determines the radial
position of the plotted point(s) for each azimuth direction on the display. The greater the echo delay
from a particular object in space, the farther from the display center its point appears. The maximum
range of a UHF or microwave radar system depends on the height of the antenna above average
terrain, the topography of the surface in the region, the atmospheric conditions in the region, and in
some cases the level of radio background noise.
Radar is known to the general public for its use by law enforcement in determining the speeds of
motor vehicles. This type of radar does not display the exact position of an object, but determines its
radial speed vector from the Doppler Effect. A radar detector, which consists of a simple
UHF/microwave broadband receiver, can be used in a car or truck to warn drivers of the presence of
police radar. Radar detectors are illegal in some states.
5
The Weather Service uses so-called Doppler radar to determine not only the positions and extent of
storm systems, but wind patterns and velocities aloft. Doppler radar employs a combination of
position-sensing and speed-sensing radar, making it possible to ascertain the locations and intensity
of severe thunderstorms, hurricanes, and tornadoes.
Radar has been used on the high-frequency (HF) radio bands, between approximately 5 MHz and 20
MHz, in an attempt to obtain early warning in the event of a nuclear assault via ballistic missiles.
The ionosphere refracts HF waves, allowing much greater system range than is possible with radar
at UHF or microwave frequencies. During the 1970s and early 1980s, the signals from these systems
became infamous because of the interference they caused. Radio amateurs coined the
term woodpecker to describe the sound of HF over-the-horizon radar pulses in communications
receivers.
6
2.3 BASIC DESIGN OF A RADAR SYSTEM
The following figure shows the operating principle of a primary radar set. The radar antenna
illuminates the target with a microwave signal, which is then reflected and picked up by a receiving
device. The electrical signal picked up by the receiving antenna is called echo or return. The radar
signal is generated by a powerful transmitter and received by a highly sensitive receiver.
All targets produce a diffuse reflection i.e. it is reflected in a wide number of directions. The
reflected signal is also called scattering. Backscatter is the term given to reflections in the
opposite direction to the incident rays.
Radar signals can be displayed on the traditional plan position indicator (PPI) or other more
advanced radar display systems. A PPI has a rotating vector with the radar at the origin, which
indicates the pointing direction of the antenna and hence the bearing of targets.
Transmitter
The radar transmitter produces the short duration high-power rf pulses of energy that are into space by the
antenna.
Duplexer
The duplexer alternately switches the antenna between the transmitter and receiver so that only one antenna
need be used. This switching is necessary because the high-power pulses of the transmitter would destroy
the receiver if energy were allowed to enter the receiver.
Receiver
The receivers amplify and demodulate the received RF-signals. The receiver provides video signals on the
output.
Radar Antenna
The Antenna transfers the transmitter energy to signals in space with the required distribution and
efficiency. This process is applied in an identical way on reception.
Indicator
The indicator should present to the observer a continuous, easily understandable, graphic picture of the
relative position of radar targets.
The radar screen (in this case a PPI-scope) displays the produced from the echo signals bright blibs.
7
The longer the pulses were delayed by the runtime, the further away from the center of this radar scope
they are displayed. The direction of the deflection on this screen is that in which the antenna is currently
pointing.
A Transmitter: It can be a power amplifier like a Klystron, Travelling Wave Tube or a power
Oscillator like a Magnetron. The signal is first generated using a waveform generator and then
amplified in the power amplifier.
Waveguides: The waveguides are transmission lines for transmission of the RADAR signals.
Antenna: The antenna used can be a parabolic reflector, planar arrays or electronically steered
phased arrays.
Duplexer: A duplexer allows the antenna to be used as a transmitter or a receiver. It can be a
gaseous device that would produce a short circuit at the input to the receiver when transmitter is
working.
Receiver: It can be super heterodyne receiver or any other receiver which consists of a processor to
process the signal and detect it.
Threshold Decision: The output of the receiver is compared with a threshold to detect the
presence of any object. If the output is below any threshold, the presence of noise is assumed.
8
2.4 Historical Overview
Neither a single nation nor a single person can say that the discovery and development of radar
technology was his (or its) own invention. One must see the knowledge about “Radar” than an
accumulation of many developments and improvements, in which any scientists from several
nations took part in parallel. In the past, there are nevertheless some milestones, with the discovery
of important basic knowledge and important inventions:
1865 - The Scottish physicist James Clerk Maxwell presents his “Theory of the Electromagnetic
Field” (description of the electromagnetic waves and their propagation) He demonstrated that
electric and magnetic fields travel through space in the form of waves, and at the constant speed of
light.
1886 - The German physicist Heinrich Rudolf Hertz discovered electromagnetic waves, thus
demonstrating the Maxwell theory.
1897 - The Italian inventor Guglielmo Marconi achieved the first long distance transmission of
electromagnetic waves. In his first experiments he used a wire to a wooden pole. In Italian a tent
pole is known as l'antenna Centrale, and the pole with a wire alongside it used as an aerial was
simply called l'antenna. Today Marconi is known as pioneer of radio communication.
1900 - Nicola Tesla suggested that the reflection of electromagnetic waves could be used for
detecting of moving metallic objects.
1904 - The German engineer Christian Hülsmeyer invents the "telemobiloscope" for a traffic
monitoring on the water in poor visibility. This is the first practical radar test. Hülsmeyer apply his
invention for a patent in Germany, France and the United Kingdom.
1921 - The invention of the Magnetron as an efficient transmitting tube by the US-American
physicist Albert Wallace Hull.
1922 - The American electrical engineers Albert H. Taylor and Leo C. Young of the Naval Research
Laboratory (USA) locate a wooden ship for the first time.
1930 - Lawrence A. Hyland (also of the Naval Research Laboratory), locates an aircraft for the first
time.
1931 - In Britain the first known proposal for a radar system came from William A. S.
Butement and P. E. Pollard in January 1931. They equipped a ship with radar. As antennae were
used parabolic dishes with horn radiator. Although their equipment produced short-range results the
work was abandoned for lack of government support.
1933 - On the basis of the in 1931 from himself invented sonar, Rudolph Kühnhold presented a so
called “Funkmessgerät”. It worked on a wavelength of 48 cm and the transmitter had a power of
about 40 Watts. From these tests, the Freya-radar was developed, which was produced in series
beginning in 1938.
1935 - Robert Watson-Watt (later: Sir Robert) suggested that radio waves might be used to detect
aircraft at a distance and outlined a means of doing so. Intensive research began and by 1939 -
Britain possessed a defensive chain of highly secret Radio Direction Finding (RDF) stations.
1936 - The development of the Klystron by the technicians George F. Metcalf and William C. Hahn,
both General Electric. This will be an important component in radar units as an amplifier or an
oscillator tube.
1939 - Two engineers from the university in Birmingham, John Turton Randall und Henry Albert
Howard Boot built a small but powerful radar using a Multicavity-Magnetron. The B–17 airplanes
were fitted with this radar. Now they could find and thus combat the German submarines in the
night and in fog.
1940 - Different radar equipment’s are developed in the USA, Russia, Germany, France and Japan.
Driven by general war events and the development of the Air Force to major branch of service, the
radar technology undergoes a strong development boost during the World War II, and radar sets
were used during the "Cold War" in large numbers along the inner German border.
9
2.5 Physical fundamentals of the radar principle
The basic principle of operation of primary radar is simple to understand. However, the
theory can be quite complex. An understanding of the theory is essential in order to be able to specify
and operate primary radar systems correctly. The implementation and operation of primary radars
systems involve a wide range of disciplines such as building works, heavy mechanical and electrical
engineering, high power microwave engineering, and advanced high speed signal and data
processing techniques. Some laws of nature have a greater importance here.
Radar measurement of range, or distance, is made possible because of the properties of radiated
electromagnetic energy.
Fig: - 2.3 Radar Principle: The measuring of a round trip of a microwave Pulse.
3. This energy normally travels through space in a straight line, and will vary only slightly
because of atmospheric and weather conditions. By using of special radar antennas this
energy can be focused into a desired direction. Thus the direction (in azimuth and elevation)
of the reflecting objects can be measured.
These principles can basically be implemented in a radar system, and allow the determination of the
distance, the direction and the height of the reflecting object.
10
(The effects atmosphere and weather have on the transmitted energy will be discussed later;
however, for this discussion on determining range and direction, these effects will be temporarily
ignored.)
2.5.1 Advantages
Radar has many advantages compared to an attempt of visual observation:
Radar is able to operate day or night, in lightness or darkness over a long range;
Radar is able to operate in all weathers, in fog and rain, it can even penetrate walls or layers of snow;
Radar has very broad coverage; it is possible to observe the whole hemisphere;
Radar detects and tracks moving objects, a high resolution imaging is possible, that results in an
object recognition;
Radar can operate unmanned, 24 hours a day, 7 days a week.
2.6.1 Distance-determination
The radar transmits a short radio pulse with very high pulse power. This pulse is focused in
one direction only by the directivity of the antenna, and propagates in this given direction with the
speed of light.
If in this direction is an obstacle, for example an airplane, then a part of the energy of the pulse is
scattered in all directions. A very small portion is also reflected back to the radar. The radar antenna
receives this energy and the radar evaluates the contained information.
The distance we can measure with a simple oscilloscope. On the oscilloscope moves synchronously
with the transmitted pulse a luminous point and leaves a trail. The deflection starts with the
transmitter pulse. The luminescent spot moves to scale on the oscilloscope with the radio wave. At
this moment, in which the antenna receives the echo pulse, this pulse is also shown on the
oscilloscope. The distance between the two shown pulses on the oscilloscope is a measure of the
distance of the aircraft.
Since the propagation of radio waves happens at constant speed (the speed of light c0) this distance
is determined from the runtime of the high-frequency transmitted signal. The actual range of a target
from the radar is known as slant range. Slant range is the line of sight distance between the radar
and the object illuminated. While ground range is the horizontal distance between the emitter and
its target and its calculation requires knowledge of the target's elevation. Since the waves travel to
a target and back, the round trip time is dividing by two in order to obtain the time the wave took to
reach the target.
Therefore the following formula arises for the slant range:
11
R= c 0· t (1)
2
Where; C0 = Speed of light = 3 * 10^8 m/s
t = measured running time (s)
R = Slant Range antenna (m)
The distances are expressed in kilometers or nautical miles (1 NM = 1.852 km).
2.6.2 Direction-determination
The angular determination of the target is determined by the directivity of the antenna. Directivity,
sometimes known as the directive gain, is the ability of the antenna to concentrate the transmitted
energy in a particular direction. An antenna with high directivity is also called a directive antenna.
By measuring the direction in which the antenna is pointing when the echo is received, both the
azimuth and elevation angles from the radar to the object or target can be determined. The accuracy
of angular measurement is determined by the directivity, which is a function of the size of the
antenna.
Radar units usually work with very high frequencies. Reasons for this are:
Quasi-optically propagation of these waves.
High resolution (the smaller the wavelength, the smaller the objects the radar is able to detect).
Higher the frequency, smaller the antenna size at the same gain.
The True Bearing (referenced to true north) of a radar target is the angle between true north and a
line pointed directly at the target. This angle is measured in the horizontal plane and in a clockwise
direction from true north. (The bearing angle to the radar target may also be measured in a clockwise
direction from the centerline of your own ship or aircraft and is referred to as the relative bearing.)
12
In order to have an exact determination of the bearing angle, a survey of the north direction is
necessary. Therefore, older radar sets must expensively be surveyed either with a compass or with
help of known trigonometrically points. More modern radar sets take on this task and with help of
the GPS satellites determine the north direction independently.
Servo systems are used in older radar antennas and missile launchers and works with help of devices
like synchro torque transmitters and synchro torque receivers. In newer radar units we find a system
of Azimuth-Change-Pulses (ACP). In every rotation of the antenna a coder sends many pulses, these
are then counted in the scopes.
Newer radar units work completely without or with a partial mechanical motion. These radars
employ electronic phase scanning in bearing and/or in elevation (phased-array-antenna).
2.7.1 Argumentation/Derivation
First we assume, that electromagnetic waves propagate under ideal conditions, i.e. without
dispersion. If high-frequency energy is emitted by an isotropic radiator, than the energy propagate
uniformly in all directions. Areas with the same power density therefore form spheres (A= 4 π
R²) around the radiator. The same amount of energy spreads out on an incremented spherical surface
at an incremented spherical radius. That means: the power density on the surface of a sphere is
inversely proportional to the square of the radius of the sphere.
13
2.8 Waves and Frequency Ranges
The spectrum of the electric magnetic waves shows frequencies up to 1024 Hz. This very large
complete range is subdivided because of different physical qualities in different subranges.
The division of the frequencies to the different ranges was competed on criteria formerly, which
arose historically and a new division of the wavebands which is used internationally is outdated and
arose so in the meantime. The traditional waveband name is partly still used in the literature,
however.
An overview shows the following figure:
Figure 2.5:- Waves and frequency ranges used by radar.
Since without that the correct frequency is known, a transformation isn't always possible into the
new wavebands. Often in the manufacturers documents are published the traditional wavebands. So
I take on and comments’ these information’s.
14
Figure 2.6:- Some radars and its frequency band
Radar systems work in a wide band of transmitted frequencies. The higher the frequency of a radar
system, the more it is affected by weather conditions such as rain or clouds. But the higher the
transmitted frequency, the better is the accuracy of the radar system.
The figure shows the frequency bands used by e.g. radar systems.
15
2.8.2 C- Band (UHF- Radar)
There are some specialized Radar sets developed for this frequency band (300 MHz to1 GHz). It is
a good frequency for the operation of radars for the detection and tracking of satellites and ballistic
missiles over a long range. These radars operate for early warning and target acquisition like the
surveillance radar for the Medium Extended Air Defense System (MEADS). Some weather radar-
applications e.g. wind profilers work with these frequencies because the electromagnetic waves are
very low affected by clouds and rain.
The new technology of Ultra wideband (UWB) Radars uses all frequencies from A- to C-Band.
UWB- radars transmit very low pulses in all frequencies simultaneously. They are used for
technically material examination and as Ground Penetrating Radar (GPR) for archaeological
explorations.
16
radar band for military applications like airborne radars for performing the roles of interceptor,
fighter, and attack of enemy fighters and of ground targets. A very small antenna size provides a
good performance. Missile guidance systems at I/J- band are of a convenient size and are, therefore,
of interest for applications where mobility and light weight are important and very long range is not
a major requirement.
This frequency band is wide used for maritime civil and military navigation radars. Very small and
cheap antennas with a high rotation speed are adequate for a fair maximum range and a good
accuracy. Slotted waveguide and small patch antennas are used as radar antenna, under a protective
Radom mostly.
This frequency band is also popular for space borne or airborne imaging radars based on Synthetic
Aperture Radar (SAR) both for military electronic intelligence and civil geographic mapping. A
special Inverse Synthetic Aperture Radar (ISAR) is in use as a maritime airborne instrument of
pollution control.
2.8.8 V-Band
By the molecular dispersion (here this is the influence of the air humidity), this frequency band stay
for a high attenuation. Radar applications are limited for a short range of a couple of meters here.
2.8.9 W-Band
Here are two phenomena visible: a maximum of attenuation at about 75 GHz and a relative
minimum at about 96 GHz. Both frequency ranges are in use practically. In automotive engineering
small built in radar sets operate at 75…76 GHz for parking assistants, blind spot and brake assists.
The high attenuation (here the influence of the oxygen molecules O2) enhances the immunity to
interference of these radar sets.
There are radar sets operating at 96 to 98 GHz as laboratory equipment’s yet. These applications
give a preview for a use of radar in extremely higher frequencies as 100 GHz.
17
2.9 Radar Coverage
The radar coverage describes controlled by a radar or a radar network airspace.
In a two-dimensional radar is often used an antenna with a square pattern. Its main beam direction
forms a vertical rectangle with rounded corners, which rotates about a vertical axis. Thus arises on
the radar site a room with the geometry of a flat cylinder within which the radar can locate a aerial
target. At an Air (or referred to Terminal Area Radar), this cylinder (shown in green in Figure 1)
has a diameter of about 120 NM (220 km) and a height of about 10,000 feet (or 3,000 m).
Figure 2.7:- Radar coverage of a single radar. The cone of silence is located in the center,
just above the radar antenna.
18
2.10 Classification of Radar Systems
Depending on the desired information, radar sets must have different qualities and technologies. One
reason for these different qualities and techniques radar sets are classified in:
19
2.10.2 Primary Radar
A Primary radar (PSR Primary Surveillance Radar) is a conventional radar sensor that illuminates
a large portion of space with an electromagnetic wave and receives back the reflected waves from
targets within that space. The term thus refers to a radar system used to detect and localize potentially
non-cooperative targets. It is specific to the field of air traffic control where it is opposed to
the secondary radar which receives additional information from the target's transponder.
This type of radar uses low vertical resolution antenna but good horizontal resolution. It quickly
scans 360 degrees around the site on a single elevation angle. It can thus give the distance and radial
speed of the target with good precision but requires often one or more radars to obtain the vertical
position and the actual speed.
The advantages of the primary radar are no on-board equipment in the aircraft is necessary for
detecting the target and can be used to monitor the movement of vehicles on the ground. The
disadvantages are that the target and altitude cannot be identified directly. In addition, it requires
powerful emissions which limits its scope.
2.10.3 Usage
The rapid wartime development of radar had obvious applications for air traffic control (ATC) as a
means of providing continuous surveillance of air traffic disposition. Precise knowledge of the
positions of aircraft would permit a reduction in the normal procedural separation standards, which
in turn promised considerable increases in the efficiency of the airways system.
This type of radar (now called a primary radar) can detect and report the position of anything that
reflects its transmitted radio signals including, depending on its design, aircraft, birds, weather and
land features. For air traffic control purposes this is both an advantage and a disadvantage. Its targets
do not have to co-operate, they only have to be within its coverage and be able to reflect radio waves,
but it only indicates the position of the targets, it does not identify them.
When primary radar was the only type of radar available, the correlation of individual radar returns
with specific aircraft typically was achieved by the controller observing a directed turn by the aircraft.
20
Primary radar is still used by ATC today as a backup/complementary system to secondary radar,
although its coverage and information is more limited
Secondary surveillance radar (SSR) is a radar system used in air traffic control (ATC) that not only
detects and measures the position of aircraft i.e. bearing, but also requests additional information
from the aircraft itself such as its identity and altitude. Unlike primary radar systems that measure
the bearing of targets using the detected reflections of radio signals, SSR relies on targets equipped
with a radar transponder that replies to each interrogation signal by transmitting a response
containing encoded data. SSR is based on the military identification friend or foe (IFF) technology
originally developed during World War II, therefore the two systems are still compatible. Mono
pulse secondary surveillance radar (MSSR), Mode S, TCAS and ADS-B are similar modern
methods of secondary surveillance.
21
2.11 APPLICATIONS OF RADAR
(a) Air Traffic Control (ATC): RADARs are used for safety controlling of the air traffic. It
is used in the vicinity of airports for guiding airplanes for proper landing in adverse weather
conditions. Usually, high resolution RADAR is employed for this purpose. RADARs are used with
ground control approach (GCA) system for safe aircraft landing.
(b) Aircraft Navigation: The weather avoidance RADARs and ground mapping RADARs are
employed in aircrafts to navigate it properly in all the conditions. Radio altimeter and Doppler
navigator are also a form of RADAR. These RADARs provide safety to aircraft from potential
collision with other aircraft and objects.
(c) Ship Navigation and Safety: High resolution Shore based RADARs are used for beaconing and
as an aid of navigation. During poor visibility due to bad weather conditions, the RADAR provides
safe travel by warning potential threats. They are also used to find the depth of sea.
(d) Space: RADARs are used for docking and safely landing of spacecraft’s. Satellite borne
RADARs are also used for remote sensing. Ground based RADARs are used to track and detect the
satellites and spacecraft.
(e) Remote sensing and Environment: They are employed in remote sensing for detecting weather
(meteorological) conditions of the atmosphere and tracking of planetary conditions.
(f) Law Enforcements: Highway police force widely uses RADARs to measure the vehicle speed
for safety regulations.
(g) Military area: RADARs have got wide application in military operations. They are used in air,
naval and ground for defense purposes. They are also used for tracking, surveillance and detection
of the target. Weapon control, Fire control and missile guidance is usually employed with various
types of RADARs [6]. Long range RADAR is very useful for many purposes. It is generally used to
track space objects. Furthermore, it is also used for ballistic missiles. Figure 5 shows a Multipurpose
RADAR system antenna that could serve variety of purposes such as broadcasting, detection, etc.
22
Figure 2.11:- Multipurpose RADAR Antenna
(h) Global Ozone Monitoring Experiment (GOME) Applications: Atmospheric available ozone
and No2 global monitoring have been going on after the invention of GOME Products (July 1996).
GOME products can be used for retrieving other trace gases relevant to the ozone chemistry as well
as other atmospheric constituents. Furthermore, it can be used for climatic variable clouds, solar
index and aerosols. All these are crucial for assessing climate change.
(I) Microwave Sounder (MWR) Applications: In order to monitor the Antarctic ice cycle ERS-2
microwave sounder is being used. Mapping the radiometric properties of the ice-shelf, gives an
important input for the understanding of the dynamics, decay and growth of ice sheets. This this is
considered to be basic to the understanding of environmental and climatic changes.
(j) Wind Scatter meter (WSC) Applications: Wind scatter meters are used for accurate
measurements of the radar backscatter from the ocean surface when illuminated by a microwave
signal with a narrow spectral bandwidth to derive information on ocean surface wind velocity. The
amount of backscatter depends on two factors.. Dependent on wind stress which results in wind speed
at the surface, and wind direction are the two types of factors.
23
(k) Land use, Forestry and Agriculture: Observing the land surface is being considered as an
experimental application for ERS-1 data in the original mission targets. Major potential application
area for ERS data are being offered by the ability to monitor crop development and forestry changes
independent of weather conditions.
(l) Other Applications: Ground penetrating RADARs are widely used by geologist for studying the
position of the earth for Earthquake detection. Scientists use RADAR for better study of movements
of animals, birds and insects. Archeologists use it for detecting buried artifacts. Many industries and
factories use it for safety purposes. During world war-2, Signal corps Radio-270 or Pearl Harbor
RADAR was used by US army’s as long-distance RADAR. It plays signify cant role in detecting the
incoming raid, just before half an hour the attack has commenced and is most useful. RADAR waves
blaze an ample path for the rescue teams to search the needy people during the earthquake that detect
the heartbeats through the finder search options of survivors trapped in collapsed and damaged
buildings after Nepal Earthquake of lately.
Figure 2.12: Use of RADAR by Rescue team during Nepal Earthquake on April 25 2015
24
Chapter 3
The Arduino Uno is a microcontroller board based on the ATmega328. It has 14 digital Input
/Output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16MHz ceramic resonator,
USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to
support the microcontroller; simply connect it to computer with a USB cable or power it with a AC-
to-DC adapter or battery to get started. The Uno differs from all preceding boards in that it does not
use the FTDI USB-to-serial l driver chip. Instead, it features the Atmega16U2 programmed as a
USB-to-serial converter. Changes in Uno R3
1. Pin out: added SDA and SCL pins that are near to the AREF pin and two other new pins placed near
to the reset pin, the IOREF that allow the shields to adapt to the voltage provided from the board. In
future, shields will be compatible with both the board that uses the AVR, which operates with 5v and
with the Arduino due that operates with 3.3v.
"Uno" means one in Italian and is named to mark the upcoming release of Arduino 1.0. The Uno
and version 1.0 will be the reference versions of Arduino, moving forward. The Uno is the latest in
a series of USB Arduino boards, and the reference model for the Arduino platform; for a comparison
with previous versions, see the index of Arduino Boards.
25
Figure 3.1 Arduino UNO R3 Board
Microcontroller ATmega328
Operating Voltage 5V
Input Voltage 7-12V
(recommended)
Input Voltage (limits) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega328) of which 0.5 KB used by
bootloader
SRAM 2 KB (ATmega328)
EEPROM 1 KB (ATmega328)
Clock Speed 16 MHz
26
3.2 AVR ATmega328
The ATmega328 is a single chip micro-controller created by Atmel and belongs to the mega
AVR series. The high-performance Atmel 8-bit AVR RISC-based microcontroller combines
32 KB ISP flash memory with read-while-write capabilities, 1 KB EEPROM, 2 KB SRAM, 23
general purpose I/O lines, 32 general purpose working registers, three flexible timer/counters with
compare modes, internal and external interrupts, serial programmable us art, a byte-oriented 2-wire
serial interface, spi serial-port, a 6-channel 10 bit Analog to Digital converter (8-
channels)in tqfp and qfn/mlf packages),programmable watchdog timer with internal oscillator and
five software selectable power saving modes. The device operates between 1.8-5.5 volts. By
executing powerful instructions in a single clock cycle, the device achieves throughputs approaching
1 MIPS per MHz, balancing power consumption and processing speed.
A crystal oscillator is an electronic oscillator circuit that uses the mechanical resonance of a
vibrating crystal of piezoelectric material to create an electrical signal with a very
precise frequency. This frequency is commonly used to keep track of time (as in quartz
wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize
frequencies for radio transmitters and receivers. The most common type of piezoelectric resonator
used is the quartz crystal, so oscillator circuits incorporating them became known as crystal
27
oscillators, but other piezoelectric materials including polycrystalline ceramics are used in similar
circuits.
Quartz crystals are manufactured for frequencies from a few tens of kilohertz to hundreds of
megahertz. More than two billion crystals are manufactured annually. Most are used for consumer
devices such as wristwatches, clocks, radios, computers, and cell phones. Quartz crystals are also
found inside test and measurement equipment, such as counters, signal generators, and oscilloscopes.
A stepper motor is an electromechanical device it converts electrical power into mechanical power.
Also it is a brushless, synchronous electric motor that can divide a full rotation into an expansive
number of steps. The motor’s position can be controlled accurately without any feedback mechanism,
as long as the motor is carefully sized to the application. Stepper motors are similar to switched
reluctance motors.
The stepper motor uses the theory of operation for magnets to make the motor shaft turn a precise
distance when a pulse of electricity is provided. The stator has eight poles, and the rotor has six poles.
The rotor will require 24 pulses of electricity to move the 24 steps to make one complete revolution.
Another way to say this is that the rotor will move precisely 15° for each pulse of electricity that the
motor receives.
28
Figure 3.4 Stepper Motor (M55SP-1)
3.4.1 Features
High Output Torque
Superior running quietness and stability
Step Angle 7.5o, 48 Steps, 24Vdc, Unipolar Type
Dimensions: 55mm diameter, 23mm high, 66.7mm between holes.
29
3.4.3 Applications
1. Industrial Machines – Stepper motors are used in automotive gauges and machine tooling
automated production equipment’s.
2. Security – new surveillance products for the security industry.
3. Medical – Stepper motors are used inside medical scanners, samplers, and also found inside digital
dental photography, fluid pumps, respirators and blood analysis machinery.
4. Consumer Electronics – Stepper motors in cameras for automatic digital camera focus and zoom
functions.
And also have business machines applications, computer peripherals applications.
30
3.6 Ultrasonic Sensor
Ultrasonic sensors (also known as transceivers when they both send and receive, but more
generally called transducers) 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.
Sensors calculate the time interval between sending the signal and receiving the echo to determine
the distance to an object.
This technology can be used for measuring wind speed and direction (anemometer), tank or channel
level, and speed through air or water. For measuring speed or direction a device uses multiple
detectors and calculates the speed from the relative distances to particulates in the air or water. To
measure tank or channel level, the sensor measures the distance to the surface of the fluid. Further
applications include: humidifiers, sonar, medical ultra sonography, burglar alarms and non-
destructive testing.
Systems typically use a transducer which generates sound waves in the ultrasonic range, above
18,000 hertz, by turning electrical energy into sound, then upon receiving the echo turn the sound
waves into electrical energy which can be measured and displayed.
The HC-SR04 Ultrasonic Module has 4 pins, Ground, VCC, Trig and Echo. The Ground and the
VCC pins of the module needs to be connected to the Ground and the 5 volts pins on the Arduino
Board respectively and the trig and echo pins to any Digital I/O pin on the Arduino Board.
31
Chapter 4
Designing of PCB
A printed circuit board (PCB) mechanically supports and electrically connects electronic components
using conductive tracks, pads and other features etched from copper sheets laminated onto a non-
conductive substrate. A printed circuit board has pre-designed copper tracks on a conducting sheet.
The pre-defined tracks reduce the wiring thereby reducing the faults arising due to lose connections.
One needs to simply place the components on the PCB and solder them.
In this cool tutorial, I will show you how you can make circuit boards at home easily. Doing so will
save you a lot of time from debugging and double checking the connections on a breadboard. You
could even make your own Arduino after going through this tutorial: DIY Arduino and the current
one. So, sit back and see how it’s done really easily :)
Since laser method is industrial method to make PCB we will get in detail of first two methods to
make PCB at home.
32
4.3 PCB Design
PCB design is usually done by converting your circuit’s schematic diagram into a PCB layout using
PCB layout software. There are many cool open source software packages for PCB layout creation
and design.
You also need: FeCl3 powder/solution (same as etching solution), photo/glossy paper, permanent
black marker, blade cutter, sandpaper, kitchen paper, cotton wool.
33
For this tutorial, let’s consider making a PCB for a simple project- a Touch Switch using IC555.
Take a print out of your PCB layout using the laser printer and the A4 photo paper/glossy paper.
Keep in mind the following points:
34
STEP 2: Cutting the copper plate for the circuit board
Cut the copper board according to the size of layout using a hacksaw or a cutter.
Next, rub the copper side of PCB using steel wool or abrasive spongy scrubs. This removes the top
oxide layer of copper as well as the photo resists layer. Sanded surfaces also allows the image from
the paper to stick better.
35
Figure:-4.5 Rubbing away the top oxide layer
Method 1 Iron on glossy paper method (for complex circuits): Transfer the printed
image (taken from a laser printer) from the photo paper to the board. Make sure to flip top layer
horizontally. Put the copper surface of the board on the printed layout. Ensure that the board is
aligned correctly along the borders of the printed layout. And use tape to hold the board and the
printed paper in the correct position.
36
Figure: - 4.6 Place the printed side of the paper on the plate
Method 2 Circuit by hand on PCB (for simple and small circuits): Taking the circuit
as reference, draw a basic sketch on copper plate with pencil and then by using a permanent black
marker.
Figure: - 4.7 Using the permanent marker for sketching the PCB
37
STEP 4: Ironing the circuit from the paper onto the PCB plate
After printing on glossy paper, we iron it image side down to copper side. Heat up the electric iron
to the maximum temperature.
Put the board and photo paper arrangement on a clean wooden table (covered with a table cloth) with
the back of the photo paper facing you.
Using pliers or a spatula, hold one end and keep it steady. Then put the hot iron on the other end for
about 10 seconds. Now, iron the photo paper all along using the tip and applying little pressure for
about 5 to 15 mins.
Pay attention towards the edges of the board – you need to apply pressure, do the ironing slowly.
Doing a long hard press seems to work better than moving the iron around.
Here, the heat from the iron transfers the ink printed on the glossy paper to the copper plate.
CAUTION: Do not directly touch copper plate because it is very hot due to ironing.
38
After ironing, place printed plate in Luke warm water for around 10 minutes. Paper will dissolve,
then remove paper gently. Remove the paper off by peeling it from a low angle.
In some cases while removing the paper, some of the tracks get fainted. In the figure below, you can
see that the track is light in colour hence we can use a black marker to darken it as shown.
39
Figure: - 4.11 Darkening the trace
40
This process is called as Etching. Use pliers to take out the PCB and check if the entire
unmasked area has been etched or not. In case it is not etched leave it for some more
time in the solution.
Gently move the plastic box to and fro so that etching solution reacts with the exposed copper. The
reaction is given as:
Cu + FeCl3 = CuCl3 + Fe
After every two minutes check if all the copper has been removed. If it hasn’t then place it back in
the solution and wait.
CAUTION: Always use gloves while touching the plate having the solution.
41
Figure: - 4.13 Etched copper plate
STEP 6: Cleaning, disposing and final touches for the circuit board
Be careful while disposing the etching solution, since its toxic to fish and other water organisms.
And don’t think about pouring it in the sink when you are done, it is illegal to do so and might
damage your pipes (here, who knew you could get arrested while making a PCB). So dilute the
etching solution and then throw it away somewhere safe.
A few drops of thinner (nail polish remover works well) on a pinch of cotton wool will remove
completely the toner/ink on the plate, exposing the copper surface. Rinse carefully and dry with a
clean cloth or kitchen paper. Trim to final size and smoothen edges with sandpaper.
42
Figure: - 4.14 Removing the ink
Now, drill holes using a PCB driller like this: PCB driller and solder all your cool components. If
you want that traditional green PCB look, apply solder resist paint on top: PCB lacquer. And finally!
Your super cool circuit board would be ready.
43
Chapter 5
Hardware Description
44
5.1.1 Introduction
This sensor is a high performance ultrasonic range finder. It is compact and measures an
amazingly wide range from 2cm to 4m. This ranger is a perfect for any systemic
application, or any other projects requiring accurate ranging information. This sensor can
be connected directly to the digital I/O lines of your microcontroller and distance can be
measured in time required for travelling of sound signal using simple formula as below.
Or
The module works on 5VDC input and also gives an output signal directly for detection of
any obstacle up to 4M.
5.1.2 Working
Power up the sensor by 5VDC using pins “VCC” and “GND”. First of all a 10us
trigger input has to be given to the pin named “Trig” on the sensor. This starts one
cycle of range conversion and sends 8 bursts of sound waves from the transmitter.
As soon as the signals are transmitted the “Echo” pin goes to high level and remains in
high level until the same sound waves are received by the receiver. If the received sound
waves are same as what the same sensor transmitted then the Echo pin goes to low level. If
no object is detected within 5M after 30ms the Echo signal will automatically go to low
level.
*Caution: Burst should not be re-transmitted before one cycle of range conversion
is over and echo pin has been pulled to low by the sensor.
5.1.3 Features
45
• Working frequency: 40HZ
• Output: 0-5V (Output high when obstacle detected in range)
• Beam Angle: Max 15 degree
• Distance: 2cm - 400cm
• Accuracy: 0.3cm
• Input trigger signal: 10us impulse TTL
• Echo signal: PWM signal (time required for sound signal to travel twice between source
and obstacle)
• Size: 45mm*20mm*15 mm
46
Figure 5.3:- AVR chip, programmer, adapter, breadboard and power supply
5.3.1 Hardware
4.7K resistor
1k resistor
47
LED
Motor Driver
Ultrasonic Sensors
Arduino UNO
Stepper motor
AVR Chip: I’ll use the atmega328p
Programmer: AVR ISP MKII
Jumper Wires
5V Power supply. You can of course use batteries if you prefer.
5.3.2 Software
AVR Studio 5
MC Programming Language: Embedded C
Arduino IDE
Simply find the pins in your programmer, match them to the pins in your chip and connect
them. Also connect the resistor from pin 7 to power. Figure 5.4:- AVRISP MKII pins
48
Figure 5.5:- ATmega328p pin out
Now because the programmer doesn’t have one squared whole, or at least mine doesn’t, it
has many, let me show how that looks in real life, and yes it is like a mirror image of the
image above (weird right?).
49
Figure 5.6 AVR ISP MKII holes
50
Figure 5.7:- AVRISP MKII: circuit to program
..Let’s move on to the software. Check out the picture at the very top of this page to see how
much neater your circuit will be with the programming adapter.
Let me go ahead and walk you through the steps of using AVR Studio 5.
Once you have opened AVR Studio click on File ->New -> Project.
51
Figure 5.8:- Creating a new project in AVR Studio 5
Name your project, I named mine first program. Now click the OK button.
52
Figure5.9:- Naming your project
53
Next you will be greeted with an almost blank C file.
54
So what software are we going to write? How about we make a led blinker. Connect an LED
to port C5 of your microcontroller through the 1k resistor and then to ground.
Figure 5.11:- Red led connected to port C5 (pin 28) of the ATmega328p
55
Now back to AVR Studio. Replace the text in the file with the following.
1. #include <avr/io.h>
2. #include <avr/delay.h> // has some delay functions you can use
3.
4. int main(void)
5. {
6. DDRC=0xff; // all C ports as output
7. while(1)
8. {
9. //TODO:: Please write your application code
10.
11. PORTC=0xff; // turn on all C porst
12. _delay_ms(200); // wait 200 milliseconds
13. PORTC=0x00; // turn off all c ports
14. _delay_ms(200); // wait 200 milliseconds
15.
16.
17. }
18. }
The code that gets uploaded to the microcontroller is actually a HEX file, but we have to tell
AVR Studio to make this file. To do that right click on your project’s name on the right in
the solution explorer window and click on The code that gets uploaded to the microcontroller
is actually a HEX file, but we have to tell AVR Studio to make this file. To do that right
click on your project’s name on the right in the solution explorer window and click on
properties.
56
57
58
59
60
61
Figure 5.12:- Hex file checkbox, make sure it's checked.
62
Now to actually generate the hex file click Build->Build Solution
Avr studio build menu this will compile the program and generate the hex file we need.
Program compilation errors no compilation errors Upload the Code to The Microcontroller
At last, we are done with all the software developing stuff, uploading is just as easy.
AVR studio tools menu you’ll get the programming window. Make sure that your device is
selected.avr programming window the programming window Now in the following order,
click on the Apply button, then the voltage button (recycling/refresh looking icon) will
become active now click it, you should get some value close to 5 volts. Then click on the
Read button. If you didn’t get any error window you are good to go.
Clicking the Read and Voltage buttons is not necessary actually, but the Apply button is.
Avr studio programming window: 5 volts and device id programming window after clicking
buttons lastly click on Memories and select your hex file then click Program, the programmer
will start blinking and stop when your program is done uploading. Avr studio memories
window, hex file ready to upload hex file ready for upload.
63
Chapter 6
PRACTICAL IMPLEMENTATION
Since, we believe in learning by doing. So, we decided to make our own Arduino board
instead of using the readymade board. So, the steps required to make an Arduino board are
as follows:
Boot loading an Atmega328 using the Arduino board by uploading the boot loader program
to the Microcontroller.
Making the connections on a general purpose PCB, connecting the crystal oscillator,
capacitors, connectors for the connections to Arduino board etc.
64
After you have done all this, then only the minimum circuitry like crystal oscillator,
capacitors, connectors, power supply is required to complete the board. The same circuit can
be made on the PCB, either designed or general purpose. Since, Arduino is an Open-Source.
Hence, it is easy to make and can have any enhancements as per the requirements.
65
6.2 Connecting the Stepper Motor
A servomotor is a rotary actuator that allows for precise control of angular position,
velocity and acceleration.
A normal servo motor has three terminals:
1. VCC
2. GND
3. PULSE
A servo motor works at normally 4.8 to 6 volts. GND is provided by connecting it to the
Ground of the Arduino. The total time for a servo motor pulse is usually 20ms. To move it
to one end of say 0 degree angle, a 1ms pulse is used and to move it to other end i.e. 180
degree, a 2ms pulse is applied. Hence, according to this to move the axis of the servo motor
to the center, a pulse of time 1.5 MS should be applied. For this, the pulse wire of the servo
motor is connected to the Arduino that provides the digital pulses for pulse width modulation
of the pulse. Hence, by programming for a particular pulse interval the servo motor can be
controlled easily.
66
6.3 Connecting the Ultrasonic Sensor
An Ultrasonic Sensor consists of three wires. One for VCC, second for GND and the third
for pulse signal. The ultrasonic sensor is mounted on the servo motor and both of
them further connected to the Arduino board. The ultrasonic sensor uses the reflection
principle for its working. When connected to the Arduino, the Arduino provides the pulse
signal to the ultrasonic sensor which then sends the ultrasonic wave in forward direction.
Hence, whenever there is any obstacle detected or present in front, it reflects the waves which
are received by the ultrasonic sensor. If detected, the signal is sent to the Arduino and hence
to the PC/laptop to the processing software that shows the presence of the obstacle on the
rotating RADAR screen with distance and the angle at which it has been detected.
67
Figure 6.3: Connecting Ultrasonic Sensor to Arduino
Arduino programs are written in C or C++. The Arduino IDE comes with a software
library called "Wiring" from the original Wiring project, which makes many common
68
input/output operations much easier. Users only need define two functions to make a run
able cyclic executive program:
Setup(): a function run once at the start of a program that can initialize settings
Loop (): a function called repeatedly until the board powers off.
Open the Arduino IDE software and select the board in use. To select the board:
Go to Tools.
Select Board.
Under board, select the board being used, in this case Arduino Uno.
Go to Tools and to Port and select the port at which the Arduino board is connected.
Write the code in the space provided and click on compile. Once the code is compiled, click
69
on upload to upload the sketch to the Arduino board.
70
6.6 Problems Faced
Since, electronic components when used to form any circuit require some amount of
troubleshooting to make the circuit work according to our expectations. In our project, there
were some problems that we had to deal with.
The Arduino boards are available readily in the electronics market, but we decided to
make our own Arduino board instead of buying one. So, the first problem was where to start
from to achieve this goal. Since, all parts on an Arduino board are SMD’s, so we had to find
a way to replace the SMD’s with DIP IC’s and also had to make an AVR programmer in
order to pursue our further work. Hence, it took us some days to determine and plan our
course of action.
After that we had to boot load the AVR chip so as to make it compatible with the Arduino
IDE software. Hence, we had to find a way to boot load the Arduino using the AVR
programmer. It took us a long time to make the AVR programmer by researching on the type
of communication and architecture of the AVR as it is not as same as an 8051
microcontroller.
Another major problem related to the Arduino board was the communication with it from
PC. Since, we require RS-232 to TTL conversion for the communication, so we tried some
methods:
1. Firstly we used the MAX-232 IC to communicate with the Arduino as with the 8051 but
due to large voltage drop and mismatch in the speed, it failed to communicate.
2. Next, we tried to use a dedicated AVR as USB to Serial converter as in the original
Arduino board, the difference being DIP AVR used by us instead of the SMD Mega16U2
controller. But, unfortunately we were unable to communicate through it.
71
3. At last we had no other choice but to complete the project in time by using the FTDI FT-
232R chip for USB to Serial conversion. Finally IT WORKED!!!
The next part of the project was to be able to display the RADAR screen. For this we
used VB.NET to form the RADAR screen but interfacing it with the Arduino input was a
little bit of a problem and not synchronized with the Arduino input. After a lot of trials, we
came to know about the Processing software (Version 2.0). So, we had to go through a lot
of programs to finally program it to form the RADAR screen.
72
Chapter 7
Software Coding
#include<stdio.h>
unsigned char a,b,x,y,z,d,i;
#define LCD_DATA PORTB // In my case PORTB is the PORT from which I send data to
my LCD
#define Control_PORT PORTA // In my case PORTC is the PORT from which I set the RS
, R/W and En
#define En PORTA7 // Enable signal
#define RW PORTA6 // Read/Write signal
#define RS PORTA5 // Register Select signal
#define Monitor PORTC //
#define OUT1 PORTC6 // VC supply
#define OUT2 PORTC5 // VC supply
#define OUT3 PORTC2 // VC supply
#define OUT4 PORTC3 // VC supply
#define EN1 PORTC7 // VC supply
#define EN2 PORTC4 // VC supply
void init_LCD();// Function to initialize the LCD
void LCD_cmd(unsigned char cmd);// Function to send command to th LCD
void LCD_write(unsigned char data);// Function to display character on LCD
void LCD_cmd(unsigned char cmd)
{
LCD_DATA=cmd;
Control_PORT =(0<<RS)|(0<<RW)|(1<<En); // RS and RW as LOW and EN as HIGH
_delay_ms(10);
Control_PORT =(0<<RS)|(0<<RW)|(0<<En); // RS, RW , LOW and EN as LOW
_delay_ms(10);
return;
}
73
Control_PORT = (1<<RS)|(0<<RW)|(0<<En); // EN and RW as LOW and RS HIGH
_delay_ms(10); // delay to get things executed
return ;
}
void LCD_write_string(unsigned char *str) //take address vaue of the string in pionter *str
{
int i=0;
while(str[i]!='\0') // loop will go on till the NULL charaters is soon in string
{
LCD_write(str[i]); // sending data on CD byte by byte
i++;
}
return;
}
void dist(void)
///////DISTANCE
while(cor!= 0X0D)
{
while(! (UCSRA & (1<<RXC)));
cor = UDR ;
74
x=0;
while(buf[x]!= 0X0D) /// $
{
for(z=1;z<x;z++)
{
usart_send(buf[z]);
_delay_ms(20);
}
_delay_ms(10);
usart_send(',');
_delay_ms(10);
LCD_cmd(0X01);
for(z=1;z<x;z++)
{
LCD_write(buf[z]);
_delay_ms(500);
}
x=0;
for(z=0;z<10;z++)
{
buf[z] = '_';
_delay_ms(10);
}
//////DISTANCE
75
}
int main(void)
{
DDRC=0Xff;
DDRA=0Xf0;
DDRB=0Xff;
DDRD=0Xff;
LCD_cmd(0X38);
_delay_ms(10);
LCD_cmd(0X01);
_delay_ms(10);
LCD_cmd(0X0C);
_delay_ms(10);
LCD_cmd(0X80);
_delay_ms(1000);
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(0<<EN1)|(0<<EN2) ;
usart_send('N');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
while(1)
{
dist();
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(0<<EN1)|(0<<EN2) ;
_delay_ms(2000);
76
usart_send('N');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
LCD_write_string("N");
//////////North
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("N");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("N");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
77
////////message//////
usart_send('N');
usart_send('W');
usart_send('N');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NWN");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('W');
usart_send('N');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NWN");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
78
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NW");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NW");
//////////North west
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NW");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
79
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NW");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('W');
usart_send('N');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("WNW");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('W');
usart_send('N');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("WNW");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
80
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("W");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("W");
////////// west
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("W");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
81
_delay_ms(1000); dist();
////////message//////
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("W");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('W');
usart_send('S');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("WSW");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('W');
usart_send('S');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("WSW");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
82
_delay_ms(1000); dist();
////////message//////
usart_send('S');
_delay_ms(10);
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("SW");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("SW");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
83
LCD_write_string("SW");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("SW");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('S');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("SSW");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('S');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
84
////////message//////
LCD_write_string("SSW");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("S");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
usart_send('S');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
////////// south
LCD_write_string("S");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
85
LCD_write_string("S");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("S");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('S');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("SSE");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('S');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
86
_delay_ms(10);
////////message//////
LCD_write_string("SSE");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("SE");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
usart_send('S');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////// south east
LCD_write_string("SE");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('E');
87
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("SE");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("SE");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('E');
usart_send('S');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("ESE");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
88
_delay_ms(1000); dist();
////////message//////
usart_send('E');
usart_send('S');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("ESE");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("E");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
////////// east
LCD_write_string("E");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
89
_delay_ms(1000); dist();
////////message//////
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("E");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("E");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('E');
usart_send('N');
90
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("ENE");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('E');
usart_send('N');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("ENE");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('E');
_delay_ms(10);
usart_send(13);
91
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NE");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NE");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('E');
_delay_ms(10);
usart_send(13);
92
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NE");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NE");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('N');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
93
LCD_write_string("NNE");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('N');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NNE");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
94
LCD_write_string("N");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
///////North
LCD_write_string("N");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(0<<EN1)|(0<<EN2) ;
_delay_ms(5000);
////////message//////
usart_send('N');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
/// reverse
95
LCD_write_string("N");
///////North
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("N");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("N");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('N');
usart_send('E');
_delay_ms(10);
96
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NNE");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('N');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NNE");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
97
LCD_write_string("NE");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
///////North east
LCD_write_string("NE");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
98
LCD_write_string("NE");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NE");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('E');
usart_send('N');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
99
LCD_write_string("ENE");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('E');
usart_send('N');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("ENE");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("E");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
100
////////message//////
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
/////// east
LCD_write_string("E");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("E");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('E');
101
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("E");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('E');
usart_send('S');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("ESE");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('E');
usart_send('S');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
102
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("ESE");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("SE");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
103
/////// south east
LCD_write_string("SE");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("SE");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
104
LCD_write_string("SE");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('S');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("SSE");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('S');
usart_send('E');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
105
LCD_write_string("SSE");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("S");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
/////// south
LCD_write_string("S");
106
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("S");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("S");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('S');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
107
////////message//////
LCD_write_string("SSW");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('S');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("SSW");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("SW");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
108
usart_send('S');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("SW");
/////// south west
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("SW");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('S');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
109
LCD_write_string("SW");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('W');
usart_send('S');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("WSW");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('W');
usart_send('S');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
110
LCD_write_string("WSW");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("W");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("W");
/////// west
111
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("W");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("W");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('W');
usart_send('N');
112
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("WNW");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('W');
usart_send('N');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("WNW");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NW");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
113
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NW");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NW");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NW");
Monitor = (0<<OUT1)|(0<<OUT2)|(0<<OUT3)|(1<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
114
usart_send('N');
usart_send('N');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NNW");
Monitor = (0<<OUT1)|(0<<OUT2)|(1<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
usart_send('N');
usart_send('W');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("NNW");
Monitor = (0<<OUT1)|(1<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
_delay_ms(10);
usart_send(13);
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("N");
Monitor = (1<<OUT1)|(0<<OUT2)|(0<<OUT3)|(0<<OUT4)|(1<<EN1)|(1<<EN2) ;
_delay_ms(1000); dist();
////////message//////
usart_send('N');
_delay_ms(10);
usart_send(13);
115
_delay_ms(10);
usart_send(10);
_delay_ms(10);
////////message//////
LCD_write_string("N");
/////// north
return 0;
#include <avr/io.h>
#include <util/delay.h>
#include "xstepper.h"
void main()
{
//Initialize the stepper library
StepperInit();
_delay_loop_2(10000);
while(1)
{
for(uint16_t i=0;i<24*85;i++)
116
{
StepperStepCW(); //Step Clock wise
_delay_loop_2(10000);
}
for(uint16_t i=0;i<24*85;i++)
{
StepperStepCCW(); //Step Counter Clock wise
_delay_loop_2(10000);
}
}
void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(led, OUTPUT);
pinMode(led2, OUTPUT);
}
void loop() {
long duration, distance;
digitalWrite(trigPin, LOW); // Added this line
delayMicroseconds(2); // Added this line
digitalWrite(trigPin, HIGH);
// delayMicroseconds(1000); - Removed this line
delayMicroseconds(10); // Added this line
117
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
if (distance < 4) { // This is where the LED On/Off happens
digitalWrite(led,HIGH); // When the Red condition is met, the Green
LED should turn off
digitalWrite(led2,LOW);
}
else {
digitalWrite(led,LOW);
digitalWrite(led2,HIGH);
}
if (distance >= 200 || distance <= 0){
Serial.println("Out of range");
}
else {
Serial.print(distance);
Serial.println(" cm");
}
delay(500);
}
118
Chapter 8
PRESENT AND FUTURE SCOPE OF PROJECT
The project made by us can be used in any systems you may want to use like in a car, a
bicycle or anything else. The use of Arduino in the project provides the flexibility of usage
of the above-said module according to the requirements.
Figure
8.1
Driverless
Car
119
8.1 Applications in Air Force
In aviation, aircraft are equipped with radar devices that warn of aircraft or other obstacles
in or approaching their path, display weather information, and give accurate altitude
readings. The first commercial device fitted to aircraft was a 1938 Bell Lab unit on
some United Air Lines aircraft. Such aircraft can land in fog at airports equipped with radar-
assisted ground-controlled approach systems in which the plane's flight is observed on radar
screens while operators radio landing directions to the pilot.
120
8.2 Naval Applications
Marine radars are used to measure the bearing and distance of ships to prevent collision
with other ships, to navigate, and to fix their position at sea when within range of shore or
other fixed references such as islands, buoys, and lightships. In port or in harbor, vessel
traffic service radar systems are used to monitor and regulate ship movements in busy
waters.
121
8.3 Applications in Army
Figure 8.4 Army Using Radar to Spot Suicide Bombers From100 Yards
Two video cameras automatically detect and track individuals walking anywhere
near the system, within the range of a soccer field. Low-level radar beams are aimed at them
and then reflected back to a computer, which analyzes the signals in a series of algorithms.
It does this by comparing the radar return signal (which emits less than a cell phone) to an
extensive library of “normal responses.” Those responses are modeled after people of all
different shapes and sizes (SET got around to adding females in 2009). It then compares the
signal to another set of “anomalous responses” – any anomaly, and horns go off. Literally,
when the computer detects a threat, it shows a red symbol and sounds a horn. No threat and
the symbol turns green, greeting the operators with a pleasant piano riff.
122
8.4 Meteorological Applications
Meteorologists use radar to monitor precipitation and wind. It has become the primary tool
for short-term weather forecasting and watching for severe weather such
as thunderstorms, tornadoes, winter storms, precipitation types, etc. Geologists use
specialized ground-penetrating radars to map the composition of Earth's crust.
123
8.5 A LOOK AT THE FINAL PROJECT
124
Figure: - 8.7 Final Project LCD Display
125
Figure:-8.8 Final Project, RADAR Screen
126
8.6 REFERENCES
[1] http://www.arduino.cc/
[3] http://www.atmel.com/atmega328/
[4] http://en.wikipedia.org/wiki/File:16MHZ_Crystal.jpg
[5]http://www.google.co.in/imgres?imgurl=http://www.electrosome.com/wp-
content/uploads/2012/06/ServoMotor.gif&imgrefurl=http://www.electrosome.com/tag/serv
omotor/
[6] http//:www.sproboticworks.com/ic%20pin%20configuration/7805/Pinout.jpg/
[7] http://www.sproboticworks.com/ic%ultrasonicsensor%20pinout.jpg
[9] http://www.motherjones.com/files/blog_google_driverless_car.jpg
[10] http://www.google.co.in/imgres/Radar_antenna.jpg&w=546&h=697&ei=wuuK
[11] http://www.radomes.org/museum/photos/equip/ANSPS17.jpg
[13] http://upload.wikimedia.org/wikipedia/commons/Radaraccumulationseng.png
[14] http://arduino.cc/en/Tutorial/BarGraph/
[15] http://arduino.cc/en/Tutorial/LiquidCrystal/
[16] http://fritzing.org/
127