Professional Documents
Culture Documents
Project Guide
Mr. S. K. Tiwari
This is to certify that a Mircoproject titled “Developed Circuits for Distances measurement
using ultrasonic sensor.” has been duly completed by the following students in satisfactory manner
as part of the course ESY (22532) in Electronics and Telecommunication Engineering department,
Government Polytechnic, Yavatmal.
Submitted By:
Micro-Project Proposal
Title of Micro-Project: Prepare report on distances measurement using ultrasonic sensor
Ultrasonic sensors measure distance by sending and receiving the ultrasonic wave. The
ultrasonic sensor has a sender to emit the ultrasonic waves and a receiver to receive the
ultrasonic waves. The transmitted ultrasonic wave travels through the air and is reflected by
hitting the Object.
1.0 Rationale:
Ultrasonic sensors are non-intrusive in that they do not require physical contact with their
target, and can detect certain clear or shiny targets otherwise obscured to some vision-based
sensors.
Ultrasonic sensors measure distance by sending and receiving the ultrasonic wave. The
ultrasonic sensor has a sender to emit the ultrasonic waves and a receiver to receive the
ultrasonic waves. The transmitted ultrasonic wave travels through the air and is reflected by
hitting the Object.
Working:-
An ultrasonic Sensor is a device used to measure the distance between the sensor and an
object without physical contact. This device works based on time-to-distance conversion.
Ultrasonic sensors measure distance by sending and receiving the ultrasonic wave.
Advantages :-
It has sensing capability to sense all the material types.
This sensor is not affected due to atmospheric dust, rain, snow etc.
It can work in any adverse conditions.
It has higher sensing distance (in centimetres and inches) compare to
inductive/capacitive proximity sensor types.
Disadvantages:-
It is very sensitive to variation in the temperature.
It has more difficulties in reading reflections from soft, curved and thin as well as a small
object.
These sensors have a base detecting distance.
It required careful attention for an experienced technician.
Program:-
#include <reg51.h>
Sbit Echo = P3^6;
Sbit Trig = P3^7;
Sbit led1 = P2^3;
Sbit led2 = P2^4;
Sbit led3 = P2^5;
Sbit led4 = P2^6;
Sbit led5 = P2^7;
Void delay us(unsigned int us)//This function provide delay in us uS.
{
While(us--);
}
Void delay_ms(unsigned int ms)//This function Provide delay in ms Ms.
{
Unsigned int I j
For(i=0;i<ms;i++)
For(j=0;j<127;j++);
}
Void main()
{
Unsigned int Count,Time,rfl;
Echo = Trig = 0;
TMOD = 0x01;//Timer 0 in 16-bit mode
Serial_Init();
While (1) {
Trig = 1;//Send 10us start pulse to HC-SR04 as per datasheet of HCSR04
Delay us(10);//~10us delay
Trig = 0;
While(Echo == 0);//Wait for Rising edge at Echo pin
TR0=1;//Start Timer
TL0=TH0=0;//Clear timer count register
While(Echo == 1)//Wait for Falling edge at Echo pin
{
If(TF0 == 1)//timer over if no obstacle is detected
Break;
}
TR0=0;//Stop Timer.
TF0 = 0;//clear Timer Over Flow Flag
Count = TL0 + TH0*256;//Calculate number of count
Time = Count*1.085;//Calculate total time in uS.
Rfl = Time/58;//As per datasheet of HC-SR04 Distance is in
Centimetre
If(rfl<=30)
{
Led1 = 1;
Led2 = 0;
Led3 = 0;
Led4 = 0;
Led5 = 0;
}
else if(rfl>=30 && rfl<=60)
{
led1 = 1;
led2 = 1;
led3 = 0;
led4 = 0;
led5 = 0;
}
else if(rfl>=60 && rfl<=90)
{
Led1 = 1;
Led2 = 1;
Led3 = 1;
Led4 = 0;
Led5 = 0;
}
else if(rfl>=90 && rfl<=120)
{
Led1 = 1;
Led2 = 1;
Led3 = 1;
Led4 = 1;
Led5 = 0;
}
else if(rfl>=120)
{
Led1 = 1;
Led2 = 1;
Led3 = 1;
Led4 = 1;
Led5 = 1;
}
}
Applications:-
Distance sensors are commonly used in robotics, automation, and other applications where
accurate distance measurements are necessary. They can be used for obstacle detection, object
tracking, and positioning, among other things
8.0 Skill Developed/Learning outcome of this Micro-Project:
Positioning of objects is a common application for Tough Sonic ultrasonic sensors. The
measured distance can be used to display, verify and/or control an object's position in real-
time. They are used in material handling and vehicle positioning applications, such as
vehicles on a scale, loading dock or car wash.