Electronic – arduino – Sharp IR distance sensor outputting consistently high voltage


I am on a steep learning curve, and a bit bamboozled by my sharp distance sensor (data sheet). I am building a project with two distance sensors that signal an Arduino to operate a servo motor when an object comes into range. This currently works well, except that the sensors are outputting a relatively high voltage all the time, so I have to set a very high cutoff voltage in the Arduino code, or the motor is triggered all the time – eg both sensors are giving the Arduino numbers like 350-450 via the analog Read command (which should be about 1.7 – 2.1V as far as I understand it) all the time. This means that if I set a cutoff of 550 or 600, the setup works, but only if an object is within 12cm of the sensor (which should be able to detect objects as far away as 80cm). The sensors are not optically interfering with each other.

I am using an old computer ribbon cable to connect both sensors to the Arduino and I am suspicious that this is somehow causing noise in the output voltage, but the Arduino never seems to be read values less than about 300 (1.4V), and I would have expected noise to give some low readings sometimes. Any help would be greatly appreciated. I tried posting a circuit diagram, but as a guest user, the site won't let me. Also, I'd post the code, but it is embarrassingly messy. The Arduino and the servo have separate power sources with common ground, the sensors are powered from the regulated 5V Arduino supply, and connected to separate analog pins.

<code>circuit diagram</code>

Best Answer

If your power supply is indeed the issue, then add a simple low pass filter in your power supply connections as close to the sensor as possible. I'd start with the following configuration to see if it improves the situation. Double check if Vcc at the sensor is 4V5 - 7V.


simulate this circuit – Schematic created using CircuitLab

Assuming that the device is powered by Arduino's 5V and assuming that the device is drawing 30mA of current, the voltage accros R1 will be 0.3V and the supply voltage for the sensor will be 4.7V, sufficient according to the datasheet. R1 and C1/C2 form a simple low pass filter that will suppress high frequency noise from the power supply.

Keep wires as short as possible, keep them as close together as possible. If possible twist the wires for the power supply and twist the wires (V(out) and GND) for the output.