Average of reading on IR sensor

jraskell:
Actually, a small cap on the power in for the Sharp sensor is recommended and often needed (on the order of a few tens of microfarads, ie 20-30uf). The sensor does not have a constant power draw, but a very spikey power draw (it pulses an IR LED, which are fairly high current LEDs), and a cap on the power line can help stabilize the entire sensor and provide a more stable output.

Well, there you go. :slight_smile: A stable power supply is always on the path to happiness. But putting a cap on the analog input on the arduino can also help alleviate spurious fluctuations.