IR Receiver Question - vs1838b

Hi,

I bought some IR LED and receiver pairs from amazon.
I am planning on using these as basic RPM encoders.

To start with I have simply put 5V and GND across the LED and pointed it at a receiver. I have the output from the receiver connected to analogue pin 1 and am reading from the pin. I am receiving 1023 consistently (with the occasional fluctuation). I see no change if I place my finger in front of the LED or remove the LED.

Am I going about this the correct way? Any ideas?

Thanks Jack. (Arduino mega 2560)

const int sensorPin = A1;    // select the input pin for the reciever
const int ledPin = 47;      // select the pin for the LED
int sensorValue = 0;
float voltage = 0.0;

void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  sensorValue = analogRead(sensorPin);
  voltage = sensorValue*(5.0/1023.0);
  Serial.println(voltage);  
  if (sensorValue > 500)  //Random number - will fine tune later
  {
     digitalWrite(ledPin, HIGH); //Turn LED on when value high
  }
  else
  {
    digitalWrite(ledPin, LOW);
  }
  delay(100);
}

You have to send a signal of the required frequency, not a constant light. The receiver output is digital, not analogue.

First of all, with IR led, if you put your finger in front of it, the receiver keeps woring just fine.
You can put your IR led behind the receiver, it will "receive" the IR rays.

In your case you should, put an 220 or 330 ohms resistors between the IR led and the 5V from the arduino.

Then you should PWM your led and put the receiver in a digital pin.

Thank you both, I will give it a try.