question about distance sensors


i am brand new to all this.

i am going to make a project for my third year degree show where i anticipate having a large wall mounted image which contains sensors (about 10?) which detect how far people are away from it and then makes sounds in response to this distance. i want to be able to measure a distance of around 0 cm up to 200 cm, i dont want to use laser sensors (like with laser pointers) as the beams will get in people’s eyes.

can anyone recommend a sensor that would be suitable? so far i have found some used in robotics and some that are used as car parking aids.

i want to use about ten sensors that will run into an arduino and from this into max msp so that sounds can be played in reaction to the distance that viewers are away from the image. is this the way to go ?

many thanks for any advice

You probably found this:,ProductName

I used one of them and it worked pretty well. Only problem i found was that it was not very precise, especially at short distances. Maybe it was the way i used it.

I don’t know if it is possible for Arduino to control 10 of them, but i guess it is.

One thing you should consider very carefully is that the sensor has an angle in wich it will detect an object. If you place 10 of them on a wall it will be very difficult to avoid the angels to overlap. This will make more than one sensor detect the same person. This will be a potential problem no matter which sensor you choose.

You might want to consider IR sensors. They are probably cheaper and look like they would be easier to use if you are fairly new to programming, since they can directly interface with the Arduino analog input pins (the ultrasonic sensors need to be polled). I did a quick search and found this sensor:

With a range of 20cm to 150cm, it’s not exactly what you were looking for, but for 13$ it producing a 0-5V analog signal within that range. The only problem here is that the Arduino only has 6 analog inputs.

I’m using the Sharp GP2D12 sensor - 24 of them, multiplexed through a 4051 chip (though I have only hooked up 8 so far). If you decide to go with the Sharp sensors, a capacitor across the sensor power/gnd is critical. It doesn’t mention that in the data sheet but I’ve been digging around and found some helpful info from other users. Also, 10 sensors are going to draw more current than the arduino can provide so you will need to power them separately (with a common ground).

I found the prices here to be the best:

Also - buy the cable. The connectors are hard to find elsewhere.


many thanks for these replies, looks like i have plenty to learn yet…

i dont think that the angle that the sensors read will be much of a problem if they overlap, it may be interesting to have two sensors detect the same person and respond accordingly.

sorry for my lack of knowledge but can i ask if the infra red and/or the gp2d12 sensor detects over a horizontal plane or in a kind of funnel 3d shape? i would like to have some of them above each other. hope this makes sense

i think my next/first step will be to get an arduino and one sensor and learn from there

many thanks

I think it depends on the sensor - some are very narrow beam, some are more funnel shape. Arconame has a good comparison chart. Also, I found this article very helpful @ info regarding capacitors and the mythical need-to-ground-the-case issue (no)


I hope this is helpful:

It’s an ultrasonic sensor that’s rated to 3 meters. I’m waiting for my order to arrive so I can’t say much more other than I did read somewhere that someone had at least 6 of them running on 1 card.

Good luck

hi again

thanks for the replies

that ping distance sensor looks possibly like the way to go for my needs. 2 cm to 3m is pretty much the distance i’m after

can i ask : what would i need to buy if i wanted to connect 8 or 10 to an arduino board? which board would you recommend for this purpose? would they all fit into the one board or would i need some kind of adaptor?

and then i guess i can link the board to a computer with max msp using usb?

again, many thanks

I’ve used these for years, however I think you’ll have trouble at a high density with crosstalk, even using narrow angle sensors. We’ve had six SRF08s running this week in cubby holes on an exhibition stand to trigger videos, and two or three splayed at 45 - 90 degrees on other occasions with out too much trouble. However running a couple side by side has given cross talk issues.

You’ll probably have to cycle the sensors so the closer ones have a different duty cycle. You need a 65ms gap between different reads, so if you have all ten on a different duty cycle then it may be a little slow for very responsive audio.

You’ll also need to ensure that you provide a separate power bus for the sensors, since the +5v pin may not provide enough.

Finally don’t forget to look at EyesWeb, it only runs on windows and uses webcams, but is by all accounts very good. To boot it should be fairly easy to send OSC to Max from it.

hi again

thanks again for the advice

can i ask : if i go for the Diecimila, will it be able to support maybe 8 or 10 of the PING))) Ultrasonic Sensors or the SRF08 - High Performance Ultrasonic Range Finders, for example.

if so, then i think i will get started with a Diecimila and one sensor and begin my learning from there as it sounds like i have plenty way to go yet. :slight_smile:

any other hints and tips most welcome

You don’t have enough analog pins on arduino to run that many sensors directly but you can use a multiplexor. There is a good tutorial on the 4051 chip in the playground. It’s pretty easy.

hi again

i see here that someone has written code for one of those ping sensors. what is the maximum i can use on one diecimila without using one of those multiplexor things? 6?

ive now got a diecimila and am working through the tutorials, turning leds on and off and suchlike. still plenty to learn, fun though


I believe that the Ping sensor uses a single digital pin on the Aduino board that changes between input and output. So in theory you could have 12 (or more if you use the analog pins as digital) but i think that you would run into some serious timing problems using more than a few of the sensors.

ive been scouring the web looking for a supplier of the parallax ping sensor in the uk but havent been able to find one, i emailed parallax too but so far they havent replied.

does anyone know of a uk supplier for them or am i going to have to order direct from parallax? or i may look around for a similar sensor from a different company, though the parallax one seems to suit my requirements most

continued thanks

From the Parallax website:

Milford Instruments
Phone: int + 44 1 977 683 665
Fax: int + 44 1 977 681 465