Sharp GP2Y0A02YK + cobra 2

Hi All, I am having trouble getting clean data out of this sensor.
I follow this guide:

and have created two methods in C#:

public void GetRange(ref double Range, ref bool Success, AnalogInput sensor)
            double Voltage = 0;
            const double MinVolt = 0.4;
            const double MaxVolt = 2.8;
            // This pin number is for a BX-24. The pin number may need to be changed
            // depending on the BasicX system being used.
            Voltage = sensor.Read();
            // Convert to voltage.
            Voltage = Voltage * 5.0;
            var r = VoltageToRange(Voltage);
            // Check for legal voltage.
            if ((Voltage >= MinVolt) & (Voltage <= MaxVolt))
                Success = true;
                Range = r;
                Success = false;
        private double VoltageToRange(double V)
            // Returns distance in units of cm.
            const double A = 0.0082712905;
            const double B = 939.57652;
            const double C = -3.3978697;
            const double D = 17.339222;
            // Curve fit.
            return (A + B * V) / (1 + C * V + D * V * V);

The values that I am getting seem to be in 15-80 range when the senor is meant to be 20cm-150cm range.
I have tried a 100uf Cap between the power and ground, and it doesnt seem to smooth out any of the values.
At 60cm constant distance, I am getting random values between 36 and 48, with or without the cap.
I have the sensor connected to a breakout board plugged into socket 9 of the extender which has a P0.12/AD6.
The guide says I should put a 470 ohm resistor on the signal list yet if I do is it will reduce the values converted even further?

Little help please anyone.

I have also grounded the casing

there used to be a good driver in codeshare.

I added a 470 ohm resistor on the signal line and it seems to have smoothed out out some.
now getting readings between 38 and 42.
anyone have any tips on getting it down to under a single unit?

You multiply with 5.0 (Voltage = Voltage * 5.0) doesn’t that need to be 3.3 (the range of your AD converter) You could also make a number of ad-samples and calculate the average to filter out some noise.

yeah 3.3 multiplier seems to give me semi correct values.
the noise seems to be worse if its close to or out of range (150cm+) however with a 100uf cap and 470 ohm resistor the values are close to correct.
I plug the 100uf cap straight into the JAG connector in the sensor itself.

@ growls - You should realize that the reference voltage of the AD converter comes from the regular 3.3 power supply and will also influence the quality of the measured signal. Some noise filtering with software could improve your results.