Escolar Documentos
Profissional Documentos
Cultura Documentos
At the
..
Student Signature/Date Mentor signature/Date
PLAGIARISM DECLARATION
1. I know and understand that plagiarism is using another persons work and pretending it is
ones own, which is wrong.
4. I have not allowed, and will not allow, anyone to copy my work with the intention of passing
it off as his/her own work.
..
Student Name/Student No Student Signature/Date
2
ACKNOWLEDGEMENT
A humble appreciation to everyone who supported in compiling this project up to the stage of
constructing it, My mentor Mr. S.N Masondo, my friends because there were times where I felt
like giving up but they wouldnt allow me and their knowledge of digital systems III.
The electrical labs were very useful internet and all the hotspot of Wi-Fi on Electrical
Engineering department have been very helpful, the lecturers who are always there when you
come upon a challenge.
My mother settled all the financial buriers I thank her for playing the parental role once again
but without the Almighty God things wouldnt be this possible.
3
ABSTRACT
It is well known that many cars at the car parking spot use crash or collide , with this device it
will be very easy for drivers to see the distance between the car and the obstacle when they
are parking and moving out from the parking slot even when they are driving on the road. This
device is design to measure the distance which in cm. The device have a PIC microcontroller
and displays the measured results on the LCD to be seen by the driver and it use the LED and
buzzer to warn a drive about the distance. This report contain every tool that was used to
construct and build the device Ultrasonic Range Finder.
4
TABLE OF CONTENT
Preliminaries
ACKNOLEDGEMENT....................................................................................................3
ABSTRACT......................................................................................................................4
Table of Content................................................................................................................5
List of figures .................................................................................................................. 6
Constants and abbreviations............................................................................................. 7
CHAPTER 1- INTRODUCTION
1.1 Introduction....................................................................8
1.2 Problem statement..9
1.3 Aim.9
1.4 Literature....9
CHAPTER 2- DESIGN
2.1 Block diagram............................................................................................................10
2.1.1 Block diagram description.....11
2.2 Circuit diagram..........................................................................................................12
2.2.1 Schematic description...12
2.2.2 Methodologist...13
CHAPTER 3- CONSTRUCTION
3.1Flow chart...................................................................................17
3.2 Construction on PCB.....18
CHAPTER 4- TESTING
4.1Software.....................................................................................................................19
CHAPTER 5- RESULTS
5.1 Result on software....................................................................................................21
5.2 Result on PCB board................................................................................................22
CHAPTER 6- CONCLUSION
6.1 Conclusion...............................................................................................................23
REFERENCE
Reference...................................................................................................24
Appendix...................................................................................................25-31
5
LIST OF FIGURES
Table 1 List of figures Page 6
TABLE 1: above shows clearly the location of the tables and figures included in this
document.
6
CONSTANT AND ABBREVIATIONS
AC Alternating Current
DC Direct Current
TABLE 2: above show the constant and abbreviation which are included in this report.
7
CHAPTER 1
1. INTRODUCTION
Ultrasonic range finder is the tool that is very helpful on measuring and detecting the distance
between the two cars or the car and the obstacle, using the LCD that will show the distance that
is remaining before the car crash. This document is going to have the block diagram of the
device that shows the flow of current through the circuit and the schematic that is simulated on
proteus software. The report also include the prototype where the circuit is constructed on the
breadboard and the result of the project is shown in this report.
8
2. PROBLEM STATEMENT
I choose to do this project because it was an interesting design, but there where lot of challenges
as I was going through with it, the first problem was to find the money to print my documents
and to buy the components for my design. This design project is small and easily to construct
but when it comes to proteus simulation it was not easy at all because one of the component
HC-SR04 which is the ultrasonic transducer was not found, so I had to find another component
to replace it and work the same way as a transducer.
3. AIM
The main aim of this project is to detect the distance between two cars or between the car and
the obstacle.
4. LITERATURE REVIEW
This design project is investigational and instructive since it can be accepted in ready-made
modules such as the SR04 which are certainly useful [1]. The priority of this project is to
improve the distance measuring technique to be easier and saving time, the formation of this
project could be applied to other applications such as distance detector for the car reversing
and car parking distance measure [2]. This project is PIC based project that will be using the
PIC microcontroller. Microcontroller is a computer on a chip that is programmed to perform
almost any control, sequencing, monitoring and display the function [3]. Microcontroller is
designed to be all of that in one. It a great advantage that there are no other external components
that are needed for its application because all necessary peripherals are already built into it.
Thus, we can save the time, space and cost which is needed to construct low cost devices [4]
9
CHAPTER 2
DESIGN
2.1 Block Diagram
INDICATOR
LCD
LIGHT
MICRO
CONTROLLE
R
PIC16F88
ULTRASONIC
BUZZER
SENSOR
FIGURE 1: block diagram above is for Ultrasonic Range Finder de vice. The block diagram
illustrates how the circuit operates and how the current flows in the circuit when it is fully
operational.
10
2.1.1 Block Diagram Description
MICROCONTROLLER: This section forms the control unit of the whole project. The
Microcontroller forms the heart of the project because it controls the devices being interfaced
and communicates with the devices according to the program being written. On this project the
PIC16F88 will be used to control the LCD and the functioning of the ultrasonic range finder.
Microcontroller is a computer on a chip that is programmed to perform almost any control,
sequencing, monitoring and display the function. Because of its relatively low cost, it becomes
the natural choice to the designer. Microcontroller is designed to be all of that in one. Its great
advantage; there are no other external components that are needed for its application because
all necessary peripherals are already built into it. Thus, we can save the time, space and cost
which is needed to construct low cost devices.
DC SUPPLY VOLTAGE: It is the direct supply voltage that helps the project to
work/function proper by providing it with voltage power of 5V.
RESISTORS: It limits the current flowing though the switches which are 10k ohms.
LCD: To display the output from the microcontroller this will show the distance or range in
m, mm/cm depending on the settings.
INDICATOR LIGHT: The indicator light in this project is the LED, it going to indicate that
the device is working and to show that the distance between the two cars is decreasing
11
2.2 Circuit Diagram
FIGURE 2: the above circuit shows the construction of an Ultrasonic Range Finder that is
construction software called proteus.
An ultrasonic pulse is generated in a given direction. If there is an object in the path of this
pulse all the pulses will be reflected back to the transmitter as an echo and can be detected
through the receiver path, by measuring the difference in time between the pulses being
transmitted and echo received. This device is design to work on the vehicles to detect the
distance between the car and the obstacle before collision. This design is designed to warn the
driver when the specific distance is reached between two vehicles or the car and the obstacle.
It is built with buzzers and LEDs which will alarm and light to warn the driver whenever there
is any vehicle near in the indicated distance on the LCD.
12
2.2.2 Methodology
After doing the research about ultrasonic range finder how it works and research on different
schematic some of them were not found on the Proteus tools for schematic drawing and
simulation. The project will first be simulated on Proteus and there after constructed on the
PCB. The components will be bought and tested for the continuity functioning of the whole
project. The chosen schematic have been chosen as the best and the availability of the
components on the Proteus simulation and at the electronic component store.
13
2.2.3 Used Hardware Components
Figure 1: battery
Battery consists of positive and negative terminals where by the energy flows from the low to
high potential. There are two types of batteries namely rechargeable and non-rechargeable; in
this design a non-rechargeable battery is used due to financial reasons. Then a battery will
supply 12Volts.
B. VOLTAGE REGULATOR
Usually, we start with an unregulated power supply ranging from 9volt to 12volt DC. To
arrange the power to 5V we need 7805 regulator. The 7805 regulator is simple to use, Simply
connect the positive lead form unregulated DC power supply (from 9VDC to 12VDC) to the
input pin, connect the negative lead to the common pin and then turn on the power, a 5 volt
will be produced.
14
C. DISPLAY (LCD)
The 16 x 2 intelligent alphanumeric dot matrix displays is capable of displaying 224 different
characters and symbols. This booklet provides all the technical specifications for connecting
the unit, which requires a single power supply (+5V).
D. RESISTORS
The function of the resistor is to resist the flow of current. Here I have used the 10k pull
up resistors. Pull up resistors are used in electronic logic circuits to ensure that inputs
to logic systems settle at expected logic levels if external devices are disconnected
or high-impedance introduced.
E. CRYSTAL OSCILLATOR
15
F. HC-SR04 ULTRASONIC MODULE.
HC-SR04 is an ultrasonic ranging module designed for embedded system projects like
ultrasonic range finder. It has a resolution of 0.3cm and the ranging distance is from 2cm to
500cm. It operates from a 5V DC supply and the standby current is less than 2mA. The module
transmits an ultrasonic signal, picks up its echo, measures the time elapsed between the two
events and outputs a waveform thats high time is modulated by the measured time which is
proportional to the distance. The supporting circuits fabricated on the module makes it almost
stand alone and what the programmer need to do is to send a trigger signal to it for initiating
transmission and receive the echo signal from it for distance calculation. [2]
G. MICROCONTROLLER PIC18F2550
16
CHAPTER 3
CONSTRUCTION
3.1 Flow Chart
START
ULTRASONIC TRANSDUCER
NO
PULSE
RECEIVED?
YES
MICROCONTROLLER (make decision
based on received pulse)
NO
DISTANCE
10cm
YES
DISPLAY (LCD)
17
3.2 Construction on a PCB
FIGURE 3: the above shows the final construction of Ultrasonic range finder on a PCB
soldering iron is used to solder the circuit.
3.2.1Constuction Description
To confirm to the requirement of this project and to show that device will work on final
construction a temporary construction of the prototype was needed before finally transferring
it onto the PCB-board for permanent soldering. The circuit was constructed, tested using the
power supply of 12 volts. In order to achieve accuracy in the design, some necessary
adjustments were made to some of the components used.
3.2.2 Hardware Components
Microcontroller
LCD
Power supply
Ultrasonic sensor
Resistors
Buzzers
Regulator
LED
18
CHAPTER 4
TESTING
4.1 Software
4.1.1 Simulated circuit
FIGURE 4: The simulating circuit of an ultrasonic range finder that is constructed on proteus
software is shown above.
19
4.1.2 Prototype
FIGURE 5: the above figure shows the device constructed on the breadboard for testing.
The testing of the circuit on the breadboard make it easy to see how the circuit is going to
work when is constructed on a PCB.
20
CHAPTER 5
RESULTS
5.1 Prototype Result
Figure 6: The result of a working prototype is shown above and the LCD is demonstrating the
distance in centimeters (cm) that is left before the car crash LED and the speaker they are giving
a warning to a driver.
Figure 7: The proteus software above it a PCB layout that is being printed on a PCB for
soldering.
21
5.3 PCB Result
FIGURE 8: The circuit is now constructed on a PCB and all the components are connected it
complete. The soldering iron was used to solder the circuit.
22
CHAPTER 6
CONCLUSION
By using this project we can detect and sense the range distance from the ultrasonic object.
Transducer (ultrasonic sensor) and micro-controller are the main components in working of the
circuit they are the heart of this design. The conditions have been satisfied the circuit is doing
the desired work according to specific program that was build. The readings and signal has
been successfully controlled by microcontroller. With commands from the controller the signal
will be sent to the LCD display to display the readings. When the distance is less than 10cm
the LED and the buzzer will activated to warn the driver. Doing this design I have learn a lot
on project working and how important it is to follow all the instructions that are brought
forward to work upon.
23
REFERENCES
[1] www.best-microcontroller-projects.com
[2] http://library.utem.edu.my:8000/elmu/index.jsp
[3] www.best-microcontroller-projects.com/ultrasonic-rangefinder.html
[4] Microprocessor Architecture, Programming & Applications
- Ramesh S. Gaonkar
[5] Fundamentals of Microprocessors and Micro computers
-B. Ram
24
APPENDIX
25
CALL _Lcd_Cmd+0
;MyProject.c,47 :: Lcd_Out(1,1,"Distance(cm)");
MOVLW 1
MOVWF FARG_Lcd_Out_row+0
MOVLW 1
MOVWF FARG_Lcd_Out_column+0
MOVLW ?lstr1_MyProject+0
MOVWF FARG_Lcd_Out_text+0
CALL _Lcd_Out+0
;MyProject.c,50 :: do
L_main0:
;MyProject.c,52 :: level= ADC_Read(0);
CLRF FARG_ADC_Read_channel+0
CALL _ADC_Read+0
CALL _Word2Double+0
MOVF R0+0, 0
MOVWF _level+0
MOVF R0+1, 0
MOVWF _level+1
MOVF R0+2, 0
MOVWF _level+2
MOVF R0+3, 0
MOVWF _level+3
;MyProject.c,53 :: level=(level*5)/1024;
MOVLW 0
MOVWF R4+0
MOVLW 0
MOVWF R4+1
MOVLW 32
MOVWF R4+2
MOVLW 129
26
MOVWF R4+3
CALL _Mul_32x32_FP+0
MOVLW 0
MOVWF R4+0
MOVLW 0
MOVWF R4+1
MOVLW 0
MOVWF R4+2
MOVLW 137
MOVWF R4+3
CALL _Div_32x32_FP+0
MOVF R0+0, 0
MOVWF _level+0
MOVF R0+1, 0
MOVWF _level+1
MOVF R0+2, 0
MOVWF _level+2
MOVF R0+3, 0
MOVWF _level+3
;MyProject.c,54 :: FloatToStr(level, txt);
MOVF R0+0, 0
MOVWF FARG_FloatToStr_fnum+0
MOVF R0+1, 0
MOVWF FARG_FloatToStr_fnum+1
MOVF R0+2, 0
MOVWF FARG_FloatToStr_fnum+2
MOVF R0+3, 0
MOVWF FARG_FloatToStr_fnum+3
MOVLW _txt+0
MOVWF FARG_FloatToStr_str+0
CALL _FloatToStr+0
27
;MyProject.c,55 :: txt[3]=0;
CLRF _txt+3
;MyProject.c,56 :: Lcd_Out(2,1,txt);
MOVLW 2
MOVWF FARG_Lcd_Out_row+0
MOVLW 1
MOVWF FARG_Lcd_Out_column+0
MOVLW _txt+0
MOVWF FARG_Lcd_Out_text+0
CALL _Lcd_Out+0
;MyProject.c,57 :: delay_ms(1);
MOVLW 3
MOVWF R12+0
MOVLW 151
MOVWF R13+0
L_main3:
DECFSZ R13+0, 1
GOTO L_main3
DECFSZ R12+0, 1
GOTO L_main3
NOP
NOP
;MyProject.c,58 :: if(level<3)
MOVLW 0
MOVWF R4+0
MOVLW 0
MOVWF R4+1
MOVLW 64
MOVWF R4+2
MOVLW 128
MOVWF R4+3
28
MOVF _level+0, 0
MOVWF R0+0
MOVF _level+1, 0
MOVWF R0+1
MOVF _level+2, 0
MOVWF R0+2
MOVF _level+3, 0
MOVWF R0+3
CALL _Compare_Double+0
MOVLW 1
BTFSC STATUS+0, 0
MOVLW 0
MOVWF R0+0
MOVF R0+0, 0
BTFSC STATUS+0, 2
GOTO L_main4
;MyProject.c,60 :: out1=1;
BSF RB0_bit+0, 0
;MyProject.c,61 :: out2=1;
BSF RB1_bit+0, 1
;MyProject.c,62 :: }
GOTO L_main5
L_main4:
;MyProject.c,65 :: out1=0;
BCF RB0_bit+0, 0
;MyProject.c,66 :: out2=0;
BCF RB1_bit+0, 1
;MyProject.c,67 :: }
L_main5:
;MyProject.c,69 :: } while(1);
GOTO L_main0
29
;MyProject.c,70 :: }
L_end_main:
GOTO $+0
; end of _main
30
Appendix 2: PCB Layout
31