The TCRT 5000 is an infrared (IR) sensor module that consists of an infrared emitter and a phototransistor paired together. It is commonly used for object detection and proximity sensing applications. The sensor works by emitting infrared light and detecting the reflected light using the phototransistor, allowing it to determine the presence or absence of an object within its detection range.
Pin Number | Name | Description |
---|---|---|
1 | VCC | Power supply (3.3V to 5V DC) |
2 | GND | Ground connection |
3 | AO | Analog output voltage |
4 | DO | Digital output (active low) |
Q: Can the TCRT 5000 detect the color of an object? A: No, the TCRT 5000 is not capable of detecting colors. It only detects the presence of an object based on reflected IR light.
Q: What is the maximum detection range of the TCRT 5000? A: The typical detection range is between 2mm and 10mm, but this can vary depending on the object's surface and the sensor's calibration.
Q: How do I adjust the sensitivity of the sensor? A: Sensitivity can be adjusted by turning the onboard potentiometer. Clockwise rotation generally increases sensitivity, while counterclockwise rotation decreases it.
// TCRT 5000 IR Sensor Example with Arduino UNO
const int analogPin = A0; // Analog output from the sensor
const int digitalPin = 2; // Digital output from the sensor
void setup() {
Serial.begin(9600);
pinMode(digitalPin, INPUT);
}
void loop() {
int analogValue = analogRead(analogPin); // Read the analog value
bool isObjectDetected = digitalRead(digitalPin) == LOW; // Check digital output
Serial.print("Analog Value: ");
Serial.print(analogValue);
Serial.print(" - Object Detected: ");
Serial.println(isObjectDetected ? "Yes" : "No");
delay(100); // Short delay before next reading
}
This example code reads both the analog and digital outputs from the TCRT 5000 sensor and prints the results to the Serial Monitor. The digital output is considered active when it is LOW, indicating that an object has been detected within the sensor's range.