I am using Arduino duemilanove and a Sharp gp2yoa21 sensor for proximity sensing.

Now i will be using it to calculate the distance as well so i need pretty consistent and smooth data. But i observe this periodic spikes (ignore the big spike) in my data. I even tried to used electrolytic capacitor to remove the spikes, still i can observe the same on screen (though this time its smoother)

periodic spikes

I am using laptop to monitor the values(not connected to charging). Assembly is on breadboard.

Any guidance would be of great value. Thank you.

  • 4
    \$\begingroup\$ What frequency are the spikes showing up at? \$\endgroup\$
    – user39382
    May 10, 2016 at 6:30
  • \$\begingroup\$ Have you looked at this with an oscilloscope on the sensor output AND on the power leads of the sensor? This looks like a problem that bypass capacitors would likely solve. \$\endgroup\$ May 10, 2016 at 6:35
  • \$\begingroup\$ Also: Do not ignore the big spikes. Those are too close to the noise frequency to be fully coincidental. If you ignore data in your analysis, you will invariably be wrong with your conclusions. \$\endgroup\$
    – Asmyldof
    May 10, 2016 at 7:45
  • \$\begingroup\$ @slightlynybbled thats a very good idea that didnt strike me. I will do that. The data displayed is on serial plotter of arduino, so i dont think i will be able to measure the frequency and its characteristics. I am sure oscilloscope will give much better idea. \$\endgroup\$
    – Mayank
    May 10, 2016 at 8:34
  • 2
    \$\begingroup\$ Show the circuit. \$\endgroup\$
    – Andy aka
    May 10, 2016 at 8:50

1 Answer 1


After some research on the forum and doing some tests myself i realized that it was my laptop which was the source if noise. Thanks to this answer.

I put everything on battery and put the values on LCD display and everything was smooth. So it was my laptop which was the source of noise.

Thanks for all the comments and help.

  • \$\begingroup\$ Your question doesn't mention that you were powering from a laptop and gave no schematic. You need to supply all the relevant details in future questions. \$\endgroup\$
    – Transistor
    May 22, 2016 at 7:16
  • \$\begingroup\$ The connection was very simple, simple analog read setup in arduino. And i did mention that i am using laptop to monitor the values so i assume it was understood i am using laptop. But i will take care of the same from next time. Appreciate your response :-) \$\endgroup\$
    – Mayank
    May 22, 2016 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.