Let's Make Robots!

Sharp GP2D12 and Object Detection

Hi all,


I'm trying to use 2 sharp sensors to detect an object which is placed near a wall (see pic). The problem with these sensors is that the readings will fluctuate even when it's static and if the distance is far, it is harder to differentiate the object from the wall.

the sensors are mounted on a moving robot. Any suggestions to detect the object?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I played around with adding a cap to the signal and ground since it's an analogue device. Seemed to help somewhat in the eratic reading if I recall correctly. I played around with different sizes but don't recall which I ended up using. 100uf maybe?

I also tried averaging multiple readings if they were within a certain high/low limit of the first reading. if they were above the limit I would output that value until they were close again and repeat...something like that, it's been a while since I touched that code and I think it had a lot of room for improvement. I think it worked for the most part though  :D


thanx voodoobot.


So if the value is within the limits, take the average; if > upper limit, output that value? what do you mean by output that value?


For example, the reading to the wall is 200, and the reading to the object is 220. I need to be sure that the difference in reading (20) is due to the object, and not to noise. I've tried the averaging method but the result is still not reliable, especially when the reading is high (> 400).


I've 2 sensors mounted, can i use some form of triangulation to lock down the object?

In order to "see" if triangulation is the way to go, your diagram needs to be more specific. It's not to scale, I imagine. What is the (typical) size of the object? Does it vary?. What is the typical distance to the wall. Etcetera.

the object is a ball of ~ 7 cm in diameter. the distance between the ball and the wall will vary (depends on how the ball roll there). the robot is equipped with the 2 sensors, placed ~ 15 cm apart. ideally, it'll move and sense at the same time.

As the sensors readings follow a curve, when the ball is very near the ball and the robot is very near the ball, the readings received from the ball and the wall are about the same, heavily influenced by noise.

I'm thinking of using some form of triangulation method, maybe using readings taken at 2 positions to confirm that the ball is there.


tatz what i needed, some form of visualization.

Unfortunately, this is part of my school project, and I'm stuck with a "not so friendly" controller. there's a 17 ms reset and we can't really use the for-loop.

the robot is supposed to sense on the move, hopefully i can adopt the codes for that.

thanx and update soon.


I'll have to collect those topics....

If your using 2 sensors aimed at the same object, won't they interfere with each other ? Each is sending out IR pulses and "sensing" the reflection.