Weird readings from my two GP2Y0A02YK sharp IR sensors

Hi guys

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.

Have you considered

taking an average of a given number of readings to get a stable-ish distance?

hi birdmum!No, I didn’t

hi birdmum!

No, I didn’t consider taking the average because the accurate distance doesn’t occur so often.

 

thank you guys for all your

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.

 

Problem…
Am having the same problem… Am using 10-80cm - GP2Y0A21 SHARP IR…
Like the other Pau’s sensor…hw did u correct it??

i took the average of 25

i took the average of 25 readings  using assemly language

Look at the output on a scope.

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.