Author
Topic: GP2Y0A2YK0F Sharp Distance Sensor (Read 46406 times)

Hi everyone, I am working with the GP2Y0A2YK0F Sharp distance sensor and am having significant noise problems with it.

Does anyone have experience using this sensor? I see noise spikes occuring at 1kHz. There are also lower frequency noise components as well because the output signal from the sensor is very "fuzzy." I have thought about adding capacitors between the output pin and ground to filter out some of the noise, but the problem with this is that it decreases the response time of the sensor (ie. if you very suddenly remove the object in from of the sensor, the voltage should drop, but because of the capacitor, the output voltage drops very slowly until it finally reaches its steady state value approximately 2 s later. . .

If anyone has any expertise with this sensor, please let me know because I am starting to run out of ideas. The output signal from the sensor is just way too fuzzy to be A/D'd with any decent accuracy.

hisorry maybe im being impolite posting here but not helping you...but i was wondering if u could give me a link to that sensor cuz i-m doing a wallbot(wall avoiding robot) and maybe i could use one of those...thank you

hey stt585,you have probably tried this already buthave you tried testing your setup with a voltage divider in place of your sensor to test all the other components in your circuit?there are a lot of places noise can creep in and it's worth ruling them out before you blame the sensor.

making sure i'm leaving enough time for my microcontrolers ADC to stabilise before taking a reading has caused me problems in the past.shielding (or shortening) sensor wires is worth trying as well.

hey stt585,you have probably tried this already buthave you tried testing your setup with a voltage divider in place of your sensor to test all the other components in your circuit?there are a lot of places noise can creep in and it's worth ruling them out before you blame the sensor.

making sure i'm leaving enough time for my microcontrolers ADC to stabilise before taking a reading has caused me problems in the past.shielding (or shortening) sensor wires is worth trying as well.

dunk.

Yep, I've got a 25k Pot that I was using before I replaced it with the sensor. I was scoping the power rail just now and noticed that it became much much more noisier when i plugged in the sensor. The noise on the power rail is the same frequency as the noise on the output of the sensor so I think that at least some of it is coming from the sensor itself.

I also noticed that the power rail was much noisier when a microcontroller was connected in the breadboard, but is pretty insignificant compared to the sensor noise.

No, I haven't tried fiddling around with the ADC setup and acquisition time yet. That's a good idea, thanks!

you can also use the sensor stand alone for a quick test setup, and then see if the spikes are still present. If they aren't, the problem isn't your sensor.

Ya, even when I just hook up +5V and GND to my sensor and read the output, it's noisy as hell. I've even started eliminating ambient IR noise sources but haven't been able to isolate it yet. Have you used this sensor before?

The above readings were done with this ADC setting:a2dSetPrescaler(ADC_PRESCALE_DIV16); // configure ADC scaling

So I changed it to:a2dSetPrescaler(ADC_PRESCALE_DIV128); // configure ADC scaling

Where higher DIV numbers increase accuracy but also increase read time (effectively finding an average over more time).

Now I got these typical values:0 0 0 0 4 0 0 0 0 0 1 0 1 0 1

So this led me to believe that there are short lived spikes going on. So oscoping it, I got the attached image. I took this reading right from the sensor output bypassing the wires. Those spikes happened no matter what was in front of the sensor. My oscope autoset couldn't find a pattern in the spikes.

So this led me to believe that there are short lived spikes going on. So oscoping it, I got the attached image. I took this reading right from the sensor output bypassing the wires. Those spikes happened no matter what was in front of the sensor. My oscope autoset couldn't find a pattern in the spikes.

Odd . . .

http://document.sharpsma.com/files/GP2Y0A21YK-DATA-SHEET.PDF (page 2)I don't know how to explain those larger sporadic spikes . . . maybe ambient IR noise? But those smaller ones closer to the signal--do they occur at intervals of approximately 40 ms? I hypothesize that the "fuzzy" noise is the transition time between sample outputs. Right now I think that I need to perform my A/D at a specific time, but even if I DO perform my A/D between those transition times, the signal is too "thick" to properly take a reading.

I will try to change my acquisition time settings on my microcontroller. Is that what DIV does, or does it change the A/D conversion clock…

But those smaller ones closer to the signal--do they occur at intervals of approximately 40 ms?

looking closely at the signal, there are groupings of tiny spikes that occur for a duration of 30.44ms. and spaced by 8.86ms. I guess thats a total of 39.3ms, which is really close . . . you can see this in the image i attached.

I have written come code and tested it. Have not yet integrated it into the robots control loop so as to say anything about its performance. After filtering the max variation in the ADC output was limited to less then 10.

Other things to watch out for:1) The reference voltage used by the ADC. On my board (Baby Orangutan AVR board) the reference voltage is 5V. But the max signal range is from 0v to 2.45V, so top 2 bits are wasted. 2) Atmega data sheet says the accuracy of ADC is +/- 2LSB bits at 100KHz sampling rate. 3) Bandwidth of ADC is only around 35 KHz.4) All the numbers above are from what I remember, don't have data sheets in front of me. Cross check them before using.

I use the GP2D12 sharp distance sensor. This has a lot of similar type noise but doesnt seem quite as bad as yours (it works well enough for me - it generally gives a correct range).

I generally take 5 readings and then divide the result by 5 in software to get an average value. I know its not perfect but it seems to work. but make things slow.

I looked at the difference between the GP2D12 and the GP2Y0A2YK0F and it seems the main difference that the beam width on the GP2Y0A2YK0F is almost twice as big as the GP2D12, Maybe this is causing some additional problems by having a wider detection range, greater scattering etc... Maybe there is a problem with reflections

well i think ill do this 2 times gain before goin to the avr , but about average values.. should somone get average values during the first 50 useconds or after the sensor is setteled?how much timesteps between these five readings?how much noise(mv) does this sensor give?anyone has a powerfull algo to get rid of this noise?

yea admin, that rocks, but what about this 5usecs? is it after the 50usecs of setteling or before the things settels? is this noise u guys are talking about before or after the sensor is settled,,,,,,?

sorry to get backon this a little late but i would like to say that this sensor (according to the datasheet) refreshes its output each 40 m seconds,so how do you folks aquiure its output at 1 khz? anyone can explain?i think we should wait 40 m each time we are goin to read a new out, or were you considering a steady state? if so im cool,but if there is a change in range that should be taken care of..

Benji, I'm pretty sure your right, the fastest you can accurately sample that sendor is around 30ms - 40ms. Did the guy who posted this have his microcontroller plugged into the wall? I couldn't get accuarte readings when I did.

I know this is an old topic but I had a problem with it a while back and now have a solution.

Here is the data with just the sensor:Rise time ~65nsFall time ~1.65usPeak to peak voltage ~2v

Sensor with 10nf ceramic capacitor on data line:Rise time ~4usFall time ~340usPeak to peak voltage ~0.1V

Sensor with 10uf ceramic capacitor and 530 ohm resistor parallel to the capacitor:Rise time ~7usFall time ~6usPeak to peak voltage ~0.11V

Conclusion, I would recommend adding a 10uf capacitor and a 530 ohm resistor to the data line on the IR sensor. The increased rise and fall times are nothing compared to the 1.9V difference in peak to peak value. There is a lot less noise with this configuration. Admin, I recommend putting this on the IR sensor page.

This was all tested/measured with a 2Y0A02 Sharp IR sensor and my 100MHz Tektronix Digital Oscilloscope.

Well, it's been a while since I took my electronics classes but I recall a lab excercise we did which was picking up alot of noise from the tube lights in the lab. (Do you call it tube lights? The long glass cylinders which are common in schools, hospitals etc) One of the excercises was to build an IR sensor, but I can't recall if this was the one suffering from that noise or if it was some other lab... Worth taking a look at anyhow. I ordered some Sharp sensors myself on friday, so I'm as eager as you guys to get to the bottom of this. I don't want to suffer from noisy readings!!