Discussion in "Project Doubts" started by    akshaydusane    Sep 10, 2012.
Mon Sep 10 2012, 05:44 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?
Mon Sep 10 2012, 06:58 PM
#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, 07:04 AM
#3
This same sensor is there on ebay for measuring distance...
Wed Sep 12 2012, 03:29 PM
#4
Can timers of Mc be useful for this ?
Thu Sep 13 2012, 04:39 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, 03:54 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 ??
Thu Nov 08 2012, 08:51 PM
#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, 10:24 AM
#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, 10:24 AM ]
Thu Nov 22 2012, 03:55 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.
Sun Dec 02 2012, 07:15 PM
#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

Conversation

No messages yet.

Downloads

Comments

Mirza123
Thu Jun 25 2020, 03:46 PM
eunicelove124
Mon Jun 22 2020, 03:03 PM
cerouno
Tue Jun 16 2020, 05:10 PM
Marce
Sat Jun 13 2020, 09:43 PM
Davidthils
Thu May 21 2020, 12:44 PM
Jakeror
Thu May 21 2020, 01:28 AM
motorCar
Wed May 20 2020, 07:05 PM
Vordrync
Wed May 20 2020, 11:52 AM

Online

Guests: 168, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 38215
Newest member: Mirza123