IR Detector/Phototransistor (QRD1114) has very low values and little sensitivity

I'm trying to use the QRD1114 IR Optical Detector/Phototransistor to detect nearby objects with an arduino uno. I set up the circuit on my breadboard like the example here, connecting the output to analog pin 0 and using 220 and 4.7k resistors.

When I try to read the output I get a constant stream of "27"s, which go down to 26/25 if I bring an object (white piece of paper, my finger, etc) within a mm or two of the sensor.

The code I'm using is:

const int switchPin = 2;  
const int ledPin = 7;
const int irPin1 = A0;

void setup() {
  //initialize LED
  pinMode(ledPin, OUTPUT);
  //turn on LED
  digitalWrite(ledPin, HIGH);
  
  //initialize microswitch
  pinMode(switchPin, INPUT); 
  
  //don't start until switch pushed
  while(digitalRead(switchPin) == HIGH) {  }
  
  Serial.begin(9600);

  pinMode(irPin1, INPUT);
}

void loop(){
  Serial.println(analogRead(irPin1));
  delay(200);
}

I should be reading values up to 1000 and be picking up objects at least a cm or two away from the sensor. I tried the exact same setup with a second sensor of exactly the same type and tried a different analog pin. Any ideas what might be going wrong?

Are you sure you have the right pins? Looks like the only marker is a tiny dot near pin 1.

Here is the datasheet:
http://www.fairchildsemi.com/ds/QR/QRD1114.pdf

As far as I can tell, yes. The dot, the writing on the side, and the lighter/darker sections all match with the image of the circuit I linked to above.

Try replacing the 5K6 resistor with a much higher one say 100K. Also you can reduce the 200R to 100R to get more light output.

I tried increasing the larger resistor and decreasing the smaller one. My normal value lowered to 23 and still went down to only about 20 when objects were really close. The only difference I noticed is that it did appear to notice a white piece of paper at a bit over .5 cm away, instead of a mm or two, but it still doesn't register my finger until I'm almost touching it.

Call me crazy, but I'm thinking that the output transistor should be configured as emitter-follower.
[The object being some sort of proportional ("ratiometric") output, otherwise I'd go with saturating the output and taking the output from the collector pulled high - common emitter.]

A lot will depend on the IR reflectivity of whatever is under test.

See attached.

QRD1114_EF-out.JPG

To OP, show your drawings, whatever example in data sheet may be not the same with your wirings, otherwise everybody guessing. For example, advise to increase or decrease the value of resistor connected in series with photo-transistor, depends how you stuck them, resistor in collector or in emitter? Looks for me like in collector, and transistor is greatly saturated, which means reverse your action - lower resistor in collector and increase in series with photo-diode.

If you are only getting a reading of 27 in that arrangement, then the transistor is saturating because the resistor that you think is 4K7 is in reality a much higher value [or you have a very high level of background IR]. Check it with a multimeter and/or post a photo of your wiring in which the resistor colours are clear..

"A lot will depend on the IR reflectivity of whatever is under test." -yes!

without knowing exactly what you're trying to accomplish with the Fairchild chip, a few comments, stream of consciousness.

First, you are building a system that is a combination of noise, "photon budget," sensitivity, and ADC.
In other words, there's more than electronics involved here. SO, if you can up your IR led output, that's an easy way to cheat
on this design. High power leds are available low cost on ebay - you can buy up to 10W led sources there. You can effectively increase the income on your photon budget 100x that way.

Another way to cheat is to buy something like a opt101p
integrated photodiode plus opamp IC for $15-20. Some highly paid engineer spent a year designing that thing.

yet another approach is to connect a low-cost op amp (741) to the phototransistor. If you increase that 1M feedback pot to 10 Megohm, it will be more sensitive.

Others more familiar with the arduino may have shortcuts on all this.

The transistor's max current is at ~40mils distance from the reflective surface.. see fig.5 of the datasheet..

Thanks all for the suggestions! It actually turns out that something appears to be wrong with several of my analog pins (when I originally tried using a different pin I also picked a defective one). It seems to be working much better now that I found one that is actually working correctly.