View Full Version : IR Distance Sensor Sharp GP2D12

08-24-2007, 10:06 AM
I just had a look at your very nice Maker Faire 2007 demo and I am wandering if I can use the IR distance sensors in my project.
I would like to use them to recognize a tennis table ball that fly over a border of the tennis table table.
The sensors will be displaced on the border of the table pointing up in the same way you did with the Maker Faire 2007 demo.
The tennis table ball has a 40 mm diameter and can be white or orange. It can be really fast, more than 100, Km/h but normally is around 40 km/h.

My questions are:
how narrow is the field of view of the Sharp GP2D12 sensor ?
will it be able to "perceive" the ball.
what is an estimate of the maximum ball speed it can handle?I found this pdf with a lot of technical specification:


Any suggestion or links to info will be really useful

Thank you all


08-27-2007, 09:13 AM
Hey Stefano:)

IR sensors probably aren't your best bet in this situation because they have a very narrow field.

I'm thinking sonar sensors (http://www.trossenrobotics.com/store/c/3013-Sonar.aspx) would work much better because they have a much wider field than IR.

Maybe I'm totally misunderstanding your project, but I think you're a little confused as to what to expect from these sensors. These sensors are designed to detect distance.

I'm no expert in math, but I believe the only way that you can detect speed by distance is by using distance traveled in conjunction with how much time it took to get to that destination, which it doesn't sound like you're doing here. Again, no expert in Math, so maybe Dave might be able to shed some light on this.

08-27-2007, 11:30 AM
Hi Alex,

The main objective in using the IR sensor is to detect when a ping pong ball fly over the end of a ping pong table. Knowing where the ball passed the end will be a plus.
Imagine a line of sensors similar of the one used in your Maker Faire 2007 demo placed on a ping pong table aligned with one end of the table. If the sensors are able to detect when a hand is over them (like in your demo) maybe they are able to detect a white ping pong table flying over them.

Imagine you are playing ping ping with a robot throwing to you balls with different speed/spin/direction.
In order for the robot to throws to you balls with a realistic timing the robot must detect when the ball is near the expected hitting position (normally near the end of the table).
If the robot can detect when the ball is near his side he can trigger a new ball throw simulating a more realistic serve.

Maybe you are right using a sonar sensor will be more effective, I will check the specs to see if it is applicable.

In any case the requirements are the same:
Do you think the sonar sensor will be able to detect a ping pong ball flying fast over his head?

Sorry for my English I hope that the longer description will clear a little my idea.

Probably I have to experiment by myself but before putting together the sensing mechanism I have to create the throwing robot and this will require some more time :-)

Thanks again

08-27-2007, 12:10 PM
gotcha! I guess I could've looked at your other posts:o That's a mighty creative idea, I can't wait to see this in action!

A ping pong ball would be able to be detected by IR distance sensing, but the thing is that IR sensors have a very narrow beam. The great thing about IR distance sensing is that you can practically place them right next to each other without having to worry about interference. The problem that I see with this method is that you will have to use quite a few IR distance sensors to get as wide of a field as what you need.

This is unlike sonar, which offer a much wider field, but you have to do some work to get them to work close to each other. There are some pre-made products that do this for you though. Even so, the only method that I'm aware of is using a pulsing effect. Basically when you have an array of sonar sensors next to each other, no two sensors next to each other are on at the same time.

I hope that helps out your research a bit:D

08-28-2007, 03:24 AM
Thanks a lot Alex.
Based on your suggestions I will probably try infrared sensors first.
I will let you know if I will be able to make something working :-)


08-29-2007, 04:58 PM
I just want to reinforce something here: If you're trying to detect things crossing a border, you want sensors with the narrowest beam width possible. Thus, sonar would be problematic. This means you will need more sensors in total, but you'll be less likely to trigger the sensors before the ball crosses the line. Also, try recessing the sensors into a groove, which would help narrow the beam to the front and back, while allowing it to spread to the sides.

That having been said, I'm not even sure if the sensors will actually be able to detect a fast-moving ping pong ball. Go ahead and try it. Let us know how it turns out.

08-31-2007, 03:41 AM
Hi Dave,
thank you for the suggestion, probably I will try recessing the sensor line a little below the end of the table.
Thinking about using the IR sensors to detect the ball, I found that the main limiting factor for the IR sensors to detect the ping pong ball is the sampling rate of the Phidget 8/8/8 Interface Kit.
The sampling rate should be 65 Hz thus a ping pong ball moving fast enough to cover the beam of the sensor in 1/65 of a second is able to pass over the sensor undetected.
At 100 km/h the ball covers 43 cm in 1/65 of a second. It should be enough to avoid the ball to be detected.
In any case experiments will tell the real numbers.
I will let you know about my results.