📦Free shipping over $10 in most countries and regions!

How to use TCRT5000 infrared sensor?

The working principle of TCRT5000

TCRT5000 is a sensor based on the principle of infrared optical reflection, which contains an infrared light-emitting diode and a photosensitive triode.

When working, the infrared light-emitting diode of TCRT5000 continuously emits infrared (invisible light) with a wavelength of 950nm. When the emitted infrared is not reflected back by obstacles or the reflection intensity is insufficient, the photosensitive triode does not work. When the triode receives it, the photosensitive triode is in working condition and provides output. The collector current value Ic of the phototransistor is about 1 mA when it is working. The working range of TCRT5000 infrared sensor is about 0.2~15mm.

TCRT5000 Pin Connection


As shown in the figure above, you can adjust the resistance value between the negative electrode of the infrared light-emitting tube and GND (range 100~550 ohm) and the resistance value between the emitter of the photosensitive transistor and GND (range 5~20K) during debugging to make the test performance meet expectations.
For the TCRT5000 in my hand, setting 200 ohms and 10 K works better. How to judge the effect of adjustment? We need to connect the circuit shown above with Arduino, and use the serial monitor of the IDE to judge whether the debugging result meets expectations. Connect the OUT of the above picture to the A0 pin of Arduino UNO, connect +5V and GND, and upload the following code.

*Simple test of TCRT5000
int tcrt;
void setup(){
void loop(){
tcrt = analogRead(A0);
analogWrite(13,tcrt/4); //Because the range of analogWrite is 0~256, the A0 value read here is divided by 4.

Then monitor the working status through the serial monitor. The code will output the analog value read on the A0 pin every 150 milliseconds (range: 0~1024). At the same time, the on-board led light of the Arduino UNO will feedback the circuit's real-time working status by changing the brightness.

Since the output value of the sensor is very different when the infrared ray hits the white surface and the black surface at the same distance, according to this feature, we can use TCRT5000 to do many tests.
For example, to use it to measure the speed of a motor, we can put a white paper plate on the shaft of the motor, and then draw a black line with a black marker. TCRT5000 can read the value returned by the black and white line, so that we can calculate it. The speed of the motor is also the principle of motor speed measurement.



If you need TCRT5000 Optical Sensor:

👉 TCRT5000 Optical Sensor(2pcs)

👉 TCRT5000 Optical Sensor(10pcs)

More Electronic Component,welcome to HALJIA!