sushama repo
TRANSCRIPT
-
8/2/2019 sushama repo
1/29
Department of Electronics &Communication Engineering
UNITED COLLEGE OF ENGINEERING AND
RESEARCH
A Project report on
MICROCONTROLLER BASED ULTRASONIC
DISTANCE METER
PROJECT GUIDE :
MR. VIJIT SRIVASTAVA
SUBMITTED BY:-
MADHU VERMA (0801031042)
PRIYA JHA (0801031062)
SUSHAMA BHARATI (0801031094)
MEENAKSHI SINGH (0801031047)
B. TECH -4th YEAR
EC BRANCH 2008-2012
-
8/2/2019 sushama repo
2/29
Certificate
Certified thatMadhu verma, priya jha , meenakshi singh , sushma bharati carried
out the research work presented in this project report entitled Microcontroller-based
Ultrasonic Distance Meter for the award of B.Tech degree in Electronic and
communication from named Institute of Engineering & Technology, ALLAHABAD under my
supervision. The project embodies result of original work and studies carried out by Student
himself and the contents of the project do not form the basis for the award of any other degree to
the candidate or to anybody else.
GUIDED BY: H.O.D
MR. VIJIT SHRIVASTAVA MR. A. K. MEHROTRA
Senior lecturer in E & C Head of Depts. E & C
-
8/2/2019 sushama repo
3/29
DECLARATION
We hereby declare that this project report is an original work of our own and that to the best of
our knowledge and belief it contains no material previously or written by any another person nor
material which to a substantial extend has been accepted for any other degree or diploma of the
university or other institute of higher learning except where due acknowledgement has been
made in the text.
Signature: Signature:
Name: MADHU VERMA Name: PRIYA JHA
Roll No: 0801031042 Roll No: 0801031062
Date: Date:
Signature: Signature:
Name: MEENAKSHI SINGH Name: SUSHAMA BHARATI
Roll No: 0801031047 Roll No: 0801031094
Date: Date:
-
8/2/2019 sushama repo
4/29
ACKNOWLEDGEMENT
It gives us an immense pleasure to present the report of the B. Tech project undertaken during B.
Tech Final year. We owe special depth of gratitude to Professor A.K.Mehrotra (Head of
Department of Electronics and Communication , United College of
Engineering and Research ,Allahabad) for this constant support and guidance
throughout the course of our work.
We also take the opportunity to acknowledge the contribution of our Project Supervisor
Mr. VIJIT SHRIVASTAVA for his full support and assistance during the development of
the project. His sincerity, thoroughness and perseverance have been a constant source of
inspiration for us.
We also do not like to miss the opportunity to acknowledge the contribution of all faculty
members of the department for their kind assistance and co-operation during the development of
the project.
-
8/2/2019 sushama repo
5/29
TABLE OF CONTENTS
ABSTRACT:CHAPTER1: INTRODUCTION TO MICROCONTROLLER BASED
ULTRASONIN DISTANCE METER
CHAPTER2: BLOCK DIAGRAMCHAPTER3: CIRCUIT DIAGRAMCHAPTER4: PCB LAYOUTCHAPTER5: PCB DESIGNINGCHAPTER6: LIST OF COMPONENTSCHAPTER7: HISTORYPROGRAMMINGRESULTAPPLICATIONS
MERIT AND DEMERIT
CONCLUSIONREFERENCES
-
8/2/2019 sushama repo
6/29
ABSTRACT
The report details the implementation distance measurement system using the ultrasonic wave.
As the human ears audible perception range is 20 Hz to 20 kHz, it is insensitive to ultrasonic
waves and hence the ultrasound wave can be used for applications in industries/vehicles without
hindering human activity. They are widely used as range meters and proximity detectors in
industries also it is used in parking assistance system.
The distance can be measured using pulse echo and phase measurement method. Here the pulse
echo method is used. The measurement unit uses a continuous signal in the transmission
frequency range of ultrasonic transducer. The signal is transmitted by an ultrasonic transducer,
reflected by an obstacle and received by another transducer where the signal is detected.
-
8/2/2019 sushama repo
7/29
CHAPTER1
INTRODUCTION
MICROCONTROLLER BASED ULTRASONIC DISTANCE
METER :
The micro-controller generates pulse bursts of 40 KHz at its pin3.4 which are amplified by
transistor T5. The inverting buffer CD4049 drives the transmitter end of the ultrasonic
transducer. Three inverters (N1, N2 and N3) are connected in parallel to increase the transmitted
power. This inverted output is fed to another set of three inverters (N4, N5 and N6). Outputs of
both sets of parallel inverters are applied as a push-pull drive to the ultrasonic transmitter.
The positive-going pulse is applied to one of the terminals of the ultrasonic sensor and the same
pulse after 180-degree phase shift is applied to the other terminal. Thus the transmitter power
needs to be increased for increasing the range. The echo signal is received by the receiver sensor
after reflection. This is a weak signal and is further amplified by quad op-amp IC LM324. The
first stage (A1) is a buffer with unity gain. The received signal is directly fed to the non-inverting
input (pin 3) of A1 and coupled to the second stage by a 3.3nF (small-value) capacitor. The
second stage of the inverting amplifier uses a 2-mega-ohm resistor for feedback. The third stage
is a precision rectifier amplifier with a gain of 10.
The output (at pin8) from the LM324 IC is filtered by the rectifier diodes to accept 40 KHz
frequencies and this signal is fed to pin12 (P1.0) of the micro-controller AT89C2051. This pin is
-
8/2/2019 sushama repo
8/29
CHAPTER2
BLOCK DIAGRAM OF MICROCONTROLLER BASED
ULTRASONIC DISTANCE METER
Fig.1
-
8/2/2019 sushama repo
9/29
Description of Transmitting unitSwitch
An analog switch CD4066 is used to allow the sine wave from function generator to the
gain amplifier. The excitation to the Transmitter is given from the Function generator through
the switch which can be digitally controlled. As the switch can pass only positive voltages, the
40kHz, 1Vp-p, sine wave from the function generator is given a DC shift of 0.5V.
Microcontroller.
This system of distance measurement does not require large amount of memory, hence a 20
pin 8051 based microcontroller AT89C2051, is chosen as the controller with 12MHz clock. It
performs the operation of giving the switching signal, computing the distance, converting the
hex value to decimal and then to ASCII to be displayed in the LCD.
Gain Amplifier
As the 40 kHz sine wave cannot be passed through the analog switch 4066, a gain amplifier
with level shifter is required. Both are integrated and built using A741 opamp
-
8/2/2019 sushama repo
10/29
Description of Receiver unit
Amplifier
The frequency of the received pulse is of 40 kHz which requires amplifiers working at high
frequency. TL084 is used, as it has good high frequency gain characteristics. The gain of the
amplifier is set to 1000 in two stages with first being 100 and second being 10. The gain is set by
taking into account the least magnitude (50mV) of the receiver output when sensing an object at
distance of 2 metres.
Comparator
The output signal from the amplifier is passed through the comparator which compares
with a reference threshold level to weed out the noises and false triggering. The signal is a series
of square pulses as shown in Fig.1 with amplitude of 15 volts. This is passed through the voltage
limiter (zener regulator) to be fed to the microcontroller for counting the pulses.
-
8/2/2019 sushama repo
11/29
CHAPTER3
CIRCUIT DIAGRAM OF MICROCONTROLLER BASED
ULTRASONIC DISTANCE METER
Fig.2
-
8/2/2019 sushama repo
12/29
CHAPTER4
PCB LAYOUT:-
Connection side of PCB:-
Fig. 3
-
8/2/2019 sushama repo
13/29
Component side of PCB:-
Fig.4
-
8/2/2019 sushama repo
14/29
CHAPTER5
PCB DESIGNING
The semiconductor technology of integrated circuits is the driving force behind elex. Systems
development. However, the printed circuit board is an essential part of an overall system, since
equipment is built up by connecting active devices together into maneuverable cost effective
locks.
The PCB is an interconnection system, which is multi-level, highly-conductive and has a low
medium dielectric constant. These attributes have made the PCB the standard, almost universal,
method of reconstruction for practically all-electronic systems.
The printed ckt. Provides mechanical support as well as functional electrical interconnection forthe components and safe thermal management.
Initially, the PCB was developed to produce an interconnection technology which facilitated
mass production & mass assembly, and gave economics of weight, and space close control over
ckt electrical parameters is easily achieved by the repeatability of the dielectric constant and
dielectric thickness & consistency of line width. The current carrying capacity is that of copper.
Thus, PCB can be defined as the board including printed components as well as the printed
wiring pattern.
Printed circuits greatly simplify mass production & increased equipment reliability. There most
important contribution is the tremendous education achieved in the size and weight of electronic
devices. Printed circuits are used in practically all types of electronic equipment, radio,
television, all telephone system units, electrical wiring behind automobile dashboards, guided
missile, airborne electronic equipments, computers and industrial control equipments.
-
8/2/2019 sushama repo
15/29
LAYOUT AND FABRICATION TECHNIQUES:
The ckt diagram of computerized electrical equipment control is based on fabricated by our
project group is taken from EFY magazine. Although we had surveyed for the various ckts ofanalog capacitance meter and studied about their advantages and disadvantages but we find
the ckt taken from EFY to be the best one and so we decide to fabricate the same,. We alsomade many researches on the Internet to find out the related topics to find out much
knowledge about the topic.
1. Lay out: -The detailed ckt diagram is very important for the layout designer but we also are familiar
with design concepts and the philosophy behind the equipment. Only with this mind, we will
be able to bring out results, which do not call for modification again & again.
Keeping these considerations in mind, we design the PCB layout of ckt. Diagram. We have
also tried for no jumpers and that the copper tracks should be as thin as possible and shorter
routes of Cu tracks should be adopted. The spacing of the Cu tracks should be such that they
do not get short and are suitable for handwork, as we are not adopting the screening
technique.
2. Art work: -
After designing the layout in proper dimensions, we trace in another place. Then we painted
the tracks with paint. Then we keep it to 3 hours so that the paint gets dry.
3.Etching: -
-
8/2/2019 sushama repo
16/29
CHAPTER6
COMPONENT USED1. INTIGRATED CIRCUIT(IC) IC1 - AT89C2051 microcontroller IC2 - ULN2003 current buffer IC3 - CD4049 hex inverting buffer IC4 - LM324 quad operational amplifier IC5 - 7815, 15V regulator IC6 - 7915, -15V regulator IC7 - 7805, 5V regulator2. TRANSISTORS T1-T4 - BC557 pnp transistor T5 - 2N2222 npn transistor3. DIODES D1, D2 - 1N4148 switching diode D3-D6 - 1N4007 rectifier diode4. DIS1-DIS4 - LTS 542 COMMON-ANODE,5. 7-SEGMENT DISPLAY6. Resistors (all -watt, 5% carbon): R1, R2 - 2-mega-ohm R3 - 82-kilo-ohm R4, R7-R10 - 10-kilo-ohm R5 - 33-kilo-ohm R6 - 100-kilo-ohm R11 - 1-kilo-ohm R12-R15 - 1.2-kilo-ohm R16 - 220-ohm RNW1 - 10-kilo-ohm resistor network VR1 - 1-kilo-ohm preset
-
8/2/2019 sushama repo
17/29
1. Capacitors: C1, C2 - 3.3nF ceramic disk C7, C10-C12 - 0.1F ceramic disk
C3 - 2.2nF ceramic disk C4 - 10F, 16V electrolytic C5, C6 - 22pF ceramic disk C8, C9 - 1000F, 50V electrolytic2. Miscellaneous: X1 - 230V AC primary to 15V-0-15V, 500mA secondary transformer XTAL - 12MHz crystal S1 - Push-to-on switch S2 - On/off switch TX1 - 40kHz ultrasonic transmitter RX1 - 40kHz ultrasonic receiver
-
8/2/2019 sushama repo
18/29
DESCRIPTION
AT89C2051 microcontroller8-bit Microcontroller with 2K Bytes Flash AT89C2051
1. Description -The AT89C2051 is a low-voltage, high-performance CMOS 8-bit
microcomputer with 2K bytes of Flash programmable and erasable read-only memory
(PEROM). The device is manufactured using Atmels high-density nonvolatile memory
technology and is compatible with the industry-standard MCS-51 instruction set. By
combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C2051 is
a power-full microcomputer which provides a highly-flexible and cost-effective solution to
many embedded control applications. The AT89C2051 provides the following standard
features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a
five vector two-level interrupt architecture, a full duplex serial port, a precision analog
comparator, on-chip oscillator and clock circuitry. In addition, the AT89C2051 is designed
with static logic for opera-tion down to zero frequency and supports two software
selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM,
timer/counters, serial port and interrupt system to continue functioning. The power-down
mode saves the RAM contents but freezes the oscillator disabling all other chip functions
until the next hardware reset.
-
8/2/2019 sushama repo
19/29
2. Features:
Compatible with MCS-51Products
2K Bytes of Reprogrammable Flash Memory
Endurance: 10,000 Write/Erase Cycles
2.7V to 6V Operating Range
Fully Static Operation: 0 Hz to 24 MHz
Two-level Program Memory Lock
128 x 8-bit Internal RAM
15 Programmable I/O Lines
Two 16-bit Timer/Counters
Six Interrupt Sources
Programmable Serial UART Channel
Direct LED Drive Outputs
On-chip Analog Comparator
Low-power Idle and Power-down Modes
Green (Pb/Halide-free) Packaging Option
3. Pin Configuration
-
8/2/2019 sushama repo
20/29
4. Pin Description4.1 VCC Supply voltage.
4.2 GND Ground.
4.3 Port 1 The Port 1 is an 8-bit bi-directional I/O port. Port pins P1.2 to P1.7
provide internal pull-ups. P1.0 and P1.1 require external pull-ups. P1.0
and P1.1 also serve as the positive input (AIN0) and the negative input(AIN1), respectively, of the on-chip precision analog comparator. The
Port 1 out-put buffers can sink 20 mA and can drive LED displaysdirectly. When 1s are written to Port 1 pins, they can be used as
inputs. When pins P1.2 to P1.7 are used as inputs and are externally
pulled low, they will source current (IIL) because of the internal pull-ups. Port 1 also receives code data during Flash programming and
verification.
4.4 Port 3 Port 3 pins P3.0 to P3.5, P3.7 are seven bi-directional I/O pins withinternal pull-ups. P3.6 is hard-wired as an input to the output of the
on-chip comparator and is not accessible as a gen-eral-purpose I/O
pin. The Port 3 output buffers can sink 20 mA. When 1s are written toPort 3 pins they are pulled high by the internal pull-ups and can be
used as inputs. As inputs, Port 3 pins that are externally being pulled
low will source current (IIL) because of the pull-ups. Port 3 alsoserves the functions of various special features of the AT89C2051 as
listed below:
Port 3 also receives some control signals for Flash programming and
verification.
4.5 RST Reset input. All I/O pins are reset to 1s as soon as RST goes high.Holding the RST pin high for two machine cycles while the oscillator
is running resets the device. Each machine cycle takes 12 oscillator or
clock cycles.
4.6 XTAL1 Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.4.7 XTAL2 Output from the inverting oscillator amplifier.
-
8/2/2019 sushama repo
21/29
IC2 - ULN2003 current buffer
1. DESCRIPTIONThe ULN2003A 5V TTL, CMOS is high voltage, high current darlington arrays each
containing seven open collector darlington pairs with common emitters. Each channel ratedat 500mAand can withstand peak currents of 600mA.Suppressiondiodesare included for
inductive load driving and the inputs are pinned opposite the outputs to simplify board
layout.
These versatile devices are useful for driving a wide range of loads including solenoids,
relays DC motors, LED displays filament lamps, thermal print heads and high power
buffers.
The ULN2001A/2002A/2003Aand 2004A are supplied in 16 pin plastic DIP packages with
a copper lead frame to reduce thermal resistance. They are available also in small outline
package (SO-16) as ULN2001D/2002D/2003D/2004D.
2. Features: Seven darlingtons per package output current 500ma per driver(600ma peak) Output voltage 50v integrated suppression diodes for Inductive loads outputs can be paralleled for higher current. TTL/CMOS/PMOS/DTL compatible inputs. Input pinned opposite outputs to simplify layout.
-
8/2/2019 sushama repo
22/29
Power Supply:-
Fig.5
The 230V AC mains is stepped down by transformer X1 to deliver the secondary output of 15V-
0-15V, 500 mA. The transformer output is rectified by a full-wave bridge rectifier comprising
diodes D3 through D6, filtered by capacitors C8 and C9 and then regulated by ICs 7815 (IC5),7915 (IC6) and 7805 (IC7). Regulators 7815, 7915 and 7805 provide +15V, -15V and +5V
regulated supply, respectively. Capacitors C10 through C12 bypass the ripples present in the
regulated power supply.
-
8/2/2019 sushama repo
23/29
CHAPTER7
WORKING-:
This diagram shows the circuit of the microcontroller-based distance meter. The 40 kHz pulse
bursts from the microcontroller are amplified by transistor T5. Inverting buffer CD4049 drives
the ultrasonic sensor used as the transmitter. Three inverters (N1, N2cand N3) are connected in
parallel to increase the transmitted power.
This inverted output is fed to another set of three inverters (N4, N5 and N6). Outputs of both sets
of parallel inverters are applied as a push-pull drive to the ultrasonic transmitter. The positive
going pulse is applied to one of the terminals of the ultrasonic sensor and the same pulse after
180-degree phase shift is applied to another terminal. Thus the transmitter power is increased for
increasing the range. If you want to increase the range up to 5metres, use a ferrite-core step-up
pulse transformer, which steps-up the transmitter output to 60V (peak-to- peak). The echo signal
received by the receiver sensor after reflection is very weak. It is amplified by quad operational
amplifier LM324. The first stage (A1) is a buffer with unity gain. The received signal is directly
fed to the non-inverting input (pin 3) of A1 and coupled to the second stage by a 3.3nF (small-
value) capacitor. If you use the ubiquitous 0.01F capacitor for coupling, there will be enormous
hum at the output. The second stage of the inverting amplifier uses a 2-mega-ohm resistor for
feedback. The third stage is a precision rectifier amplifier with a gain of 10. The rectifier
functions, unlike a simple diode, even for signal voltage of less than 0.6V. The output is filtered
to accept 40 kHz frequencies and fed to pin 12 of microcontroller AT89C2051, which is an
-
8/2/2019 sushama repo
24/29
analogue comparator. Pin 13 is the other pin of the comparator used for level adjustment using
preset VR1. The ultrasonic transducer outputs a beam of sound waves, which has more energy
on the main lobe and less energy (60 dB below the main lobe) on the side lobes as shown in Fig.
4. Even this low side-lobe signal is directly picked up by the receiver unit. So you have to space
the transmitter and receiver units about 5 cm apart. The two units are fixed by cello tape onto a
cardboard, with the analogue circuit at one end.
Microcontroller AT89C2051 is at the heart of the circuit. Port-1 pins P1.7 through P1.2, and
port-3 pin P3.7 are connected to input pins 1 through 7 of IC2 (IC ULN2003), respectively.
These pins are pulled up with a 10-kilo-ohm resistor network RNW1. They drive all the
segments of the 7-segment display with the help of inverting buffer IC2.
RESULT
-
8/2/2019 sushama repo
25/29
\
APPLICATION-:
Simply by changing this program, the same unit can be made to detect moving
objects (such as cars racing on thestreet) and find their range and speed.
It can also be used with suitable additionalsoftware as a burglar alarm unitfor homes or offices.
-
8/2/2019 sushama repo
26/29
MERITS AND DEMERITS
The capacitive and piezo-ceramic type ultrasonic transmitter-receiver pair are more popular
because of their small size, low cost, low power consumption during sonic burst as well a
quiescent condition. These are widely used in robotics for collision avoidance and map building
purposes [1]compared to laser and camera because of their low bandwidth, less data processing
requirement and light independent characteristics. On the other hand, there are some demerits of
these type of sensors are their less range compared to Laser and vision sensors. Polaroid
ultrasonic sensor provides more range but needs more power and bigger space to accommodate.
Temperature and humidity dependence of ultrasound velocity affects the distance measurement
in this method. Also, wide beam width and low band width of the ultrasonic sensor reduce the
resolution making close objects indistinguishable.
-
8/2/2019 sushama repo
27/29
Future Work The range can be considerably increased by using high power drive circuit.
Using temperature compensation, it can be used over wide temperature range.
The resolution of the measurement can be improved by incorporating phase shift method along
withtime of flight method.
Can be used as parking assistance system in vehicles with high power ultrasonic transmitter.
The 40 kHz signal can be generated using microcontroller itself which will reduce hardware.
-
8/2/2019 sushama repo
28/29
ConclusionThe microcontroller with LCD makes it user friendly and can be embedded in a single unit.
The circuit has been implemented on bread board and tested for its functionality by varying the
distance between the transducer and the target. The target surface needs to be perpendicular to
the impinging ultrasound waves. The power level of the signal is too low for long range
measurement.
-
8/2/2019 sushama repo
29/29
REFERENCE