### Author Topic: Made the SONAR; cant get started with the microcontroller  (Read 2584 times)

0 Members and 1 Guest are viewing this topic.

#### teeb

• Beginner
• Posts: 6
##### Made the SONAR; cant get started with the microcontroller
« on: April 16, 2007, 02:01:13 PM »
have made a sonar, working nicely in air for 24 feet range.

now i want to interface it with microcontroller to calculate the range. Please can some one help me do that as i have a very little knowldge of microcontroller.

reset pin of transmitter and output pin of reciver are tobe connected to the microcontroller...

PLEASE SOMEONE HELP me as i am totally stuck and this is my Final yr project and i need to finish it in 20 days....can anyone help?

#### Jeff

• Jr. Member
• Posts: 9
##### Re: Made the SONAR; cant get started with the microcontroller
« Reply #1 on: April 16, 2007, 04:18:07 PM »
What are the interface specs?
What microcontroller are you using?

#### sdk32285

• Supreme Robot
• Posts: 418
##### Re: Made the SONAR; cant get started with the microcontroller
« Reply #2 on: April 16, 2007, 08:35:38 PM »
Usually the sonar gives you a value which you need to apply a scale factor to in order to get the distance. If you buy the sonar they usually provide the scale factor. If you made the sonar (please provide a schematic because I think that's pretty cool) then you need to physically measure the distance and the value from the sonar at different points and using excel (or similar) come up with an equation or a table of values.
Robots for Roboticists Blog - http://robotsforroboticists.com/

#### teeb

• Beginner
• Posts: 6
##### Re: Made the SONAR; cant get started with the microcontroller
« Reply #3 on: April 17, 2007, 12:29:30 PM »
using 8051 microcontroller

i just want to calculate the distance using it... like timmer goes on if reset pin is high and off if reciever output pin goes high.

#### Hal9000

• Supreme Robot
• Posts: 338
##### Re: Made the SONAR; cant get started with the microcontroller
« Reply #4 on: April 17, 2007, 02:42:31 PM »
Is there a thing on an 8051 that generates an interrupt on pin change? I forget.

But that would be awesome for what you are doing. If not, poll the pin until it changes!
"The truth is, you can't hide from the truth, cos the truth is all there is" - Handsome Boy Modeling School

#### teeb

• Beginner
• Posts: 6
##### Re: Made the SONAR; cant get started with the microcontroller
« Reply #5 on: April 18, 2007, 02:47:52 AM »

but as i mentioned before, am new to microcontroller; n thats why i needed the whole way/guideline to wat i want ! :|

#### nanob0t

• Robot Overlord
• Posts: 145
##### Re: Made the SONAR; cant get started with the microcontroller
« Reply #6 on: April 18, 2007, 10:46:48 AM »
I believe with sonar, you output a signal and then you wait to input it.  Once you get it, you get a time value.  You will then need to calibrate the sensor by collecting many value points and creating an equation the numbers recieved will flow through.  Well, that's what I did with IR, and I believe the same with sonar.  You will need to debug this way.

I am going to do some research with sonar today and I'll get back to you.  To give you an idea what you have to do.

Make a program that all it does is pulse out then wait for something back.  You can insert a break so you can continue this, and do it once at a time.  Then, set an object x amount of inches/centimeters in front of it and get the data that comes back, record it, and I hope you know how to create a graph/equation using it.

After this, you just need to insert the equation into a program.  Then have it tell the sensor to output and get input, run it through the equation, and you have the measurement of whatever is in front of it in a unit.

Try reading the data sheet for the Ultrasonic sensor.  I'll get back

#### teeb

• Beginner
• Posts: 6
##### Re: Made the SONAR; cant get started with the microcontroller
« Reply #7 on: April 18, 2007, 12:02:01 PM »
this is what i want to do:
I need to calculate the distance so i need to interface the 8051microcontroller with Reciever and transmitter.  I just dunt knw how to start up with the microcntroller part. Then i need to display the distance calculated on a LCD screen or a 7 segment display.

Actually have made the transmitter and reciever circuit and tested them too. They are working fine. I need to connect my circuit with the microcontroller. All what microcontroller does is makes the transmitter output pin high, and waits for the microcotroller pin that is attached to the transmitter to detect the reflected signal.  And calculate the time elasped. And am just stuck i just dont knw how to do all that. :|

I will be waiting for ur reply. Thanks anyway.