the labs @ laan thoughts and other ramblings

Posted
12 August 2009 @ 3pm

Tagged
products

Sonar Ruler !

Sonar Ruler - measure distance with your iphone

This app has been kicking around the labs for about 6 months and it finally came out. Basically it uses the iPhone’s speaker to send out a short click sound and it then measures how long it takes for that sound to bounce off of something in the environment. It can be quite accurate to within an inch or so when used in the right situations. I’ll say right upfront it’s not perfect, and cannot measure something small like a person. It works best on a large flat surface that is perpendicular to the iphone (like a large wall.) Things like temperature and even wind can affect the values, so I don’t recommend using the measurements it spits out for anything other than your entertainment. (itunes link: here)

The principles used in the app are actually pretty simple, it just took a lot of experimenting to figure out the right approach. I initially tried using FFT analysis to pick out the echo from the microphone signal, but it produced results that were pretty similar to just plain old maximum value detection. Throwing in some averaging and filters made it fairly tolerant to noise also. I may revisit the FFT technique as it is probably the more robust way to go, I just don’t have time to mess with it right now (it’s still in the source, it’s just not enabled.)

There is a short how-to video within the app, or you can check out another video here:

Sonar Ruler Demo from cc laan on Vimeo.

For German or Japanese subtitles, try the YouTube version.

I think a lot of things could be improved in the app like better echo detection or user interface. I’d like to post the code up here, but it’s kind of mangled right now so I may wait until I can clean it up a bit. Email me cc at laan dot com if you’re interested in checking out the source or making your own version. Also, follow us on twitter @laanlabs

How to hold the phone:

hold your free hand at a 45 degree angle next to the speaker/mic

hold your free hand at a 45 degree angle next to the speaker/mic

Some more random shots:

Fun with photoshop..

Old school logo..


40 Comments

Hi
I do not know much about iphone SDK but one robust way would be to modulate DTMF tones over a18-20Khz carrier (for directivity of the ruler) and detect for DTMF tones on return.
It will be fairly tolerant to noise. I do not know if iphone SDK provides DTMF detection routine but the standard way to detect the would be in soft via Goertzel algorithm see http://en.wikipedia.org/wiki/Goertzel_algorithm

further references on DTMF detection.
http://www-s.ti.com/sc/psheets/spra096a/spra096...
http://focus.ti.com/lit/an/spra082/spra082.pdf
http://focus.ti.com/lit/an/spra168/spra168.pdf

Another way is to use chirp modulation and use autocorrelation to detect the echoes.
As done in radars.

http://en.wikipedia.org/wiki/Chirp
http://en.wikipedia.org/wiki/Pulse_compression

hope it helps

regards
–amit

  Posted by fatbrain - 19 August 2009 @ 12am

Just downloaded the ruler. It's an absolute HOOT! WELL DONE!

  Posted by nickmcguinness - 19 August 2009 @ 11am

[...] via the iPhone’s speaker and then measuring the time it takes to return to its microphone, Sonar Ruler can give a pretty accurate reading for how far a certain object [...]

  Posted by Amazing iPhone app lets you measure distance with echoes (and it works too) – The Next Web - 20 August 2009 @ 9am

The iPhone is about 10cm long.. From where is the distance measured? Can be a pretty big margin..

  Posted by Bart - 20 August 2009 @ 11am

[...] the labs @ laan – Sonar Ruler ! By urtextedition via labs.laan.com [...]

  Posted by the labs @ laan – Sonar Ruler ! « seeleoff - 20 August 2009 @ 1pm

hello. i have an idea that could stem from this technology. would you be interested in contacting me to discuss?

  Posted by jhsindesign - 20 August 2009 @ 4pm

[...] 9:43 pm on August 20, 2009 Permalink | Reply Tags: mobile (191), software (189) Sonar Ruler turns your iPhone into a bat or dolphin. It emits sharp clicks, times how long it takes for the [...]

  Posted by Sonar Ruler turns your iPhone into a bat… « Paul M. Watson - 20 August 2009 @ 5pm

[...] from labs.laan.com August 20th, 2009 | found in gadgets [...]

  Posted by NEW/ STUFF » sonar ruler app for iphone is fantastic - 20 August 2009 @ 5pm

You're way too slow. This was already in the Dark Knight.

  Posted by thebatman - 20 August 2009 @ 5pm

Speaking of inches…
Is there an option to switch over to metric measurement!?
If not, this app isn't interesting for the rest of the world :-/

  Posted by Engywuck - 20 August 2009 @ 6pm

piece of crap. Not even worth the 99 cents

  Posted by abu117 - 20 August 2009 @ 6pm

Great app!
I'm a science teacher and have to explain the sonar principe used to measure lenghts to my students…this could help me a lot!!!
Thanks and keep doing those amazing stuff.

@engywuck : inch/feet/meter can be selected in the app ;)

  Posted by oliveryck - 20 August 2009 @ 6pm

???
Some arguments please!

It works like a charm! Worth the price, no doubt!

  Posted by oliveryck - 20 August 2009 @ 7pm

I'm intrigued…. cool idea!
How does it compare to 'pocketmeter', another sonar in the app store?

  Posted by bram - 20 August 2009 @ 8pm

Neat!
So all that is remaining is to put a submarine shell around an iPhone and you'll be all set to go into the Mariana Trench.

  Posted by Hussain - 20 August 2009 @ 11pm

Hey man,

Just bought this app and this is really crazy stuff!!! Works very accurate too.

Keep up the good work ;-) .

  Posted by maurelius - 21 August 2009 @ 3am

[...] Product details [Labs.Lann via Kottke] Product page [iTunes] [...]

  Posted by Sonar Ruler Turns iPhones into Dolphins. Kinda @ Technology News - 21 August 2009 @ 5am

As you perhaps know, iPhone 3Gs is completely accessible to blind and visually impaired users. I am blind myself and use the iPhone for a lot of things. A friend gave me the heads up on Sonar Ruler, which is of course a very helpful tool for people who are blind. Sadly, your app is completely inaccessible to me: I wonder whether you have switched on VO support at all in your app: none of the buttons are labelled and Sonar Ruler won't work with Voice Over turned on. I do hope you would consider making changes to Sonar Ruler, which is fantastically useful to people such as me, to make it Voice Over compliant.

  Posted by alexdejong - 21 August 2009 @ 4am

[...] Product details [Labs.Lann via Kottke] Product page [iTunes] [...]

  Posted by Sonar Ruler Turns iPhones into Dolphins. Kinda « REVIEWER [ER] .beta - 21 August 2009 @ 5am

[...] Read [...]

  Posted by NEWS: Sonic ruler app created for iPhone | Geek & High Tech - 21 August 2009 @ 7am

[...] can read more about this @ laan lab’s and you can directly visit the itunes store for this item [...]

  Posted by Interesting iPhone App that can measure Distances using Echo in Similar manner to Sonar-Tech Stroke - 21 August 2009 @ 7am

[...] of wood. But still, that’s a damned neat trick for a phone to be able to do. [iTunes Link via Laan via [...]

  Posted by Пресата presata.com» Blog Archive » iPhone’s Sonar Ruler App Measures Distance Using Sound [IPhone] - 21 August 2009 @ 10am

[...] of wood. But still, that’s a damned neat trick for a phone to be able to do. [iTunes Link via Laan via [...]

  Posted by iPhone’s Sonar Ruler App Measures Distance Using Sound | iProlly Blog - 21 August 2009 @ 12pm

[...] Product details [Labs.Lann via Kottke] Product page [iTunes] [...]

  Posted by Sonar Ruler Turns iPhones into Dolphins. Kinda « Coolbeans - 21 August 2009 @ 2pm

[...] of wood. But still, that’s a damned neat trick for a phone to be able to do. [iTunes Link via Laan via Kottke] Tagged:appsiphoneiphone [...]

  Posted by iPhone’s Sonar Ruler App Measures Distance Using Sound | Gizmodo Australia - 21 August 2009 @ 2pm

[...] of wood. But still, that’s a damned neat trick for a phone to be able to do. [iTunes Link via Laan via [...]

  Posted by iPhone’s Sonar Ruler App Measures Distance Using Sound [IPhone Apps] | Tech stuff center - 21 August 2009 @ 3pm

[...] an App for that!” hat wohl noch nie besser gepasst: Mit “Sonar Ruler” von “Laan” verwandelt ihr euer iPhone, wie es der Name schon erahnen lässt, in ein Sonar. Der Sinn [...]

  Posted by App of the Day: Sonar Ruler | BenM.at - 21 August 2009 @ 7pm

[...] Link via Laan via Kottke] Share and [...]

  Posted by iPhone’s Sonar Ruler App Measures Distance Using Sound | iPhone3GHacked.com - 21 August 2009 @ 10pm

[...] Read [...]

  Posted by NEWS: Sonic ruler app created for iPhone | Tech Blog - 22 August 2009 @ 10pm

very good idea. Only can be found in the iphone world. Continue in this way.
Regards

  Posted by carlos - 22 August 2009 @ 10pm

Great App! To expand on what fatbrain wrote, you could get *much* better signal-to-noise ratio, probably eliminating the need to use your hand to focus the sound energy, as well as much more accuracy by using something only slightly more complicated than a simple click sound. While this would probably make it more complicated for a teacher to explain to his/her students (unless the students are studying digital signal processing), I think it would be a really cool addition.

I'd recommend looking into Golay Codes for their sheer simplicity and their robustness. http://cnx.org/content/m15947/latest/ has a basic tutorial.

  Posted by Greg - 23 August 2009 @ 1am

Very cool app. Could this be used to create maps of internal spaces?

  Posted by Gonzillaaa - 23 August 2009 @ 7am

[...] Sonar Ruler Kūrėjai: Laan Labs Kategorija: pagalbinės Dydis: 9,8 MB Kaina: 0,79 [...]

  Posted by Sonar Ruler: nuotolio matavimas garsu | manofonas - 24 August 2009 @ 1pm

[...] out the Sonar Ruler app. Well isn’t that [...]

  Posted by Wednesday Morning News | MacTalk Australia - 25 August 2009 @ 10am

[...] Sonic Ruler (iPhone) [...]

  Posted by App News Podcast Folge 1 – appstorenews.net - 27 August 2009 @ 10am

[...] Sonic Ruler (iPhone) [...]

  Posted by App News Podcast Folge 1 - appstore-news.de - 2 September 2009 @ 4am

[...] Read [...]

  Posted by » NEWS: Sonic ruler app created for iPhoneToday’s Review: Latest Technology Review,News And Buying Guide - 25 September 2009 @ 4am

Great and nice looking app ! Please port it to android.

  Posted by nocivebrain - 7 December 2009 @ 8am

[...] thought about this a week after Sonar Ruler (the site was down when I tried to find a link, so here’s a demo on Vimeo) was released. This [...]

  Posted by Uncovering an invisible button on the iPhone, with sound - Lqd's Journal - 16 December 2009 @ 11am

[...] API which has allowed thousands of developers to launch fun and useful apps, like this or this or this, or the fact that I could easily sync it with the TV shows and movies I had bought from iTunes, nor [...]

  Posted by The Cult of Cool | SicklyCat.com - 21 January 2010 @ 2pm

Leave a Comment