Let's Make Robots!

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.

Comment viewing options

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

I'd also suggest using a capacitor on the power line. I haven't used these sensors much but a lot of ICs have spike in their current usage which can cause the voltage to dip. It's a good idea to have a 0.1uF cap next to the Vdd pin of each IC in use. Some devices my need and additional 1uF or 10uF cap to keep their voltage intake clean. If you use a larger cap make sure and also include a 0.1uF cap for fast response.

Absolutely - as close to Vcc as you can get it, minimal distance to ground. 0.1 uF work really well. If you have a scope, watch the operation while looking at the general Vcc line. I *always* have a scope on the power line when I bring up new boards professionally (I'm a firmware engineer).

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.

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 readings  using assemly language

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.

 

Just a note:  averaging IS a lowpass filter.  By averaging, you slow down and smooth out rapid changes, exactly as a lowpass filter does.  However, other types of lowpass are more efficient and achieve the same results with fewer samples.  For instance, if you are using 25 samples with averaging you may be able to get equivalent results with maybe 10 samples and a better filter.  Even though other filters might take slightly more processing time, you still end up finishing faster so it slows the response LESS than averaging.  Like I said, this is just a clarification.  If averaging is working fine there is no reason to change it.  

This isn't uncommon. Sharp IR sensors are analog and really noisy. You don't say how you're using the sensors-are they on a mobile or a fixed robot, looking forward, looking at the floor, etc? What kind of environment are you using them in? What is the power source, and what kis the "brain?" In addition to bird's suggestion, you may need to add snubber capacitors to your circuits to smooth the signal. Another software approach is to remove transients by looking for sudden increases in the voltage readings (ie, if the last five readings only increased by 2% but the sixth was 10% then hold off on reacting to it for a few readings. If there's a real obstacle you'll still catch it.). The Sharp IR response isn't linear though, so at close range or with a very fast moving machine you may need some pretty specific numbers.

I am using the sensors on a mobile robot and they are looking forward. my robot in a closed environment (classroom) and as abrain I am using FPGA on DE2 board . the analog signal passes first through an ADC and the readings are displayed on LEDS