TCRT5000 IR SENSOR Features
The TCRT5000 sensor consist of an IR transmitter and IR receiver. When the proper voltage is applied to the infrared transmitter, it transmits and emits infrared waves. When these waves collide with an object, the infrared receiver, which is a phototransistor, receives the waves. A phototransistor works like a normal transistor, except that its base is excited by light.
Note
This sensor works best for objects in the range of 0.2 to 1.5 cm.
You can download the datasheet of this sensor here.
TCRT5000 IR SENSOR Datasheet
1 file(s) 308.14 KB
TCRT5000 IR SENSOR Pinout
This sensor has 4 pins:
- Anode: + pin of IR transmitter
- Cathode: – pin of IR transmitter
- Collector: Collector pin of phototransistor
- Emitter: Emitter pin of phototransistor
Note
Infrared transmitter requires a voltage of about 1.2 V in order to be turned on. If the sensor supply voltage is not 1.2 (e.g. 5 volts), use a suitable resistor to reduce the voltage.
You can see the pinout of this module in the image below.
Required Materials
Hardware Components
Software Apps
Interfacing TCRT5000 Reflective Infrared Sensor with Arduino
Step 1: Circuit
The following circuit shows how you should connect Arduino to the TCRT5000 module. Connect wires accordingly.
Step 2: Code
Upload the following code to your Arduino.
/*
TCRT5000 Reflective Sensors
modified on 03 Oct 2020
by Mohammad Reza Akbari @ Electropeak
Home
*/
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delay(100);
}
The code output is as follows. If you put a white object in front of the sensor, the voltage will decrease.