Вы находитесь на странице: 1из 36

Ultrasonic Detection and Ranging

1 . INTRODUCTION
RADAR stands for Radio Detection and Ranging. RADAR is an electromagnetic
system used to detect the location and distance of an object from the point where the
RADAR is placed. It works by radiating energy into space and monitoring the Echo or
reflected signal from the objects. It operates in the UHF and microwave range RADAR
information is obtained in different ways sound alarm or LED, modern uses LCD display or
a PC to show detailed information of the targeted object (distance and angle).The main
principle of RADAR system depends on the type of ultrasonic sensor which evaluates
attributes of a target by interpreting the echoes from radio or sound waves. When instead of
electromagnetic waves, we use ultrasonic waves; it is called ultrasonic radar.

A basic RADAR system consists of:

 A Transmitter: It can be a power amplifier, or a power Oscillator. 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.

RADAR’s are of different types, mostly based on application specified, two major
types of radars are primary and secondary radars. While the primary radar work on basis of

ECE Department, NNRG


1
Ultrasonic Detection and Ranging

detecting echo of radio waves transmitted by earth station, the secondary radar depends of
signal from transponders onboard the aircraft.

1. Surveillance Radars
2. Tracking Radars
3. Meteorological Radars
4. Imaging Radar
5. Radar Altimetry

1.1 HISTORY
The history of radar started with experiments by Heinrich hertz in the late
19th century that showed that radio waves were reflected by metallic objects. The first for
of RADAR created was Telemobilescope used to detect ships to avoid collisions. During
the 1970s digital technology underwent a tremendous advance, which made practical the
signal and processing required for modern radar. Significant advances also were made in
airborne pulse Doppler radar, greatly enhancing its ability to detect aircraft in the midst of
heavy ground clutter. The U.S. Force’s airborne-warning-and-control-system (AWACS)
radar and military airborne-intercept radar depend on the pulse Doppler principle. It
might be noted too, that radar began to be used in spacecraft for remote sensing of
the environment during the 1970s.

Over the next decade radar methods evolved to a point where radars were able to
distinguish one type of target from another. Serial production of phased-array radars for air
defense (the Patriot and Aegis systems), airborne bomber radar (B-1B aircraft), and ballistic
missile detection (Pave Paws) also became feasible during the 1980s. Advances in remote
sensing made it possible to measure winds blowing over the sea, the geoids (or mean sea
level), ocean roughness, ice conditions, and other environmental effects. Solid-state
technology and integrated microwave circuitry permitted new radar capabilities that had
been only academic curiosities a decade or two earlier.

ECE Department, NNRG


2
Ultrasonic Detection and Ranging

Continued advances in computer technology in the 1990s allowed increased


information about the nature of targets and the environment to be obtained from radar
echoes. The introduction of Doppler weather radar systems (as, for example, Nexrad),
which measure the radial component of wind speed as well as the rate of precipitation,
provided new hazardous-weather warning capability. Terminal Doppler weather radars
(TDWR) were installed at or near major airports to warn of dangerous wind shear during
takeoff and landing. Unattended radar operation with little downtime for repairs was
demanded of manufacturers for such applications as air traffic control. HF over-the-horizon
radar systems were operated by several countries, primarily for the detection of aircraft at
very long ranges (out to 2,000 nautical miles [3,700 km]). Space-based radars continued to
gather information about the Earth’s land and sea surfaces on a global basis.
Improved imaging radar systems were carried by space probes to obtain higher-resolution
three-dimensional images of the surface of Venus, penetrating for the first time its ever-
present opaque cloud cover.

The first ballistic missile defense radars were conceived and developed in the mid-
1950s and 1960s. Development in the United States stopped, however, with the signing in
1972 of the antiballistic missile (ABM) treaty by the Soviet Union and the United States.
The use of tactical ballistic missiles during the Persian Gulf War (1990–91) brought back
the need for radars for defense against such missiles. Russia (and before that, the Soviet
Union) continually enhanced its powerful radar-based air-defense systems to engage
tactical ballistic missiles. The Israelis deployed the Arrow phased-array radar as part of an
ABM system to defend their homeland. The United States developed a mobile active-
aperture (all solid-state) phased-array called Theater High Altitude Area Defense Ground
Based Radar (THAAD GBR) for use in a theatrewide ABM system.

Advances in digital technology in the first decade of the 21st century sparked
further improvement in signal and data processing, with the goal of developing (almost) all-
digital phased-array radars. High-power transmitters became available for radar application
in the millimeter-wave portion of the spectrum (typically 94 GHz), with average powers
100 to 1,000 times greater than previously.

ECE Department, NNRG


3
Ultrasonic Detection and Ranging

1.2 PROBLEM DEFINITION

We come across situations where we need to keep a watch over prohibited areas to
avoid trespassing. Now keeping human labor for this purpose is costly and also not reliable
for keeping a watch over an area 24×7. So for this purpose ultrasonic radar project for
unauthorized human / animal or object detection system can be used. The system can
monitor an area of limited range and alerts authorities. The radar keeps monitoring the
environment checking the ultrasonic sensor echo. As soon as an object is detected the data
of detection is processed and sent to authorities with an alert of where exactly the object
was detected. Thus ultrasonic radar proves to be a very useful system for 24×7 monitoring
of a particular area/region.

1.3 OBJECTIVE OF THE PROJECT


The Ultrasonic RADAR for object detection, distance and speed measurement,
objective of this project is to sense any fixed or moving object which is in the range of
ultrasonic sensor and to calculate the distance of that object from the system, also measure
the speed of the moving object. The speed and distance will be showed on the real time
LCD display.

1.4 EXISTING SYSTEM


This system is a manual system. In that we use optical sensors, which are used to
detect the object in comparatively small range.

1.5 DRAWBACKS OF EXISTING SYSTEM


 Detection using optical sensors may get effected due to interference of dust and
water.

ECE Department, NNRG


4
Ultrasonic Detection and Ranging

 Measuring range is small.


 Poor operation in dark environment.

1.6 PROPOSED SYSTEM


To overcome the drawback of existing system, we are using ultrasonic sensors.

1.7 CONCLUSION
The objective of this project was to design and implement an Ultrasonic Distance
Measurement device. As described in this a system is developed that can calculate the
distance of the tracked object. With respect to the requirements for an ultrasonic
rangefinder the followings can be concluded.

 The system can calculate the distance of the obstruction with sufficient accuracy.
 This device has the capability to interact with other peripheral if used as a secondary
device.
 This can also communicate with pc through its serial port.
 This offers a low cost and efficient solution for non-contact type distance
measurements.

ECE Department, NNRG


5
Ultrasonic Detection and Ranging

2. LITERATURE REVIEW

2.1 ARDUINO UNO


Arduino is a hardware and software company, project, and user community that
designs and manufactures computer open-source hardware, open-source software, and
microcontroller-based kits for building digital devices and interactive objects that can sense
and control physical devices. "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. It operates with the help of ATmega-328Pmicro controller.

Figure 2.1: Arduino UNO

ATmega-328P is a single chip micro-controller created by Atmel and belongs to


mega AVR series. The high performance Atmel 8-bitAVR RISC-based micro-controller
combines 32-kb ISP flash memory capabilities, 1kb EEPROM, 2kb SRAM, 23 general
purpose I/O lines, 32 General purpose registers,3 flexible timers/counters with compare
modes, internal and external interrupts ,serial programmable USART,A byte –oriented 2-

ECE Department, NNRG


6
Ultrasonic Detection and Ranging

wire serial interface, SPI serial-port, a 6-channel 10bit ADC, The device operates between
1.8-5. 5volts.

2.1.1 WHAT IS ARDUINO?

Arduino Uno is a microcontroller board based on the ATmega328P shown in figure


2.1. It has 14 digitalinput/output pins (of which 6 can be used as PWM outputs), 6 analog
inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and a
reset button which is shown in figure 2.2. It contains everything needed to support the
microcontroller; simply connect it to a computer with a USB cable or power it with an AC-
to-DC adapter or battery to get started. The complete specifications of Arduino UNO is
shown in given in table 2.1.

"Uno" means one in Italian and was chosen to mark the release of Arduino Software
(IDE) 1.0. The Uno board and version 1.0 of Arduino Software (IDE) were the reference
versions of Arduino, now evolved to newer releases.

2.1.2 Why Arduino and differences between arduino and other boards

A microcontroller is a device that involves an embedded microprocessor and has the


required interfacing circuitry so as to be able to put to direct use in real time.

For eg. The 8051 is a microcontroller that has its microprocessor and also has the input
output pins and other stuff such as timers, counters etc. all on board. So basically a
microcontroller is a microprocessor based electronic device that can be deployed for real-
time applications and can be programmed. In a similar sense, an Arduino is simply a
microcontroller based development board.

In essence, Microcontroller = Microprocessor + Interfacing Circuitry. It can only be


programmed using either the Assembly code or Keil C both of which requires practice and
is tedious.

Arduino = Microcontroller + Crystal + on-board power supply pins, bootloader so


that it can be programmed using a simple way through the Arduino IDE.

ECE Department, NNRG


7
Ultrasonic Detection and Ranging

The Uno differs from all preceding boards in that it does not use the FTDI USB-to-
serial driver chip. Instead, it features the Atmega16U2 (Atmega8U2 up to version R2)
programmed as a USB-to-serial converter.

2.1.3 Power
The Arduino Uno board can be powered via the USB connection or with an external
power supply. The power source is selected automatically. External (non-USB) power can
come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be
connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads
from a battery can be inserted in the GND and Vin pin headers of the POWER connector.
The board can operate on an external supply from 6 to 20 volts. If supplied with less than
7V, however, the 5V pin may supply less than five volts and the board may become
unstable. If using more than 12V, the voltage regulator may overheat and damage the
board. The recommended range is 7 to 12 volts.

The power pins are as follows:

 Vin: The input voltage to the Arduino/Genuino board when it's using an external
power source (as opposed to 5 volts from the USB connection or other regulated
power source). You can supply voltage through this pin, or, if supplying voltage via
the power jack, access it through this pin.

 5V: This pin outputs a regulated 5V from the regulator on the board. The board can
be supplied with power either from the DC power jack (7 - 12V), the USB
connector (5V), or the VIN pin of the board (7-12V). Maximum current draw is 50
mA.
 GND: Ground pins.
 IOREF: This pin on the Arduino/Genuino board provides the voltage reference with
which the microcontroller operates. A properly configured shield can read the
IOREF pin voltage and select the appropriate power source or enable voltage
translators on the outputs to work with the 5V or 3.3V.

ECE Department, NNRG


8
Ultrasonic Detection and Ranging

2.2 Specifications of Arduino Uno

Microcontroller - ATmega328

Operating Voltage - 5V

Input Voltage (recommended) - 7-12V

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)

SRAM - 2 KB (ATmega328)

EEPROM - 1 KB (ATmega328)

Clock Speed - 16 MHz

Length - 68.6 mm

Width - 53.4mm

ECE Department, NNRG


9
Ultrasonic Detection and Ranging

2.3 PIN CONFIGURATION OF ATmega328P

Figure 2.2: Pin Diagram of Atmega328P

2.3.1 PIN DESCRIPTION


Table 2.1: Pin Description of Atmega328P

I/O , T0 ( Timer0 External Counter Input) ,XCK : USART External


PIN 1
Clock I/O

PIN 2 I/O, T1 (Timer1 External Counter Input)

I/O, AIN0: Analog Comparator Positive Input , INT2: External


PIN 3
Interrupt 2 Input

I/O, AIN1: Analog Comparator Negative Input, OC0 : Timer0 Output


PIN 4
Compare Match Output

ECE Department, NNRG


10
Ultrasonic Detection and Ranging

PIN 9 Reset Pin, Active Low Reset

PIN 10 VCC=+5V

PIN 11 GND

PIN 12 XTAL2

PIN 13 XTAL1

PIN 14 (RXD) ,I/O PIN 0,USART Serial Communication Interface

PIN 15 (TXD) ,I/O Pin 1,USART Serial Communication Interface

PIN 16 (INT0),I/O Pin 2, External Interrupt INT0

PIN 17 (INT1),I/O Pin 3, External Interrupt INT1

PIN 18 (OC1B),I/O Pin 4, PWM Channel Outputs

PIN 19 (OC1A),I/O Pin 5, PWM Channel Outputs

PIN 20 (ICP), I/O Pin 6, Timer/Counter1 Input Capture Pin

PIN 21 (OC2),I/O Pin 7,Timer/Counter2 Output Compare Match Output

PIN 22 (SCL),I/O Pin 0,TWI Interface

PIN 23 (SDA),I/O Pin 1,TWI Interface

ECE Department, NNRG


11
Ultrasonic Detection and Ranging

PIN 24-27 JTAG INTERFACE

PIN 28 (TOSC1),I/O Pin 6,Timer Oscillator Pin 1

PIN 29 (TOSC2),I/O Pin 7,Timer Oscillator Pin 2

PIN 30 AVCC (for ADC)

PIN 31 GND (for ADC)

PIN 33-
PAx: I/O,ADCx (Where x is 7 – 0)
PIN 40

2.3.2 Block Diagram

Figure 2.3: Block Diagram of ATmega328P

ECE Department, NNRG


12
Ultrasonic Detection and Ranging

2.3.3 Features of Atmega328P

Table 2.2: Features of ATmega328P

Features Atmega328P
Pin count 28

Flash 32K

SRAM 2K

EEPROM 1K

General purpose I/O lines 23

SPI 2

TWI 1

USART 1

ADC 10bit 15k SPS

ADC channels 8

Timers/Counters 8-bit 2

Timers/Counters 16-bit 1

2.3.4 AVR CPU Core

The main function of the CPU core is to ensure correct program execution. The CPU
must therefore be able to access memories, perform calculations, control peripherals, and
handle interrupts.

ECE Department, NNRG


13
Ultrasonic Detection and Ranging

Figure 2.4: AVR Architechture

ALU – Arithmetic Logic Unit: The high-performance AVR ALU operates in direct
connection with all the 32 general purpose working registers. Within a single clock cycle,
arithmetic operations between general purpose registers or between a register and an
immediate are executed. The ALU operations are divided into three main categories –
arithmetic, logical, and bit-functions. Some implementations of the architecture also
provide a powerful multiplier supporting both signed/unsigned multiplication and fractional
format.

Status Register: The Status Register contains information about the result of the most
recently executed arithmetic instruction. This information can be used for altering program
flow in order to perform conditional operations.

When addressing I/O Registers as data space using LD and ST instructions, the
provided offset must be used. When using the I/O specific commands IN and OUT, the
offset is reduced by 0x20, resulting in an I/O address offset within 0x00 - 0x3F.

ECE Department, NNRG


14
Ultrasonic Detection and Ranging

Figure 2.5: Status Registers of AVR

 Bit 7 – I: Global Interrupt Enable, The Global Interrupt Enable bit must be set for
the interrupts to be enabled. The individual interrupt enable control is then
performed in separate control registers. If the Global Interrupt Enable Register is
cleared, none of the interrupts are enabled independent of the individual interrupt
enable settings.
 Bit 6 – T: The Bit Copy instructions BLD (Bit Load) and BST (Bit Store) use the
T-bit as source or destination for the operated bit. A bit from a register in the
Register File can be copied into T by the BST instruction, and a bit in T can be
copied into a bit in a register in the Register File by the BLD instruction.
 Bit 5 – H: Half Carry Flag, The Half Carry Flag H indicates a Half Carry in some
arithmetic operations. Half Carry Flag is useful in BCD arithmetic.

 Bit 4 – S: Sign Flag, S = N ㊉ V The S-bit is always an exclusive or between the

Negative Flag N and the Two’s Complement Overflow Flag.


 Bit 3 – V: Two’s Complement Overflow Flag, The Two’s Complement Overflow
Flag V supports two’s complement arithmetic.
 Bit 2 – N: Negative Flag, The Negative Flag N indicates a negative result in an
arithmetic or logic operation.
 Bit 1 – Z: Zero Flag, The Zero Flag Z indicates a zero result in an arithmetic or
logic operation.

General Purpose Register File: The Register File is optimized for the AVR Enhanced
RISC instruction set. In order to achieve the required performance and flexibility, the
following input/output schemes are supported by the Register File:

• One 8-bit output operand and one 8-bit result input

ECE Department, NNRG


15
Ultrasonic Detection and Ranging

• Two 8-bit output operands and one 8-bit result input

• Two 8-bit output operands and one 16-bit result input

• One 16-bit output operand and one 16-bit result input

Figure 2.6: General Purpose Registers of AVR

X-register, Y-register, Z-register including High and Low byte used in the different
addressing modes these address registers have functions as fixed displacement, automatic
increment, and automatic decrement.

Stack Pointer: The Stack is mainly used for storing temporary data, for storing local
variables and for storing return addresses after interrupts and subroutine calls. The Stack is
implemented as growing from higher to lower memory locations. The Stack Pointer
Register always points to the top of the Stack. The Stack Pointer points to the data SRAM
Stack area where the Subroutine and Interrupt Stacks are located.

ECE Department, NNRG


16
Ultrasonic Detection and Ranging

A Stack PUSH command will decrease the Stack Pointer. The Stack in the data
SRAM must be defined by the program before any subroutine calls are executed or
interrupts are enabled.

Instruction Execution Timing: This section describes the general access timing concepts
for instruction execution. The AVR CPU is driven by the CPU clock (clkCPU), directly
generated from the selected clock source for the chip. No internal clock division is used.
The Figure below shows the parallel instruction fetches and instruction executions enabled
by the Harvard architecture and the fast-access Register File concept. This is the basic
pipelining concept to obtain up to 1 MIPS per MHz with the corresponding unique results
for functions per cost, functions per clocks, and functions per power-unit.

Figure 2.7: Parallel Fetch and Execution on Instruction in Atmega328P

The following Figure shows the internal timing concept for the Register File. In a
single clock cycle an ALU operation using two register operands is executed, and the result
is stored back to the destination register.

ECE Department, NNRG


17
Ultrasonic Detection and Ranging

Figure 2.8: Single Clock Cycle Examination in Atmega328P

Interrupt Response Time: The interrupt execution response for all the enabled AVR
interrupts is four clock cycles minimum. After four clock cycles the program vector address
for the actual interrupt handling routine is executed. During this four clock cycle period, the
Program Counter is pushed onto the Stack. The vector is normally a jump to the interrupt
routine, and this jump takes three clock cycles. If an interrupt occurs during execution of a
multi-cycle instruction, this instruction is completed before the interrupt is served. If an
interrupt occurs when the MCU is in sleep mode, the interrupt execution response time is
increased by four clock cycles. This increase comes in addition to the start-up time from the
selected sleep mode. A return from an interrupt handling routine takes four clock cycles.
During these four clock cycles, the Program Counter (two bytes) is popped back from the
Stack, the Stack Pointer is incremented by two, and the I-bit in SREG is set.

2.4 ULTRASONIC SENSOR HC-SR04

Ultrasonic sensors work on a principle similar to radar or sonar which evaluates


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), fullness of a tank and speed

ECE Department, NNRG


18
Ultrasonic Detection and Ranging

through air or water. Further applications include: humidifiers, sonar, medical ultra
pornography, burglar alarms and non-destructive testing. Systems typically use a transducer
which generates sound waves in the ultrasonic range, above 20,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.

Figure 2.9: Ultrasonic Sensor

2.4.1 Transducer

Transducers are defined as elements which can convert one form of energy to
another. The Ultrasonic transducers convert electrical energy into the sound waves and vice
versa. There are basically two kind of transducers used here, one to convert the electrical
waves into the sound waves which is called Ultrasonic Transmitter and the other to convert
the sound waves into the electrical waves or energy, called Ultrasonic Receiver. Below we
have explained the various blocks that the project could be broken into.

a. Transmitter circuit

The Ultrasonic sensors used in this project work at the frequency of 40 KHz. The 40
KHz signal is generated in the Micro Controller (uc). We use Atmega328 as the

ECE Department, NNRG


19
Ultrasonic Detection and Ranging

microcontroller. Atmega328 has a feature of timers which has been exploited to generate 40
kHz. This was a major challenge as we required exact 40 kHz for our circuit. This is then
amplified before it is fed into the transmitter. The output of Micro Controller is amplified
using an Open Collector Buffer (OCB) circuit.

The open collector buffer is an inverter with the open collector at the output. We
attach, say a 10K resistor from the output pin to 15V. To keep the signal polarity the same
as the input (not inverted) we place an inverter before the open collector one (inverting
twice). We have used the inverter IC 7406 to perform the operation of open collector buffer
and the IC 7404 to invert the output of Micro Controller.

The reason for not using traditional ways for amplifying like the Operation
Amplifier (say LM741) because Op Amps like LM741 will not have the bandwidth to
output a decent square wave at 40 kHz and the output becomes triangular.

b. Receiver Circuit

The Ultrasonic Receiver receives the sound waves if any and converts them into
electrical pulses which are mostly sinusoids. The amplitude of the received signal is about
40 mVolts to 50 mVolts which is quite less to carry out any kind of processing with. The
signal hence is amplified using to about 100 times so that it comes in the range of few volts.
Here we can use an Op Amp because we are not concerned with the shape of the pulses; we
just measure the amplitude to generate an interrupt.

ECE Department, NNRG


20
Ultrasonic Detection and Ranging

2.5 PIN CONFIGURATION OF HC-SR04

Table 2.3: Pin Configuration of HC-SR04

Pin
Pin Name Description
Number

1 Vcc The Vcc pin powers the sensor, typically with +5V

Trigger pin is an Input pin. This pin has to be kept


2 Trigger high for 10us to initialize measurement by sending
US wave.

Echo pin is an Output pin. This pin goes high for a


3 Echo period of time which will be equal to the time taken
for the US wave to return back to the sensor.

Ground This pin is connected to the Ground of the system.


4

2.5.1 Timing Diagram:

The Timing diagram is shown below. You only need to supply a short 10uS pulse to the trigger
input to start the ranging, and then the module will send out an 8 cycle burst of ultrasound at 40 kHz

ECE Department, NNRG


21
Ultrasonic Detection and Ranging

and raise its echo. The Echo is a distance object that is pulse width and the range in proportion .You
can calculate the range through the time interval between sending trigger signal and receiving echo
signal.

Formula:

uS / 58 = centimeters or

uS / 148 =inch;

or: the range = high level time * velocity (340M/S) / 2;

Figure 2.10: Timing Diagram of Ultrasonic Sensor

2.6 SERVO MOTOR

The servo motor we used in this project is Servo Motor tower pro micro servo 9g, A
Tiny and lightweight with high output power. The servo can rotate approximately 180
degrees (90 in each direction), and works just like the standard kinds. You can use any
servo code, hardware or library to control these servos.

ECE Department, NNRG


22
Ultrasonic Detection and Ranging

Figure 2.11: Servo Motor


2.6.1 SPECIFICATIONS

1. Weight: 9 g,
2. Dimension: 22.2 x 11.8 x 31 mm approx,
3. Stall torque: 1.8 kg f cm,
4. Operating speed: 0.1 s/60 degree,
5. Operating voltage: 4.8 V (~5V),
6. Temperature range: 0 ºC – 55 ºC,

2.7 JUMPER WIRES


Jumper wires are simply wires that have connector pins at each end, allowing them
to be used to connect two points to each other without soldering. Jumper wires are typically
used with breadboards and other prototyping tools in order to make it easy to change a
circuit as needed. Jumper wires typically come in three versions: male-to-male, male-to-
female and female-to-female. The difference between each is in the end point of the wire.
Male ends have a pin protruding and can plug into things, while female ends do not and are

ECE Department, NNRG


23
Ultrasonic Detection and Ranging

used to plug things into. Male-to-male jumper wires are the most common and what you
likely will use most often. When connecting two ports on a breadboard, a male-to-male
wire is what you’ll need. Jumper wires male to male, male to female, and female to female.

Figure 2.12: Jumper Wires

ECE Department, NNRG


24
Ultrasonic Detection and Ranging

3. METHODOLOGY

3.1 BLOCK DIAGRAM

The designed ultrasonic radar system, as shown in figure, consists of the following parts:

A. Microcontroller (Arduino), B. Servo motor, C. Interface, D. Sensor for transmitting and


receiving. And for displaying the signal there are two ways: A. Computer screen B. LCD
screen

Figure 3.1. Block diagram of Ultrasonic Radar

ECE Department, NNRG


25
Ultrasonic Detection and Ranging

ATMEGA 328P microcontroller send 10 micro second pulse width to ultrasonic


transmitter, echo back signal receive by TX module of ultrasonic. Here we use servo motor
on which ultrasonic module is mounted for receive 180 degree signal. The basic concept
behind ultrasonic detection and ranging is operation of ultrasonic sensor. In our project we
replaced LCD with a Pc to visualize the ranging more clearly. The transmission and
reception of sound waves is performed by the ultrasonic sensor HC-SR04. A small change
we have made is introduced a servo motor to rotate the ultrasonic sensor in every direction
possible for tracking objects.

3.2 FLOW CHART

The operation of the whole system after connections are made is shown below:

Figure 3.2. Flowchart representation

ECE Department, NNRG


26
Ultrasonic Detection and Ranging

4. IMPLEMENTATION

4.1 ARDUINO IDE


The project is based on microcontroller board designs. The board provides sets of
digital and analog Input/output (I/O) pins that can interface to various expansion boards
(termed shields). The boards feature serial communication interfaces, including Universal
Serial Bus (USB) on UNO model, for loading programs from personal computers. For
programming the microcontrollers, the Arduino project provides an integrated development
environment (IDE) makes it easy to write code and upload it to the board. It runs on
Windows, Mac OS X, and Linux. The environment is written in Java and based on
Processing and other open-source software. This software can be used with any Arduino
board.
The Arduino platform has become quite popular with people just starting out with
electronics, and for good reason. Unlike most previous programmable circuit boards, the
Arduino does not need a separate piece of hardware (called a programmer) in order to load
new code onto the board – you can simply use a USB cable. Additionally, the Arduino IDE
uses a simplified version of C++, making it easier to learn to program. Finally, Arduino
provides a standard form factor that breaks out the functions of the micro-controller into a
more accessible package.

ECE Department, NNRG


27
Ultrasonic Detection and Ranging

Figure 4.1: Basic view of a code written in Arduino IDE

4.1.1 Libraries and Functions used


Servo.h
This library allows an Arduino board to control RC (hobby) servo motors. Servos
have integrated gears and a shaft that can be precisely controlled. Standard servos allow the
shaft to be positioned at various angles, usually between 0 and 180 degrees. Continuous
rotation servos allow the rotation of the shaft to be set to various speeds. The Servo library
supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega. On boards
other than the Mega, use of the library disables analogWrite() (PWM) functionality on pins
9 and 10, whether or not there is a Servo on those pins. On the Mega, up to 12 servos can
be used without interfering with PWM functionality; use of 12 to 23 motors will disable
PWM on pins 11 and 12.

ECE Department, NNRG


28
Ultrasonic Detection and Ranging

Void loop( ) and void setup( )

Setup( ) is a function that only runs up on controller reset loop( ) is where the code
that runs over and over goes (your program). Loop( ) and setup( ) are functions. A function
with void, in front is a void function and so will not return a value. The void after means
that the function will accept no arguments.

digitalWrite( )

If the pin is configured as an INPUT digitalWrite( ) will enable (HIGH) or disable


(LOW) the internal pull-up on the input pin. It is recommended to set the pinmode( ) to
INPUT-PULLUP to enable the internal pull-up resistor.

4.2 PROCESSING3
Processing is an open source computer programming language and integrated
development environment (IDE) built for the electronic arts, new media art, and visual
design communities with the purpose of teaching the fundamentals of computer
programming in a visual context Fig (3).

Figure 4.2: processing 3

ECE Department, NNRG


29
Ultrasonic Detection and Ranging

4.2.1 Specifications
 Free to download and open source.
 Interactive programs with 2D, 3D or PDF output.
 OpenGL integration for accelerated 2D and 3D.
 For GNU/Linux, Mac OS X, and Windows.
 Over 100 libraries extend the core software.
 Well documented, with many books available.

Figure 4.3: Code execution inside a processing3 IDE

4.2.2 Libraries and Functions used

 Serial : The Serial library reads and writes data to and from external devices one
byte at a time. It allows two computers to send and receive data. This library has the
flexibility to communicate with custom microcontroller devices and to use them as
the input or output to Processing programs. The serial port is a nine pin I/O port that
exists on many PCs and can be emulated through USB.

ECE Department, NNRG


30
Ultrasonic Detection and Ranging

 Void draw( ):Void draw( ) is called directly after setup(), the draw() function
continuously executes the lines of code contained inside its block until the program
is stopped or noLoop() is called. draw() is called automatically and should never be
called explicitly. All Processing programs update the screen at the end of draw( ).
 PinMode( ): PinMode( ) configures a pin to act either as input (INPUT), or input
with internal pull-up resistor (INPUT_PULLUP), or input with internal pull-down
resistor (INPUT_PULLDOWN) or output (OUTPUT).Unlike on Arduino, where
pins are implicitly set to inputs by default, it is necessary to call this function for
any pin you want to access, including input pins.
 Fill( ): Fill( ) Sets the color used to fill shapes. For example, if you run fill(204,
102, 0), all subsequent shapes will be filled with orange. This color is either
specified in terms of the RGB or HSB color depending on the current colorMode( ).
The default color space is RGB, with each value in the range from 0 to 255.
 Size( ): Size( ) defines the dimension of the display window width and height in
units of pixels. In a program that has the setup() function, the size() function must
be the first line of code inside setup().
 Stroke( ): Stoke( ) sets the color used to draw lines and borders around shapes. This
color is either specified in terms of the RGB or HSB color depending on the
current colorMode(). The default color space is RGB, with each value in the range
from 0 to 255.
 Rect( ): Rect( ) draws a rectangle to the screen. A rectangle is a four-sided shape
with every angle at ninety degrees. By default, the first two parameters set the
location of the upper-left corner, the third sets the width, and the fourth sets the
height. The way these parameters are interpreted, however, may be changed with
the rectMode() function.

4.3 Hardware design

 Step 1: Connection of HC-SR04 to Arduino board,Connect the trigger pin of


Ultrasonic sensor HC-SR04 to the 8th pin of Arduino board, Echo pin of sensor to

ECE Department, NNRG


31
Ultrasonic Detection and Ranging

the 9th pin of Arduino board ,VCC of the sensor to the 5volts pin of Arduino board
and finally ground pin sensor to any ground pin Arduino board using male to female
jumper wires.
 Step 2: Connection of Servo motor to the Arduino board Servo motor has different
connection parameters compared to the ultrasonic sensor; the red wire of motor is
connected to 3.32v of arduino board, Orange wire is connected to pin 10 of arduino
board, brown wire is connected to ground pin of arduino board.
 Step 3: Writing and executing the code After connecting all components interface
the arduino board to PC using a cable, then open arduino ide, open a new file, write
code for the sensor and motor to work after that save and compile the code, then
after dump the compiled code into board as a result we observe the rotation of the
motor. Then using processing ide the output is observed.

4.4 Software design

 As mentioned in our project we are using two software ide’s one for operation of all
hardware components and other one to display the tracking of objects in other
words output of our project.

4.5 WORKING OF ULTRASONIC RANGE FINDER

The measurement process is initiated by sending a trigger signal to the ultrasonic


module. When the reset pulse is given to the processor, it produces a trigger pulse of 15 µs
and transfers to the HC-SR04 ultrasonic module . The trigger signal must be a pulse with
10µS high time. When the module receives a valid trigger signal it issues 8 pulses of 40
KHz ultrasonic sound from the transmitter. The echo of this sound is picked by the
receiver, after getting the echo of the ultrasonic sound, the module produce a signal at the
echo pin whose high time is proportional to the distance to be measured.

ECE Department, NNRG


32
Ultrasonic Detection and Ranging

Test distance = (high level time × velocity of sound (340M/S)) / 2


Distance in cm = echo pulse width in µs/58
Distance in inch = echo pulse width in µs/148

Finally the distance calculated based upon the pulse width of the echo signal is send
to the display segment and the range is displayed in centimeters with angle in degrees. This
ultrasonic rangefinder can measure distances up to 2.5 meters at accuracy of 0.1 centimeter.

ECE Department, NNRG


33
Ultrasonic Detection and Ranging

5. RESULT

5.1 RESULT ANALYSIS


The result of the ultrasonic radar system is observed on laptop/pc. The graph shows
the two shaded regions i.e., red and green regions. Here, the green part shows that there is
no object and the red part shows that there is an object in that particular region, using this
we can also trace the distance and angle of that object.
After obtaining result of the system we checked the output for several different objects,
varying them in distance and angles, However we set the max distance to 100cm just
because to avoid the clumsiness in detection, Apart from the regular fashion of displaying
the output of radar we choose to display the object detection in Spider’s web format which
gave a better look and understanding.

Figure 5.1: Graphical Representation of an object detection

5.2 CONCLUSION

The object of this project was to design and implement an Ultrasonic Distance
Measurement device. As described in this a system is developed that can calculate the
distance of the tracked object. With respect to the requirements for an ultrasonic
rangefinder the followings can be concluded.

ECE Department, NNRG


34
Ultrasonic Detection and Ranging

 The system can calculate the distance of the obstruction with sufficient accuracy.
 This device has the capability to interact with other peripheral if used as a secondary
device.
 This can also communicate with pc through its serial port.
 This offers a low cost and efficient solution for non-contact type distance
measurements.

5.3 FUTURE SCOPE

The idea of making an Ultrasonic RADAR appeared to us while viewing the


technology used in defense, be it Army, Navy or Air Force and now even used in the
automobiles employing features like automatic/driverless parking systems, accident
prevention during driving etc. The applications of such have 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 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.

ECE Department, NNRG


35
Ultrasonic Detection and Ranging

ECE Department, NNRG


36

Вам также может понравиться