We got a mail from an Android phone owner who’d like to use his device in an obstacle detection system. His own particular needs required this solution to work in the traffic too, but here reaction spans have to be very short and dedicated devices are surely a better choice. However this request was interesting enough to make us wonder a bit about it. Here are our results.

The very proximity sensor

The most obvious solution is using phone integrated proximity sensor. Sadly, this sensor has a quite small working range (we’re talking of few inches/centimeters) to save energy and because anything more would be wasted. Moreover, don’t expect precise measurements: its probably working in a two state way: object present / object absent.

Here’s an example. My LG Optimus One has an optical sensor (probably yours too) and tells you two kind of distances: 9cm and 0cm, and it’s 9cm even if there’s nothing at all in front of it.

Such sensors can be tuned to turn on at specific distances, but this is way beyond our intentions.

You can test your proximity sensor with Proximity Sensor Finder.

The sonar way

This second technique is more interesting. The idea is that of emitting particular sounds from the speaker and trying to receive echoes back with the microphone, when some object reflects the waves. In this case too, it all depends on the fact that we’re talking of a smartphone, which shouldn’t be used this way. The biggest problem is that often speaker and microphone are not pointing in the same direction, hence losing directional capabilities.

If components are suitable and we’re willing to hack our dear phone, then one would have to find the best kind of sound. In the best case, with a good analyzing software it should be possible to get some acceptable measures for use while parking a car.

Here, too, there’s a “proof of concept” available on the market: Sonar.

Autofocus trick

Let’s get to the last trick. In this case we’re really using a net like a sponge to carry water (sorry, couldn’t get a better comparation). Smartphone cameras have autofocus capabilities, and to put some scene in focus it’s necessary to know subject’s distance.

Android, since ver. 2.3, gives the programmers a way to get to know that distance, once autofocus is done. We couldn’t find a test app for that (lots of camera triangulation programs though) but I wouldn’t be surprised if there are huge accuracy problems that more advanced chips (like in a reflex) wouldn’t have. Rather, we know about an attempt done with an HTC Desire where, even if autofocus works well, always returns a distance of 0.

A further consideration has to be done on the kinds of autofocuses, because some could even put in focus transparent objects (like rear window glass!)


Nothing to do? Try the above apps! You might be the lucky owner of a parking sensor!