Use of Ultrasonic sensor for measuring distance........
Discussion in "Project Doubts" started by akshaydusane Sep 10, 2012.
Mon Sep 10 2012, 11:14 pm
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?
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
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.
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.
Thu Sep 13 2012, 10:09 am
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
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
Thu Nov 08 2012, 09:24 am
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 ??
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 ??
Sat Nov 10 2012, 03:54 pm
@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 ?
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
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.
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
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..
and try again. Use a CRO for better understanding of what is going on.
P32=0; P32=1; _nop_(); _nop_(); _nop_(); _nop_(); P32=0;
and try again. Use a CRO for better understanding of what is going on.
Powered by e107 Forum System