I was testing an IR sensor by sending them over serial and using the IDE's serial plotter to visualize them (very simple script - attached).
I am using a Sharp GP2Y0A02YK0F sensor and an Arduino 1. The sensor is simply hooked up directly on 5V, ground and pin A5.
It had quite a bit of noise and I notice you could see the same noise on the Arduino's 3.3V output, so I figured it was because of the Arduino's voltage source. However, I then noticed that the noise only occurs when the IR sensor is connected.
3.3V output with sensor connected (positive spikes):
3.3V output without sensor connected:
I'm not entirely sure whether the voltage has noise or if it is possible that the Arduino's ADC is measuring incorrectly. I wasn't sure what to google.
What could be causing this noise and how can I fix it? (A low-pass filter didn't seem to work on the sensor measurement - I guess an external 5V source will probably be necessary?)
serialPlotterTest.ino.ino (219 Bytes)