Hi I recently got my arduino.
So now Im trying to read on IR sensor that I salvaged.
I made a circuit and tested the circuit with my voltmeter, it behaves as I would expect, without shining the IR led on the sensor my voltmeter reads about 0.25v then when I shine the IR led on it, it shoots upto 5V.
So now im trying to read the sensor from my arduino, but as soon as I connect the IR sensor to Analog0 the reading on the analog pin goes up to 900+ sometimes even 1024.
Im not sure what Im doing wrong, I would expect the reading to be something like 51. (5/0.25 = 20, 1024/20=51)
Also my IR sensor is in an plastic enclosure to reduce stray IR light interference.
This is the sketch im using, not much to it.
int analogPin = 0;
int val = 0;
void setup()
{
Serial.begin(9600); // setup serial
}
void loop()
{
val = analogRead(analogPin); // read the input pin
Serial.println(val); // debug value
delay(1000);
}
And this is my schematic
And this is a sample of some of the serial output, (not shining the IR led at the sensor)
995
1021
1019
1015
1014
1010
1000
983
972
940
940
941
944
945
951
950
953
965
971
985
998
1012
1011
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
981
982
994
862
1023
1023
I appreciate any help, Thanks.