Discussion in "Project Doubts" started by    akshaydusane    Sep 10, 2012.
Mon Sep 10 2012, 11:14 pm
#1
Hello...
I want to use Ultrasonic sensor for measuring the distance between the obstacle and the sensor....
My sensor model is GH-311.Is it possible?If yes how?
Tue Sep 11 2012, 12:28 am
#2
This this a strange one.
In the data sheet the description of how it works sounds like a 'Ping' sensor, which can be used
to measure distance.
But there is also a diagram that suggests it just warns that something is in range.

On the net are several threads asking about how it works.
Some say it can be used to measure distance, others that it cant.

You can test it by applying a 10 microsecond positive pulse to the sense pin and looking at the response.
Use an oscilloscope if possible.

Similar distance measuring units are very cheap from China these days. Check ebay.

Attachment
Tue Sep 11 2012, 12:34 pm
#3
This same sensor is there on ebay for measuring distance...
Wed Sep 12 2012, 08:59 pm
#4
Can timers of Mc be useful for this ?
Thu Sep 13 2012, 10:09 am
#5
we already have a complete thread dedicated to similar sensor from parallax Ping))
take a look at this thread. It has all the pseudo code and information on distance measurement sensor.
http://www.8051projects.net/t27437/8051-discussion-forum/pulse-generator-using-p89c51rd2.htm
Tags ultrasonic distance measurement sensorparallax ping)) sensor 80518051 distance measurement
Thu Nov 08 2012, 09:24 am
#6
I want to show the value(integer) I have got from calculating distance....
I need to place that value in SBUF..
I have seen many examples,I observed that only char is sent through SBUF
How I can place in integer in SBUF ? Same as it like a char ??
Fri Nov 09 2012, 02:21 am
#7


How I can place in integer in SBUF ? Same as it like a char ??

akshaydusane


You can as long as it is an 8 bit integer.
 pravin_35 like this.
Sat Nov 10 2012, 03:54 pm
#8
@Ajay Bhargav
I read the article which you suggested to me but I am just confused with a couple of things

My sensor has 3 pins gnd, vcc, sig
sig=p3^3;
1. Sensor is activated
2. TR0=1
3. If obstacle detected --> TR0=0 --> int temp = TH0 --> further calculations
4. If not detected --> reset the timer
Is it correct algo?
Is his "sonar0" pin is my "sig" pin ?


[ Edited Sat Nov 10 2012, 03:54 pm ]
Thu Nov 22 2012, 09:25 pm
#9
Sir, I have constructed following code from the project which you suggested..
But Sir I am facing problem while running this code..
1. When the program waits for the port to be low (while(P32)) Here as far I understood it should automatically become low. But that port becomes low when I remove the obstacle front of the sensor. Till then the timer runs. I do not want that extra time to be included.
Code:
P32=0;
P32=1;
for (i=0;i<=10;i++)
_nop_();
P32=0;

P32=1;
TMOD=0x09;
TR0=1;
while(!P32);
while(P32);

TR0=0;
temp1=TH0;
temp2=TL0;
temp3=(temp1<<8)|temp2;
a=temp3*0.00000108; //secs
time=a/2;
dist=(343*time)*100; //cm
countf(dist); //sending calculated dist value to serial port

Thank you.
Mon Dec 03 2012, 12:45 am
#10
tout pulse should be 2-5uS and you are giving a lot of delay there. so I guess your sensor is not able to understand what is going on. reduce time..

P32=0;
P32=1;
_nop_();
_nop_();
_nop_();
_nop_();
P32=0;


and try again. Use a CRO for better understanding of what is going on.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm
Bernardwarge
Tue Mar 26 2024, 11:15 am