Sharp IR Problem with Pro Mini

I'm having a problem reading my Sharp IR range sensor with my Pro Mini 5v.

My code so far:

#define IR 2
#define sampleSize 10

long interval = 100;           // interval at which to blink (milliseconds)
long previousMillis = 0;        // will store last time light sensor was updated

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);

}

void loop() {
  // put your main code here, to run repeatedly:
 unsigned long currentMillis = millis();

  if(currentMillis - previousMillis > interval) {
    // save the last time you read the accelerometer! 
    previousMillis = currentMillis;

    // Main code here!
    
    int IRVal = sampleIRPin(IR);
    int IRValMap = map(constrain(IRVal,82,419), 82, 419, 0, 100);
    Serial.println(IRValMap);
   
  } 
  
}

int sampleIRPin(int IRPin)
{
  long reading = 0;
  analogRead(IRPin);
  //  Ignore first analog read
  delay(1);

  for (int i = 0; i < sampleSize; i++)
  {
    reading += analogRead(IRPin);
  }

  return reading/sampleSize;
}

My Pro Mini is on a breadboard with nothing else connected other than my 5v FTDI adapter. I'm also using a 10uF capacitor on the mains as the data sheet recommends. My readings are really unsteady and rarely rest at 0 which is what it should read when nothing is in sight. If I move the power for the sensor closer to the Pro Mini and not use the power rails of the breadboard, it gets slightly better but not a great deal. It seems the further away you move the positive and negative cables from the Pro Mini the worst things get e.g. reseting point being around the 20's. I've also tried switching analog ins just in case I had a dry joint, etc.

The strange thing is that I've loaded the same sketch onto my Arduino Uno using a breadboard and its perfect.