BACHELOR OF TECHNOLOGY
in
ELECTRONICS AND COMMUNICATION ENGINEERING
submitted by
Assistant Professor
CERTIFICATE
This is to certify that the project report entitled “ULTRASONIC
Institute of Science & Technology, Khammam, for his excellent guidance, technical
information and support which helped me in successfully completing this project report.
Technology, Khammam, for his excellent guidance, technical information and support
Swarna Bharathi Institute of Science & Technology, Khammam, for providing necessary
I thank all the members of Teaching and Non-Teaching Staff, Department of ECE,
and all those who have helped me directly or indirectly in completing my project
successfully.
12M61A04A2
DECLARATION
METER” recorded in this report does not form part of any other
DATE:
PLACE: Khammam
Reported by,
12M61A04A2
ABSTRACT
The application area of the Ultrasonic Distance Meter is very wide in rescue
operations, spy robot, versatile use in autonomous technology, use in mining; it
has found essential use in light industry (e.g. Toy industry) agriculture, used in
car parking systems and all other engineering practices.
INDEX
CONTENTS PAGE NO
1. INTRODUCTION 1
2.1 History 4
3. IMPLEMENTATION 6
3.1.4 Buzzer 22
5.1 Advantages 28
5.2 Limitations 28
6. SOURCE CODE 29
7. CONCLUSION 32
8. BIBLIOGRAPHY 33
9. PROJECT OUTLOOK 34
LIST OF FIGURES
3.11 Buzzer 22
1. INTRODUCTION
There are several ways to measure distance without contact. One way is to
use ultrasonic waves at 40 kHz for distance measurement. Ultrasonic transducers
measure the amount of time taken for a pulse of sound to travel to a particular
surface and return as the reflected echo. This circuit calculates the distance based
on the speed of sound at 25°C ambient temperature and shows it on a 7-segment
display. Using it, you can measure distance up to 4 meters.
The speed which sound travels depends on the medium which it passes
through. In general, the speed of sound is proportional (the square root of the
ratio) to the stiffness of the medium and its density. This is a fundamental
property of the medium. Physical properties and the speed of sound change with
the conditions in the environment. The speed of sound in the air depends on the
temperature. In the air speed are approximately 345 m/s, in water 1500 m/s and
in a bar of steel 5000 m/s.
A common use of ultrasound is for range finding. This use is also called
sonar. Sonar works similarly to radar. An ultrasonic pulse is generated in a
particular direction. If there is an object in the way of this pulse, the pulse is
reflected back to the sender as an echo and is detected. Measuring the difference
in time between the pulse transmitted and the echo received, it is possible to
determine how far away the object is. Bats use a variety of ultrasonic ranging
(echolocation) to detect their prey.
CHAPTER-2
2.1 HISTORY:
The development of the first light wave EDM instrument is connected with
the name of the Swedish scientist E.Bergstrand. He designed the First Geodetic
meter (short form of GEOdetic distance METER) for the determination of the
velocity of light in 1943. The commercial instrument Geodimeter NASM-2 became
available in 1950, produced by a large Swedish manufacturer of chemicals, AGA.
With the early Geodimeters, longer distances could only be measured at night. The
latest long-range Geodimeters, models 600 and 8, are at present in wide use in
geodetic surveying throughout the world.
The first EDM instrument using radio waves was developed by T.L. Wadley
at the National Institute of Telecommunications Research of South Africa in 1954.
It became available under the name Tellurometer in 1957. Its range exceeded that
of the Geodimeter and it was therefore in much wider use until lasers were
introduced in EDM late in the 1960's.
Two other groups also need be mentioned. The most precise EDM
instrument to date, the Mekometer, was built by K.D.Froome and R.H.Bradsell in
1961 at the National Physical Laboratory, Teddington (U.K.) and became
commercially available early in 1973. On short distances, accuracies of 0.2 mm
can be achieved.
The first electronic tachometer (sometimes termed "total station"), the Zeiss
(Oberkochen) Reg E1 to 14, became available in 1970 and featured electronic
readout not only of distance but also of the vertical and horizontal circles. The
second total station, the AGA Geodimeter 700 became available in 1971.
Electronic tachometers have a great future in large scale detail surveys, especially
if combined with electronic booking and computerized data processing and
plotting.
The traditional measuring devices are the tapes, scales, chains etc…
CHAPTER-3
ATMEGA8 microcontroller
Ultrasonic sensor (HCSR04)
LCD module (LM016L)
Buzzer
Voltage Regulator (LM7805)
Diodes (1N4007)
Resistors
Transistors
Capacitors
Switch
Microcontroller, as the name suggests, are small controllers. They are like
single chip computers that are often embedded into other systems to function as
processing/controlling unit. For example, the remote control you are using
probably has microcontrollers inside that do decoding and other controlling
functions. They are also used in automobiles, washing machines, microwave
ovens, toys ... etc., where automation is needed.
The Atmel AVR core combines a rich instruction set with 32 general purpose
working registers. All the 32 registers are directly connected to the Arithmetic
Logic Unit (ALU), allowing two independent registers to be accessed in one single
instruction executed in one clock cycle. The resulting architecture is more code
efficient while achieving throughputs up to ten times faster than conventional
CISC microcontrollers.
Key features
One 16-bit Timer/Counter with Separate Pre scalar, Compare Mode, and
Capture Mode
PIN DIAGRAM
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. Note that the
Status Register is updated after all ALU operations,
Status Register
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. The I-bit is
cleared by hardware after an interrupt has occurred, and is set by the RETI
instruction to enable subsequent interrupts. The I-bit can also be set and cleared
by the application with the SEI and CLI instructions, as described in the
Instruction Set Reference.
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.
The Half Carry Flag H indicates a Half Carry in some arithmetic operations.
Half Carry is useful in BCD arithmetic.
Negative Flag
Zero Flag
Carry Flag
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.
3.5 AVR CPU General Purpose Working Registers
Most of the instructions operating on the Register File have direct access
to all registers, and most of them are single cycle instructions as shown in Figure,
each register is also assigned a Data memory address, mapping them directly
into the first 32 locations of the user Data Space. Although not being physically
implemented as SRAM locations, this memory organization provides great
flexibility in access of the registers, as the X-pointer, Y-pointer, and Z-pointer
Registers can be set to index any register in the file
MEMORY
This section describes the different memories in the Atmel AVR ATmega8.
The AVR architecture has two main memory spaces, the Data memory and the
Program Memory space. In addition, the ATmega8 features an EEPROM Memory
for data storage. All three memory spaces are linear and regular.
Most of the instructions operating on the Register File have direct access
to all registers, and most of them are single cycle instructions as shown in Figure,
each register is also assigned a Data memory address, mapping them directly
into the first 32 locations of the user Data Space. Although not being physically
implemented as SRAM locations, this memory organization provides great
flexibility in access of the registers, as the X-pointer, Y-pointer, and Z-pointer
Registers can be set to index any register in the file.
The five different addressing modes for the Data memory cover Direct,
Indirect with Displacement, Indirect, Indirect with Pre-decrement, and Indirect
with Post-increment. In the Register File, registers R26 to R31 feature the
indirect addressing pointer registers.
This sensor uses ultrasonic sound to measure distance just like bats and
dolphins do. Ultrasonic sound has such a high pitch that humans cannot hear it.
This particular sensor sends out an ultrasonic sound that has a frequency of
about 40 kHz.
A transducer that creates an ultrasonic sound and another listens to its echo.
To measure the distance the sound has travelled we use the formula:
The "2" is in the formula because the sound has to travel back and forth. First the
sound travels away from the sensor, and then it bounces off of a surface and
returns back.
The easy way to read the distance as centimeters is use the formula:
For example, if it takes 100us (microseconds) for the ultrasonic sound to bounce
back, then the distance is ((100 / 2) / 29) centimeters or about 1.7 centimeters.
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 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.
These components are “specialized” for being used with the microcontrollers,
which means that they cannot be activated by standard IC circuits. They are used
for writing different messages on a miniature LCD.
LCD screen
LCD screen consists of two lines with 16 characters each. Each character
consists of 5x7 dot matrix. Contrast on display depends on the power supply
voltage and whether messages are displayed in one or two lines. For that reason,
variable voltage 0-Vdd is applied on pin marked as Vee. Trimmer potentiometer is
usually used for that purpose the connections some versions of displays have built
in backlight (blue or green diodes). When used during operating, a resistor for
current limitation should be used (like with any LE diode).
3.1.4 BUZZER
3.11 Buzzer
Electromechanical
Mechanical
Piezoelectric
AVR Studio
Proteus
ProgISP
After simulating your circuit in Proteus software user can directly make PCB
design with it so it could be an all in one package for the clients.
3.2.3 PROGISP Overview:
POWER
SUPPLY
ATMEGA8
SENSOR MICRO LCD
CONTROLLER
BUZZER
5.1 Advantages:
5.2 Limitations:
#include <avr/io.h>
#include <util/delay.h>
#include "lcd.h"
_delay_ms(10);
{
TCCR1B = 0x02;
value = TCNT1 ;
return(value);
int main(void)
int f1;
DDRC=0xff;
InitLCD(0);
_delay_ms(50);
LCDClear();
_delay_ms(50);
LCDWriteStringXY(0,0,"Welcome to UDM");
_delay_ms(50);
LCDWriteStringXY(0,1,"N.RAMYA ");
_delay_ms(5000);
LCDWriteStringXY(0,1,"P.HARSHA ");
_delay_ms(5000);
_delay_ms(5000);
LCDClear();
_delay_ms(50);
while(1)
LCDWriteStringXY(0,0,"Welcome to UDM");
_delay_ms(50);
_delay_ms(100);
f1=f1/60;
LCDWriteStringXY(0,1,"Distance:");
_delay_ms(50);
LCDWriteIntXY(9,1,f1,4);
_delay_ms(50);
LCDWriteStringXY(14,1,"CM");
_delay_ms(50);
if(f1<10)
PORTC=0xff;
else
PORTC=0;
_delay_ms(200);
}
7. CONCLUSION:
www.google.co.in
www.wikipedia.com
www.atmel.com/images/atmel-2486-8-bit-avr-microcontroller-
atmega8_l_datasheet.pdf
www.micropik.com/pdf/HCSR04.pdf
www.seminarsonly.com
9. PROJECT OUTLOCK