B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

63
ULTRASONIC DISTANCE MEASURE ROBOT [ULTRA-4] PROJECT REPORT 2012-2013 Submitted in partial fulfillment of the requirement for the award of degree of Bachelor of Technology in Electronics and Communication Engineering Submitted by: Nishant Singh Shivasheesh Tripathi Shivanand Maurya Sushant Shankar Under the guidance of: Er. Umesh Singh Er. Sweta Srivastava Head of Department Lecturer Electronics and Comm. Engg. Electronics and Comm. Engg. Department of Electronics and Communication Institute of Engineering and Technology Dr.Ram Manohar Lohiya Avadh University, Faizabad

description

ULTRA-4 or ultrasonic distance measure robot is a robot which perform many action such as it gives the actual position of wall or obstacle which comes in front of it, measures the distance which displayed by 7-segment and also show the moving images of the objects by camera. The application area of ultra-4 is very wide such as rescue oprations, spy robot, versatile use in autonomus technology,use in mining,it has found essential use in light industry (e.g. toy industry) agriculture and power engineering and used in car parking system.

Transcript of B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

Page 1: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

ULTRASONIC DISTANCE MEASURE ROBOT [ULTRA-4]

PROJECT REPORT

2012-2013

Submitted in partial fulfillment of the requirement for the award of degree of Bachelor of Technology in

Electronics and Communication Engineering

Submitted by:

Nishant Singh Shivasheesh Tripathi Shivanand Maurya Sushant Shankar

Under the guidance of:

Er. Umesh Singh Er. Sweta Srivastava Head of Department Lecturer Electronics and Comm. Engg. Electronics and Comm. Engg.

Department of Electronics and Communication

Institute of Engineering and Technology Dr.Ram Manohar Lohiya Avadh University, Faizabad

Page 2: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

Declaration

We hereby declare that work entitled “Project report on ultrasonic distance measure

robot [ULTRA-4]”, is an authentic record of our own work carried out at Institute of

Engineering and Technology, Dr. Ram Manohar Lohiya Avadh University Faizabad, for

the award of degree of B.Tech. E.C.E. . Project comprises of our original work pursued

under the guidance of Er. Sweta Srivastava.

The results embodied in this report have not been submitted to any other

Institute or University for any award. The information provided is correct to the best

of our knowledge and belief.

Nishant Singh 9228 -------------------

Shivanand Maurya 9247 -------------------

Shivasheesh Tripathi 9248 -------------------

Sushant Shankar 9255 -------------------

Page 3: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

CERTIFICATE

This is to certify that Mr.Nishant Singh, Mr.Shivanand Maurya,

Mr.Shivasheesh Tripathi, Mr.Sushant Shankar have successfully completed their

project entitled “Ultrasonic distance measure robot [ULTRA-4]” which is a bonafide

work carried out by themselves in partial fulfillment of Bachelor of Technology,

Degree in Electronics and Communication Engineering from Institute of Engineering

and technology,faizabad.

The work was carried out under our supervision during the academic

session 2012-2013.

Signature of the Guides:

Er.Umesh Singh

Head of Department

Electronics and comm. Engg. Er.Sweta Srivastava (Lecturer)

External Examiner

Page 4: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

Acknowledgement

“It is not possible to prepare a project report without the assistance &

encouragement of other people. This one is certainly no exception.”

On the very outset of this report, we would like to extend our sincere & heartfelt

obligation towards all the personages who have helped us in this endeavor. Without

their active guidance, help, cooperation & encouragement, we could not have made

headway in the project.

First and foremost, we would like to express our sincere gratitude to our guide, Er.

Sweta Shrivastava we were privileged to experience a sustained enthusiastic and

involved interest from her side. This fuelled our enthusiasm even further and

encouraged us to boldly step into what was a totally dark and unexplored expanse

before us. She always fuelled our thoughts to think broad and out of the box. We

would also like to thank HOD (ECE), Er.Umesh Singh who, instead of his busy

schedule, always guided us in right direction. I would like to thank the entire staff

member for motivation guidance and support.

We are indebted to a number of friends and well-wishers who

have extended their co-operation and help in the preparation of the project. Last but

not the least, it goes without saying that we are deeply indebted to our parents for

their support and their patient guidance.

Thanking You

Nishant Singh

Shivanand Maurya

Shivasheesh Tripathi

Sushant Shankar

Page 5: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

Abstract

Ultrasonic sensors are ideally suited to accurate, automatic distance measurement in normal and difficult environments. Ultrasonic sensors are particularly suitable for environments where optical sensors are unusable such as smoke, dust and similar. Ultrasonic sensors are very accurate, stable and can be used over large ranges. Ultrasonic sensors can measure the following parameters without contacting the medium to be measured

•Distance •Level •Diameter •Presence •Position

Ultrasonic sensors make accurate measurements in many difficult environments and unusual materials. Measurements are unaffected by:

•Material •Surface •Light •Dust •Mist and Vapor

ULTRA-4 or ultrasonic distance measure robot is a robot which perform many action such as it gives the actual position of wall or obstacle which comes in front of it, measures the distance which displayed by 7-segment and also show the moving images of the objects by camera.

The application area of ultra-4 is very wide such as rescue oprations, spy robot,

versatile use in autonomus technology,use in mining,it has found essential use in light

industry (e.g. toy industry) agriculture and power engineering and used in car parking

system.

Page 6: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

Table of Contents

CHAPTER

1. Introduction to ULTRA-4

2. Components & Working of ULTRA 4

3. Hardware Description

4. Software Description

--Program

5. Application

6. Appendix

Page 7: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

IMAGES OF ULTRA-4

FRONT VIEW

BACK VIEW

Page 8: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

SIDE VIEW

TOP VIEW

Page 9: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

Introduction to ULTRA-4

ULTRA-4 or ultrasonic distance measure robot is a robot which perform many action such

as it gives the actual position of wall or obstacle which comes in front of it, measures the

distance which displayed by 7-segment and also show the moving images of the objects

by camera.

There are several ways to measure distance without making contact. One way is to use

ultrasonic waves (40 kHz) for distance measurement. Ultrasonic transducer measures the

amount of time taken by a pulse of sound to travel a particular surface and return back

as the reflected echo’s. This circuit calculates the distance measured by the speed of

sound at 25°C ambient temperature and demonstrates it on a 7-segment display. By

using it, we can measure distance up to 2.5 meters.

In recent times ultrasonic has been applied with considerable success in various

fields of Engineering and bio-medical. It has found essential use in light industry (e.g. toy

industry) agriculture and power engineering. In fact, it is difficult to find a field of

industrial endeavor for which ultrasonic energy has not been tried of suggested, if not

put in actual use.

Ultrasonic is the generation and detection ultrasonic vibrations. In materials having

plastic properties, the ultrasonic waves are of precisely the same matter as sound waves

and their propagation and absorption in various media are governed by the laws which

apply to sound transmission. An ultrasonic vibration has easily propagation in most of

the liquids and metals. Together with many other materials like glass, ceramics, plastic,

concrete etc. whether are highly attenuated in air land gases.

Page 10: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

WORKING OF ULTRA -4

Ultrasonic generators use piezoelectric materials such as zinc or lead zirconium

tartrates or quartz crystal. The material thickness decides the resonant frequency when

mounted and excited by electrodes attached on either side of it. The medical scanners

used for abdomen or heart ultrasound are designed at 2.5 MHz. In this circuit, a 40kHz

transducer is used for measurement in the air medium. The velocity of sound in the air is

around 330 m/s at 0°C and varies with temperature.

In this project, we excite the ultrasonic transmitter unit with a 40kHz pulse burst

and expect an echo from the object whose distance we want to measure transmitted

burst, which lasts for a period of approximately 0.5 ms. It travels to the object in the air

and the echo signal is picked up by another ultrasonic transducer unit (receiver), also a

40 kHz pre-tuned unit. The received signal, which is very weak, is amplified several times

in the receiver circuit and appears somewhat as shown figure when seen on a CRO.

The ultrasonic pulse, echo signal and time measurement

Weak echoes also occur due to the signals being directly received through the side lobes.

These are ignored as the real echo received alone would give the correct distance. That is

why we should have a level control. Of course, the signal gets weaker if the target is

Page 11: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

farther than 2.5 meters and will need a higher pulse excitation voltage or a better

transducer.

Here the microcontroller is used to generate 40 kHz sound pulses. It reads when the

echo arrives; it finds the time taken in microseconds for to-and-fro travel of sound

waves. Using velocity of 333 m/s, it does the calculations and shows on the four 7-

segment displays the distance in centimeters and millimeters (three digits for

centimeters and one for millimeters).

Ultrasonic sensors can measure the following parameters without contacting the medium to be measured

•Distance •Level •Diameter •Presence •Position

Ultrasonic sensors make accurate measurements in many difficult environments and unusual materials. Measurements are unaffected by:

•Material •Surface •Light •Dust •Mist and Vapor

Page 12: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

1. COMPONENTS USE IN ULTRASONIC DISTANCE METER CIRCUIT

1. IC1 - AT89C2051 microcontroller 2. IC2 - ULN2003 current buffer 3. IC3 - CD4049 hex inverting buffer 4. IC4 - LM324 quad operational amplifier 5. IC5 - 7815, 15V regulator 6. IC6 - 7915, -15V regulator 7. IC7 - 7805, 5V regulator 8. T1-T4 - BC557 pnp transistor 9. T5 - 2N2222 npn transistor 10. D1, D2 - 1N4148 switching diode 11. D3-D6 - 1N4007 rectifier diode 12. DIS1-DIS4 - LTS 542 common-anode, 13. 7-segment display

Resistors (all ¼-watt, ±5% carbon):

14. R1, R2 - 2-mega-ohm 15. R3 – 82 - kilo-ohm 16. R4, R7-R10 - 10-kilo-ohm 17. R5 - 33-kilo-ohm 18. R6 - 100-kilo-ohm 19. R11 - 1-kilo-ohm 20. R12-R15 - 1.2-kilo-ohm 21. R16 - 220-ohm 22. RNW1 - 10-kilo-ohm resistor network 23. VR1 - 1-kilo-ohm preset

Capacitors:

24. C1, C2 - 3.3nF ceramic disk 25. C7, C10-C12 - 0.1μF ceramic disk 26. C3 - 2.2nF ceramic disk 27. C4 - 10μF, 16V electrolytic 28. C5, C6 - 22pF ceramic disk 29. C8, C9 - 1000μF, 50V electrolytic

Page 13: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

Miscellaneous:

30. X1 - 230V AC primary to 31. 15V-0-15V, 500mA secondary transformer 32. XTAL - 12MHz crystal 33. S1 - Push-to-on switch 34. S2 - On/off switch 35. TX1 - 40kHz ultrasonic transmitter 36. RX1 - 40kHz ultrasonic receiver

2. COMPONENTS USE IN RF ROBOT 1. IC 1 - L293D Motor Driver IC

2. IC 2 - RX28

3. IC 3 - AT 89S8253 Microcontroller

4. IC 4 - 7805, 5V regulator

5. XTAL - 10MHz crystal oscillator

6. T1-T4 - SS8050 transistor 7. C1 - 470 μF Capacitors 8. C2 - 4.7 μF Capacitors 9. S1 - Push-to-on switch 10. R1 - 5.6 ohm register 11. R2 - 10k ohm register 12. D2 - 1N4148 switching diode 13. RNW1 - 10-kilo-ohm resistor network 14. Motor - 300 RPM 15. Caster wheel 16. Wheel - 12cm dia

3. COMPONENTS USE IN CAMERA PART 1. Camera module 2. LDR 3. USB power supply

Page 14: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

CIRCUIT DISCRIPTION OF DISTANCE METER MODULE

Page 15: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

The 40kHz pulse bursts from the microcontroller are amplified by transistor T5.

Inverting buffer CD4049 drives the ultrasonic sensor used as the transmitter. Three

inverters (N1, N2 and N3) are connected in parallel to increase the transmitted power.

This inverted outputs 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 we want to increase

the range up to 5 meters, 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.01μF 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 40kHz

frequencies and fed to pin 12 of microcontroller AT89C2051, which is an 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 . 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 cellotape

onto a cardboard, with the analogue circuit at one end.

Page 16: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

Two dimensional beam pattern of ultrasonic signal showing main lobe and side

lobe energy levels

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.

Port-3 pins P3.0 through P3.3 of the microcontroller are connected to the base of

transistors T1 through T4 to provide the supply to displays DIS1 through DIS4,

respectively. Pin P3.0 of microcontroller IC1 goes low to drive transistor T1 into

saturation, which provides supply to the common- anode pin (either pin 3 or 8) of display

DIS1. Similarly, transistors T2 through T4 provide anode currents to the other three 7-

segment displays.

Microcontroller IC1 provides the segment data and display-enable signal simultaneously

in time-division multiplexed mode for displaying a particular number on the 7-segment

display unit. Segment data and display-enable pulse for the display are refreshed every 5

ms. Thus the display appears to be continuous, even though the individual LEDs used in it

light up one by one.

Using switch S1 we can manually reset the microcontroller, while the power

on reset signal for the microcontroller is derived from the combination of capacitor C4

Page 17: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

and Resistor R8. A 12MHz crystal is used to generate the basic clock frequency for the

microcontroller.

Resistor R16 connected to pin 5 of DIS2 enables the decimal point. The comparator is

inbuilt in microcontroller AT89C2051. The echo signal will make port-3 pin 3.6 low when

it goes above the level of voltage set on pin 13. This status is sensed by the

microcontroller as programmed. When port-3 pin P3.6 goes high, we know that the echo

signal has arrived; the timer is read and the 16-bit number is divided by twice the

velocity of sound and then converted into decimal format as a 4-digit number.

Page 18: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

RF CIRCUIT MODULE

A circuit that operates on the phenomena of radio frequency ranging between 30KHz-

300GHz.This circuit utilizes the RF module (Tx/Rx) for making a wireless remote, which

could be used to drive an output from a distant place. RF module, as the name suggests,

uses radio frequency to send signals. These signals are transmitted at a particular

frequency and a baud rate. A receiver can receive these signals only if it is configured for

that frequency. Here we are using Tx/Rx operating at 49KHz.

A four channel encoder/decoder pair has also been used in this system. This radio

frequency (RF) transmission system employs Amplitude Shift Keying (ASK) with

transmitter/receiver (Tx/Rx) pair operating at 49KHz. The transmitter module takes serial

input and transmits these signals through RF. The transmitted signals are received by the

receiver module placed away from the source of transmission.

The system allows one way communication between two nodes, namely, transmission

and reception. The RF module has been used in conjunction with a set of four channel

encoder/decoder ICs. Here HT12E & HT12D have been used as encoder and decoder

respectively. The encoder converts the parallel inputs (from the remote switches) into

serial set of signals. These signals are serially transferred through RF to the reception

point. The decoder is used after the RF receiver to decode the serial format and retrieve

the original signals as outputs.

Page 19: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

Encoder IC (HT12E) receives parallel data in the form of address bits and control bits. The control

signals from remote switches along with 8 address bits constitute a set of 12 parallel signals. The

encoder HT12E encodes these parallel signals into serial bits. Transmission is enabled by providing

ground to pin14 which is active low. The control signals are given at pins 10-13 of HT12E. The serial

data is fed to the RF transmitter through pin17 of HT12E.

Page 20: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

Transmitter, upon receiving serial data from encoder IC (HT12E), transmits it wirelessly

to the RF receiver. The receiver, upon receiving these signals, sends them to the decoder

IC (HT12D) through pin2. The serial data is received at the data pin (DIN, pin14) of

HT12D. The decoder then retrieves the original parallel format from the received serial

data.

To summarize, on each transmission, 12 bits of data is transmitted consisting of 8

address bits and 4 data bits. The signal is received at receiver’s end which is then fed into

decoder IC. If address bits get matched, decoder converts it into parallel data and the

corresponding data bits get lowered which could be then used to drive the Motors. The

outputs from this system can either be used in negative logic or NOT gates (like 74LS04)

can be incorporated at data pins.

Page 21: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

CIRCUIT DIAGRAM

Page 22: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

Power supply

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.

Power supply circuit for distance meter

Page 23: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

CONSTRUCTION AND TESTING

Component layout for the PCB

Assemble the PCB and put the programmed microcontroller into the socket. After

switching on the power supply and microcontroller automatically getting reset upon

power-’on, pin 8 will pulse at 40kHz bursts. This can be seen using an oscilloscope. Give

this signal to channel 1 of the oscilloscope. Adjust the time base to 2 ms per division and

set it to trigger mode instead of normal mode. Adjust the pot meter on the oscilloscope

labeled ‘level’ such that the trace starts with the burst and appears steady as shown.

Connect the transmitter and receiver ultrasonic units either by a twisted pair of wire or

by a shielded cable to the board. Give the received signal to channel 2 of the

oscilloscope. Then, place an A4-size plastic sheet in front of the ultrasonic transducers

and observe the echo signal. It will appear as. The two transducers can be fixed to a thick

cardboard with two wires leading to the circuit—two 40cm long shielded cables will do.

Page 24: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

The laser pointer is fixed such that it is axial to the transducers. Channel 2 is connected

to pin 12, which is the positive non-inverting terminal of AT89C2051’s comparator. The

negative inverting terminal (pin 13) is connected to a preset reference. Adjust the preset

such that the voltage is 0.1V-0.2V at pin 13. This will enable detection of weak echoes

also. When the echo signal goes above the level of reference voltage set on pin 13, it will

make P3.6 low; the arrival of echo is sensed by the program using jnb p3.6 (jump not bit)

instruction.

Page 25: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

PRINTED CIRCUIT BOARD

Actual-size, single-side PCB for the microcontroller-based ultrasonic distance meter

Page 26: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

SOFTWARE

The software is written in Assembly language and assembled using 8051 Top View

Simulator. It is well commented and easy to understand. The pulse train for 0.5 ms is

started by making pin 8 high and low alternately for 12.5 microseconds so that the pulse

frequency is 40 kHz. After 25 such pulses have passed, a waiting time is given to avoid

direct echoes for about 20 μs. Then the signal is awaited, while the timer runs counting

time in microseconds.

When the echo arrives, port-3 pin P3.6 goes high, the timer reads and the 16-bit number

is divided by twice the velocity and converted into decimal format as a 4-digit number. If

the echo does not arrive even after 48 milliseconds, the waiting loop is broken and the

pulse train sequence is started once again. If the echo comes within this time, it is

displayed for half a second before proceeding to another measurement. Thus, the

display appears Continuous and flicker-free.

Topview Simulator gives an excellent simulation environment for the industry's most

popular 8 bit Microcontroller family, MCS 51. It gives required facilities to enable the

system designers to start projects right from the scratch and finish them with ease and

confidence.

It is the total simulation solution giving many state of art features meeting the needs of the

designers possessing different levels of expertise. If you are a beginner, then you can learn

Page 27: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

about 8051 based embedded solutions without any hardware. If you are an experienced

designer, you may find most of the required facilities built in the simulator that enabling you to

complete your next project without waiting for the target hardware.

Top view simulator

Page 28: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

PROGRAM

File name---Ultra_4.asm

Program listing:

$mod51

ORG 0H

AJMP 30H

ORG 0BH ; TIMER 0 INTERRUPT VECTOR

; AJMP TIMER0 IS R; Timer 0 Interrupt

Service routine address

ORG 30H

MOV SP,#60H ; \set stack pointer

MOV P3,#0FFH ; \set all port 3 bits high to enable inputs also

MOV P1,#03 ; \set port 1 to all zeros expect bits 0,1

MOV TMOD,#01100001B ; \TIMER 1 - MODE 2 COUNTER,TIMR-0 TO MODE 1

BEG:

MOV TH0,#0H ; \TIMER REG.0 IS SET TO 0, GIVES 64ms

MOV TL0,#0H ; \ timer low reg. is also so ;TOTAL CYCLE TIME IS 64.6ms

,350m/s gives 0.35mx65=22.5m

; up and down 10 meters say! .35 m/ms,

.35 mm/us, 1mm per 3 micros

; up and down .35/2 mm/us = 1/6 mm/us

VELOCITY OF SOUND IN AIR IS 350 M/S; AFTER 100 TIMES, WE HAVE TO STOP

TRANSMITTING FOR A TIME OF ABOUT .1 S ; SO WE STOP FOR THIS AMOUNT OF TIME

and expect an echo.

mov r2,#25 ; \25 pulses 26 us =.53 ms (343m/s*.5ms=17cm) pulse:

setb p3.4 ; \generates 40KHz

mov r1,#5

djnz r1,$

Page 29: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

clr p3.4

mov r1,#5

djnz r1,$ ; \wait for 13 us

djnz r2, pulse ; \20pulses

setb tr0 ; \start timer

mov r2,#10

djnz r2,$ ; \wait 20 us

check_echo:

jnb p3.6,checktimeout

MOV 40h,TL0 ; \ read timer count

MOV 41h,TH0;

mov r0,40h;

mov r1,41h;

mov r3,#0;

mov r2,#6 ;

call UDIV16 ; \divide by 6

mov 40h,r0;

mov 41h,r1;

mov 50h,#25;

disp: call disp1 ; \ show the value on LED

djnz 50h,disp ; \so many times for visible time limit

jmp beg;

checktimeout: mov a,th0;

cjne a,#0c0h,check_echo ; \upto 4 metres

jmp beg;

subroutine UDIV16; \16 bit/16bit unsigned divide

input r1,r0 =dividend X;

input r3,r2 =divisor Y;

output r1,r0 =quottient q of x/y;

output r3,r2 = remainder;

alters acc,r4-47,flags,dptr;

UDIV16: mov r7,#0 ; \clear partial remainder

mov r6,#0 ;

mov B,#16 ; \set loop count

div_loop: clr C ; \clear carry flag

mov a,r0 ; \shift the highest bit of dividend into

Page 30: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

rlc a;

mov r0,a;

mov a,r1;

rlc a;

mov r1,a;

mov a,r6 ; \ the lowest bit of partial remainder

rlc a;

mov r6,a;

mov a,r7;

rlc a;

mov r7,a;

mov a,r6;

clr C;

subb a,r2;

mov dpl,a;

mov a,r7;

subb a,r3;

mov dph,a;

cpl C;

jnc div_1 ; \update partial remainder if borrow

mov r7,dph;

mov r6,dpl ; \update parital reminder

div_1: mov a,r4;

rlc a;

mov r4,a;

mov a,r5;

rlc a;

mov r5,a;

djnz B,div_loop;

mov a,r5;

mov r1,a ; \ put qt. in r0,r1

mov a,r4;

mov r0,a;

mov a,r7 ; \get rem. saved before the

mov r3,a ; \last subtraction.

mov a,r6

Page 31: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

mov r2,a

ret ;

16 Bit Hex to BCD Conversion for 8051 Microcontroller\ This routine is for 16 bit Hex to

BCD conversion;\Accepts a 16 bit binary number in R1,R2 and returns 5 digit BCD in

;R7,R6,R5,R4,R3(upto 64K )

Hex2BCD: ;r1=high byte ;r7=most significant digit ;R2 = LSByte

MOV R3,#00D;

MOV R4,#00D;

MOV R5,#00D;

MOV R6,#00D;

MOV R7,#00D;

MOV B,#10D;

MOV A,R2;

DIV AB;

MOV R3,B ;

MOV B,#10 ; R7,R6,R5,R4,R3;

DIV AB;

MOV R4,B;

MOV R5,A;

CJNE R1,#0H,HIGH_BYTE ; \ CHECK FOR HIGH BYTE

SJMP ENDD;

HIGH_BYTE: MOV A,#6;

ADD A,R3;

MOV B,#10;

DIV AB;

MOV R3,B;

ADD A,#5;

ADD A,R4;

MOV B,#10;

DIV AB;

MOV R4,B;

ADD A,#2;

ADD A,R5;

MOV B,#10;

DIV AB;

MOV R5,B;

Page 32: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

CJNE R6,#00D,ADD_IT;

SJMP CONTINUE;

ADD_IT: ADD A,R6;

CONTINUE: MOV R6,A;

DJNZ R1,HIGH_BYTE;

MOV B, #10D;

MOV A,R6;

DIV AB;

MOV R6,B;

MOV R7,A;

ENDD: re

DISP1:

REFRESH: \ content of 18 to 1B memory locations are output on LEDs

\only numbers 0t 9 and A to F are valid data in these

locations

mov r1,41h;

mov r2,40h;

CALL HEX2BCD;

MOV 18H,r3 ; \least significant digit

MOV 19H,r4 ; \ next significant digit

MOV 1AH,r5

MOV 1BH,R6 ; \ most significant digit (max:9999)

refresh1: MOV R0,#1bh ; \1b,1a,19,18,holds values for 4 digits

MOV R4,#8 ; \pin p3.3_0 made low one by one starts with 18

mov r7,#2 ; \decimal pt.on 3rd digit from left (2 nd from right)

PQ2: CALL SEGDISP;

deC R0;

mov a,r4;

rrc a;

mov r4,a;

jnc pQ2;

PV3:

Page 33: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

RET

SEGDISP:

mov dptr,#ledcode;

MOV A,@R0;

ANL A,#0FH;

MOVC A,@A+dptr;

segcode:

MOV R5,A;

ORL A,#03H ; \ WE WANT TO USE PORT 1 BITS 0 AND 1 FOR INPUT ANLOG

\ so retain them high

S3: MOV P1,A ; \ SEGMENT_PORT

MOV A,R5 ; \we use p3.7 for the segment ‘a’ of display

RRC A ; \so get that bit D0into carry

cpl c;

mov p3.5,c ; \dec pt is D0 bit that is wired to p3.5

rrc a;

mov p3.7,c ; \segment ‘a;

S1: MOV A,R4 ; \get digit code from r4 00001000

cpl a ; \11110111

rrc a ; \11111011-1

mov p3.0,c ; \output to drive transistors for digit lighting

rrc a ; \11111101-1

mov p3.1,c;

rrc a ; \11111110-1

mov p3.2,c;

rrc a ; \1111111-0 yes low makes leftmost digit show msdigit

mov p3.3,c;

S5:

S4: ACALL DELAY1; \ let it burn for some time

MOV A,#0ffH ; \extinguish the digit after that time

MOV P3,A ; \to prevent shadow

s6: RET

ledcode:

DB 7EH,0CH,0B6H,9EH,0CCH,0DAH,0FAH

DB 0EH,0FEH,0CEH,0EEH,0F8H,72H,0BCH,0

F6H,0E2H;

\these are code for the numbers 0 to 9 and A to F

Page 34: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

DELAY1: MOV R1,#0ffH;

N: NOP;

DJNZ R1,N;

RET

END

Page 35: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

HARDWARE DISCRIPTION

1. ULTRASONIC SENSORS :

Ultrasonic transmitter and receiver pair

Features: • Working Voltage: 5V (DC)

• Working Current: 15mA

• 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

Page 36: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

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 robotic

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.

Distance = (Echo pulse width high time * Sound Velocity (340M/S)/2) or Distance in cm = (Echo pulse width high time (in uS)*0.017) The module works on 5VDC input and also gives an output signal directly for detection of any obstacle up to 4M.

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.

Page 37: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

2. Microcontroller AT89C2051:

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 Atmel’s high-density nonvolatile memory technology and is

compatible with the industry-standard MCS instruction set. By combining a versatile 8-bit

CPU with Flash on a monolithic chip, the Atmel AT89C2051 is a powerful 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.

PIN DIAGRAM :

Page 38: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

Pin Description

1. VCC Supply voltage.

2. GND Ground.

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 displays directly. 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. Port 3 Port 3 pins P3.0 to P3.5, P3.7 are seven bi-directional I/O pins with internal

pull-ups. P3.6 is hard-wired as an input to the output of the on-chip comparator and is

not accessible as a general purpose I/O pin. The Port 3 output buffers can sink 20 mA.

When 1s are written to Port 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.

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.

6. XTAL1 Input to the inverting oscillator amplifier and input to the internal clock

operating circuit.

7. XTAL2 Output from the inverting oscillator amplifier.

Oscillator Characteristics: The XTAL1 and XTAL2 are the input and output, respectively, of

an inverting amplifier which can be configured for use as an on-chip oscillator. Either a

quartz crystal or ceramic resonator may be used. To drive the device from an external clock

source, XTAL2 should be left unconnected while XTAL1 is driven. There are no requirements

on the duty cycle of the external clock signal, since the input to the internal clocking

circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and

low time specifications must be observed.

Page 39: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

3. CAMERA

SPECIFICATION:

Intex –IT305WC

Image sensor - 1/7 “ CMOS sensor

Image resolution - 30.0 Mega pixels interpolated

Frame rate - up to 30 fPs

Image control - Brightness, contrast, hue, saturation,

gamma, White Balance

Image Flip - Horizontal, vertical

Monitor type - CRT,LCD

Environment - Indoor, Outdoor

Focus distance - 4cm-infinity

Lens view angle - 54 Degree

I/O interface - USB 2.0

Image format - RGB24.I420

Power consumption - 160mW typical

SYSTEM REQUIRMENTS:

Page 40: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

Pentium II 350 MHz CPU or advanced

32 MB RAM or advanced

16bit VGA card, sound card

Operating system : windows 7,vista,XP,2000

Features:

Night vision

Support external microphone

Zoom function

Easy plug-and-play USB interface

High quality CMOS sensor

Support 30.0 Megapixel

Auto white balance

Camera

Page 41: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

4.HEF4049B Hex inverting buffers

1. General description: The HEF4049B provides six inverting buffers with high current

output capability suitable for driving TTL or high capacitive loads. Since input voltages in

excess of the buffers’ supply voltage are permitted, the buffers may also be used to

convert logic levels of up to 15 V to standard TTL levels. Their guaranteed fan-out into

common bipolar logic elements .

It operates over a recommended VDD power supply range of 3 V to 15 V referenced to

VSS (usually ground). Unused inputs must be connected to VDD, VSS, or another input.

2. Features and benefits: Accepts input voltages in excess of the supply voltage

Fully static operation

5 V, 10 V, and 15 V parametric ratings

Standardized symmetrical output characteristics

Specified from -40 ◦C to +85 ◦C

Complies with JEDEC standard JESD 13-B

3. Applications: LOCMOS (Local Oxidation CMOS) to DTL/TTL converter

HIGH sink current for driving two TTL loads

HIGH-to-LOW level logic conversion

FUNCTION DIAGRAM

PIN

DIAGRAM :

Page 42: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

PIN DISCRIPTION

1. VDD 1 supply voltage

2. 1Y to 6Y 2, 4, 6, 10, 12, 15 output

3. 1A to 6A 3, 5, 7, 9, 11, 14 input 4. VSS 8 ground supply voltage 5. n.c. 13, 16 not connected

Page 43: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

APPLICATION OF ULTRA -4

1. ULTRA -4 can do the measurement of length,width in narrow zone.(like

dangeroues pit)

2. It is Use in RESCUE OPRATIONS.

3. Use as SPY ROBOT.

4. Versatile use in AUTONOMUS TECHNOLOGY.

5. Use in MINING.

6. It has found essential use in LIGHT INDUSTRY (e.g. toy industry) AGRICULTURE

AND POWER ENGINEERING.

7. It is used in CAR PARKING.

8. Use in MEDICINE -

Medical ultrasonic transducers (probes) come in a variety of different

shapes and sizes for use in making pictures of different parts of the body. The

transducer may be passed over the surface of the body or inserted into a body

opening such as the rectum or vagina. Clinicians who perform ultrasound-guided

procedures often use a probe positioning system to hold the ultrasonic

transducer. Air detection sensors are used in various roles. Non-invasive air

Page 44: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

detection capabilities in the most critical applications where the safety of a

patient is mandatory. Many of the variables, which can affect performance of

amplitude or continuous wave based sensing systems, are eliminated or greatly

reduced, thus yielding accurate and repeatable detection. The principle behind

the technology is that the transmit signal consists of short bursts of ultrasonic

energy. After each burst, the electronics looks for a return signal within a small

window of time corresponding to the time it takes for the energy to pass through

the vessel. Only signals received during this period will qualify for additional signal

processing.

9. Use in INDUSTRY –

Ultrasonic sensors are used to detect the presence of targets and to measure the

distance to targets in many automated factories and process plants. Sensors with

an on or off digital output are available for detecting the presence of objects, and

sensors with an analog output which varies proportionally to the sensor to target

separation distance are commercially available. They can be used to sense the

edge of material as part of a web guiding system Ultrasonic sensors are gaining

popularity in a number of uses including ultrasonic people detection and assisting

in autonomous UAV navigation.

Because ultrasonic sensors use sound rather than light for detection, they work in

applications where photoelectric sensors may not. Ultrasonics are a great solution

for clear object detection, clear label detection and for liquid level measurement,

applications that photoelectrics struggle with because of target translucence.

Target color and/or reflectivity don't affect ultrasonic sensors which can operate

reliably in high-glare environments.

Other types of transducers are used in commercially available ultrasonic cleaning

devices. An ultrasonic transducer is affixed to a stainless steel pan which is filled

with a solvent (frequently water or isopropanol) and a square wave is applied to it,

imparting vibrational energy on the liquid.

Winding & Unwinding

Ultrasound sensors are used to detect the changes in diameter of drums and reels as they are wound or unwound. Typical industries are:

Paper and Printing Metal working Textiles

Page 45: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

Packaging,Plastics

Slope Control

Ultrasonic sensors are used to monitor the slope of loops of material in a process. They are the sensing components of systems that control continuous running of flexible material. Typical industries are:

Paper and Printing, Chemicals, Textiles Metal Working, Packaging

Height Measurement

With high accuracy and repeatability, ultrasonic sensors are used to measure the height of objects that are moving past the sensor. Measurements are generally unaffected by surface finishes and shapes of the measured objects. Industries where this type of application are found include:

Automotive, Packaging and Distribution Printing, Metal Working, Assembly Agriculture

Position Control

Pairs of ultrasonic sensors are used to accurately position objects. Linked together in a control system. the sensors provide the prime input for object location and position adjustment. Industries using these applications include: Automotive,Packaging,Printing,Assembly, Robotics, Plastics

Page 46: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

Collision Protection

Ultrasonic sensors are attached to moving objects and equipment to provide collision protection. The sensor continuously relays proximity data to a controller. Many industrial users include:

Automotive Automation Logistics Metal Working

Level Sensing

Ultrasonic sensors have a unique ability to detect uneven surfaces and return accurate distance data. The sensors are used in many applications where the detection of the level of a fluid in a container is needed. Typical industries include:

Food and Beverage, Chemical Water Treatment, Power Generation

Filing Sensing

Ultrasonic sensors can accurately detect the changing levels of powders, grains and other semi fluid substances. Many industrial users include:

Agriculture, Chemicals, Packaging, Fluid Handling

Page 47: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

APPENDIX

DATA SHEET:

MICROCONTROLLER 89C2051

Page 48: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot
Page 49: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot
Page 50: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot
Page 51: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot
Page 52: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot
Page 53: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot
Page 54: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot
Page 55: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot
Page 56: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

LM324 OP-AMP IC

Page 57: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot
Page 58: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot
Page 59: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

AT89S8253 MICROCONTROLLER

Page 60: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

3. Pin Description 3.1 VCC Supply voltage (all packages except 42-PDIP). 3.2 GND

Page 61: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

Ground (all packages except 42-PDIP; for 42-PDIP GND connects only the logic core and the embedded program/data memories). 3.3 VDD Supply voltage for the 42-PDIP which connects only the logic core and the embedded program/ data memories. 3.4 PWRVDD Supply voltage for the 42-PDIP which connects only the I/O Pad Drivers. The application board

must connect both VDD and PWRVDD to the board supply voltage.

3.5 PWRGND

Ground for the 42-PDIP which connects only the I/O Pad Drivers. PWRGND and GND are

weakly connected through the common silicon substrate, but not through any metal links. The

application board must connect both GND and PWRGND to the board ground.

3.6 Port 0

Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can sink six TTL

inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance inputs.

Port 0 can also be configured to be the multiplexed low-order address/data bus during accesses

to external program and data memory. In this mode, P0 has internal pull-ups.

Port 0 also receives the code bytes during Flash programming and outputs the code bytes

during program verification. External pull-ups are required during program verification.

3.7 Port 1

Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 output buffers can

sink/source six TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the weak

internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being

pulled low will source current (IIL,150 μA typical) because of the weak internal pull-ups.

3.8 Port 2

Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output buffers can

sink/source six TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the weak

internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being

pulled low will source current (IIL,150 μA typical) because of the weak internal pull-ups.

Port 2 emits the high-order address byte during fetches from external program memory and

during accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In this

application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external

data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special

Function Register.

3.9 Port 3

Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output buffers can

sink/source six TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the weak

internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being

pulled low will source current (IIL,150 μA typical) because of the weak internal pull-ups.

3.10 RST

Page 62: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

Reset input. A high on this pin for at least two machine cycles while the oscillator is running

resets the device.

3.11 ALE/PROG

Address Latch Enable. ALE/PROG is an output pulse for latching the low byte of the address (on

its falling edge) during accesses to external memory. This pin is also the program pulse input

(PROG) during Flash programming.

In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may

be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped

during each access to external data memory.

If desired, ALE operation can be disabled by setting bit 0 of the AUXR SFR at location 8EH. With

the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly

pulled high.

3.12 PSEN

Program Store Enable. PSEN is the read strobe to external program memory (active low).

When the AT89S8253 is executing code from external program memory, PSEN is activated twice

each machine cycle, except that two PSEN activations are skipped during each access to

external data memory.

3.13 EA/VPP

External Access Enable. EA must be strapped to GND in order to enable the device to fetch code

from external program memory locations starting at 0000H up to FFFFH. Note, however, that if

lock bit 1 is programmed, EA will be internally latched on reset.

EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt

programming enable voltage (VPP) during Flash programming when 12-volt programming is

selected.

3.14 XTAL1

Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

3.15 XTAL2

Output from the inverting oscillator amplifier. XTAL2 should not drive a board-level clock

without a buffer.

Page 63: B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot

REFERENCES

[1] Mazidi, Muhammad Ali, 8051 Microcontroller and Embedded Systems, The (1st

Edition) 1999, Prentice Hall

[2] Electronics for you, February 2008 edition ,EFY Group Publication (India), New Delhi.

[3] Datasheets of all the components involved (AT89C2051, IC 4066, IC 7805, IC TL084,

UA 741)

[4] www.efymag.com

[5] www.frontline.com

[6] www.electronicsdesign.com

[7] www.wikipedia.org

[8] www.finemach.com