I'm hoping someone can help me. I need an IR reflective sensor that will be able to detect a piece of reflective tape on a piece of rope in the dark about 4 inches away. It also needs to have a quick response time to turn on an led when it detects the light.
TCRT5000 is a IR sensor that you can use for that, sensor dis. 12mm, for more info about that model you can search arduino forum or google, if you wana buy it you can search ebay.com or aliexpress.com
There's a lot of info on the Vishay website (Keyword and Part Number Search Results | Vishay) - there may be something here you can use, or maybe contact them and ask? I'm looking at the TCRT5000 myself, so far the shiniest thing I've used is a mirror, which gives me a range of about an inch which is a tad short of your needs.
I've knocked up a sketch to use for test purposes, reproduced below. I have a word document with my test results so far in it, I've attached that in case its useful but with a caveat that these are my own notes, not meant to be nice and tidy for others to use!
/* IRSensor
Try the Infred Sensor TCRT5000 (Probably works with other sensors as well)
Turn and LED on/off in response to sensor input
V01 Use "Delay" for simplicity while testing concept
RESULT: Detection does not seem to work, emitting Ok (use digital camera to check!
V02 Try Analogue instead of digital input, use a threshold instead of High/Low
RESULT Value always 1022/1023, nothing in front of LED's (In digital mode was always = 0)
Same if I put 10k resistance either side of receiver part.
Goes down to 9nn if I remove +ve supply from collector, then goes up and down 38n - 7nn
Disconnect entirely - still get 3nn readinings on A0! (Noise -See Reference manual)
WHAT WORKS - Wire as common collector with 4k7 resistor, and invert threshold logic see IRSENSOR PROJECT.docx
Rewired as common emiiter (LED on, switched-off by sensor) and inverted code to suit.
*/
//GLOBAL DECLARATIONS +++++++++++++++++++++++++++++++++++++++++++
//Pin 0 reserved for serial communications
//Pin 1 reservedfor serial communications
//int sensorPin = 2; // Use pin 2 as input from the sensor
int sensorPin = A0; //Use pin A0 for analogue input
int outputPin = 7; // Use pin 7 for the output
int sensorValue = 0; // variable to store the value coming from the sensor
int sensorThreshold = 512; // Threshold above/below which check is made
int sensorPollTime = 500; //Poll interval for the sensor loop in milliseconds
long sensorPollPrev = 0;
// INITIALISATION +++++++++++++++++++++++++++++++++++++++++++++++++++++
void setup() {
Serial.begin(9600); //Initialise serial communication
pinMode(outputPin, OUTPUT); // declare the ledPin as an OUTPUT:
// pinMode(sensorPin, INPUT); //Declare sensorpin as input
}
// MAIN LOOP ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void loop() {
sensorValue = analogRead(sensorPin); // read the value from the sensor
if (sensorValue <= sensorThreshold) //Switch output on/off depending on result
{
digitalWrite(outputPin, HIGH);
}
else
{
digitalWrite(outputPin, LOW);
}
Serial.print("sensor value is "); //Tell me what the sensor value is
Serial.println(sensorValue);
delay (sensorPollTime); //Wait a bit
}
// END OF MAIN LOOP +++++++++++++++++++++++++++++++++++++++++++++++++++
Is there a way to use this type sensor to detect voids in a surface? The resolution would need to be mm not inches. I'm trying to figure out how to use say a sonar sensor to detect breaks or voids in a shingle roof. Any ideas on how someone may accomplish this?