I am new member to this website and i am already having a problem.
i am working on my final year project and i am using GP2Y0A02YK sharp IR sensors. the problem i am facing is with the repeatability of the readings, which is very poor, meaning that i get different readings for the same distance and sometimes these readings are far from what is supposed to indicate.
i hope my problem is clear and i look forward to hearing from you.
thank you guys for all your guidance, I tried the average idea and the readings are much more better now. for the time being i am not considering the Low pass filter because it seems to me that would slow the response time of the sensors. but if more precision is needed i won’t hesitate to use it.
I used a GP2Y0D810Z0F and was confused untl I looked at it on a scope. It’s a really weird PWM type output. I ended up taking readings in a loop, delay of 1 mSec (looped 100 times, but make it at least 30…50 times) and counted the number of times it was high.
(I was using it as a line sensor - long story - but the concept is the same.)
You can also do as suggested with an RC network into an ADC input.
But - find a scope and look at the output whenever you can.