Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: macbook on August 14, 2010, 02:50:42 AM

Title: Working with a sonar
Post by: macbook on August 14, 2010, 02:50:42 AM
Hi,
I wanna use sonar in one of my projects. I wish to use a sonar for obstacle avoidance & path mapping, mainly using it to analyze the surrounding environment i.e., calculating distances from walls and other obstacles.
I've never used a sonar before. What kind of a output does a sonar give? How does it tell the distance of the obstacle to the microcontroller?
I also read somewhere on SoR that sonar can also be used to detect how hard of soft a material is. How does it do that? As in, how does it tell the microcontroller that abt a material's hardness or softness. Again basically the question is what kind of output does it send to the microcontroller?
Reply soon.
Thank you. :)
Title: Re: Working with a sonar
Post by: HyperNerd on August 14, 2010, 05:33:28 AM
I will assume that you have already read this page: http://www.societyofrobots.com/sensors_sonar.shtml (http://www.societyofrobots.com/sensors_sonar.shtml)

It really depends on which sonar sensor you choose to use in your project - some (the PING))) sensor by Parallax for example) use 1 I/O pin for both triggering the sensor and reading back data. These tend to output a pulse whose length determines the distance detected.

Others such as the MaxSonar range, have multiple output choices such as pulse width (the same as the PING))) sensor), analog voltage output (the same as the analog SharpIR sensors) or digital serial output.

If you already have experience using the SharpIR range, then the MaxSonar range would probably be the easiest integration, as they can use the same type of interface, thus requiring very little code adjustment.

Good luck with your project  :)

 -HyperNerd
Title: Re: Working with a sonar
Post by: Admin on August 14, 2010, 07:01:38 AM
Quote
I also read somewhere on SoR that sonar can also be used to detect how hard of soft a material is. How does it do that?
Lets say you have two objects, each equal distance away from the sonar. That means the time to travel for the sonar pulse is equal, so the distance is equal.

The difference is the power of the returned pulse - harder objects reflect more energy back, softer objects absorb more energy.

The cheap hobbyist sonar by default only returns the time to travel data . . . so you'll need to poke it with a multi-meter to find a pin that has the original non-processed pulse and hook that up to an ADC.

btw, the MaxSonar returns a value equal to the centimeters distance away.

you might find this educational:
http://en.wikipedia.org/wiki/Sonar (http://en.wikipedia.org/wiki/Sonar)
Title: Re: Working with a sonar
Post by: Soeren on August 14, 2010, 10:33:41 PM
Hi,

The difference is the power of the returned pulse - harder objects reflect more energy back, softer objects absorb more energy.
Assuming equal distance, two objects, one 20cm wide and some degree of "soft" and the other 10cm wide and "twice as hard" (in the sense of amount of reflection per area) - I don't really see how you're gonna tell softness from area unless you do some very fine calc on the returned pulse (i.e. using analog timing circuits of a similar speed like in LASER TOF circuitry)?
Title: Re: Working with a sonar
Post by: Admin on August 15, 2010, 06:52:02 AM
The difference is the power of the returned pulse - harder objects reflect more energy back, softer objects absorb more energy.
Assuming equal distance, two objects, one 20cm wide and some degree of "soft" and the other 10cm wide and "twice as hard" (in the sense of amount of reflection per area) - I don't really see how you're gonna tell softness from area unless you do some very fine calc on the returned pulse (i.e. using analog timing circuits of a similar speed like in LASER TOF circuitry)?
Well, what I meant to say was, 'all other things remaining the same' :P
Title: Re: Working with a sonar
Post by: macbook on August 15, 2010, 01:53:26 PM
Thanks a lot for the replies and going by its complexity, I dont think i'll use my sonar as a hardness detector.. :P
Title: Re: Working with a sonar
Post by: Admin on August 15, 2010, 07:20:04 PM
A single DoF robot arm with a force sensor at the end can poke the object to determine stiffness.
Title: Re: Working with a sonar
Post by: Admin on August 16, 2010, 10:45:04 AM
I was reading around about sonar for my robot fish, and found this page:
http://www.lowrance.com/Support/Tips-and-Tutorials/Sonar-Tutorial/ (http://www.lowrance.com/Support/Tips-and-Tutorials/Sonar-Tutorial/)

This section shows how softness/hardness affects the returned image:
Quote
Mud, sand and vegetation on the bottom absorb and scatter the sonar signal, reducing the strength of the return echo. Rock, shale, coral and other hard objects reflect the sonar signal easily. You can see the difference on your sonar's screen. A soft bottom, such as mud, shows as a thin line across the screen. A hard bottom, such as rock, shows as a wide line on the sonar's screen.
(http://www2.lowrance.com/images/Tutorials/Sonar/softbot.gif)(http://www2.lowrance.com/images/Tutorials/Sonar/hardbot.gif)
Title: Re: Working with a sonar
Post by: macbook on August 17, 2010, 01:39:34 PM
Nice article.. thnx for the link.. :)