how to use KY-033 tracking sensor with Arduino

What is a tracking sensor, how tracking sensor works, and how to connect the tracking sensor with Arduino are some questions that may arise in your mind while working with the tracking module.

Hello guy! Welcome back to my blog today we are going to see about KY 033 tracking sensor so let’s begin.

What is the TCRT5000 sensor??

TCRT5000 is a tracking device used to know the presence of an object or obstacle in a path or calculate the distance of the object. The tracking device uses an Infrared transmitter TX (photodiode) and infrared receiver RX (photo-transistor) to emit and receive signals. Photo-diode is blue in color while the photo-transistor is black in color to avoid interference from external factors. Photo-diode transmitter has two pins anode and cathode whereas photo-transistor also has two pin collector and emitter, it does not have base terminal as it is driven by IR received signal at the receiver end. This tracking device is used for detecting the proximity of an object. We can only calculate the distance of an object within a limited range from 0.2 to 1.5 cm. this module gives a fast response. The accuracy may get affected due to external environmental light, dust, smog, and water vapor. The operating wavelength is 950 mm.

tracking sensor Arduino

How TCRT5000 tracking sensor works??

TCRT5000 sensor consists of an IR Transmitter photodiode and IR Receiver phototransistor. IR light is not visible to our eyes because of a longer wavelength than visible light. IR light is emitted by the IR transmitter when the object is present near then this light gets hit the object and gets reflected back towards the IR receiver. The light which is reflected is detected by the IR receiver.  The IR receiver which is a phototransistor does not have a base terminal. It is driven or controlled by light reflected by objects. I.e. IR light is responsible for biasing the base current of the photo-transistor.  TCRT5000 tracking module comes with both output analog and digital. If we only want to know whether the object is present in a path or not then we will use digital output. Digital pin gives output 1 or 0, if the object is present then it will show 1 and if the object is not present then it will show 0. If we want to measure the distance from the object then we will use Analog output.  The potentiometer is used to adjust the sensitivity. We can set predefined values which can vary using a potentiometer. The comparator compares both values i.e. value of the IR receiver and the predefined value set by the potentiometer. Module has LM393 comparator. If the value of the IR receiver signal is less than the predefined value then the sensor will give digital output as 0 or LOW and if the value of the IR receiver signal is greater than the predefined value then the sensor will digital output as 1 or HIGH.

tcrt5000 tracing module

If we set the sensor to higher sensitivity or increase the sensitivity then the sensor can detect or sense even smaller sounds. As discussed earlier we can set sensitivity through a potentiometer. Also if the value of the received IR signal increases, the analog output also increases, and if the value of the received IR signal decreases, the analog output also decreases. By rotating the knob of the potentiometer clockwise or anti-clockwise, we can change predefined values or adjust the sensitivity of the sensor. When the signal received at the receiver is more due to reflection after colliding with the obstacle then resistance is less and if the signal received at the receiver is less then resistance is more. We can also use a tracking sensor for making line follower robots or cars. If we place the black color strip in front of the IR sensor then as we know black color absorbed the light, therefore, less light will get reflected towards the receiver hence resistance will be high so the on-board LED will be OFF and the output voltage will be low and If we place the white color strip in front of IR sensor then as we know white color reflects the light, therefore, less light will be absorbed and more light gets reflected towards receiver hence resistance will be LOW and the output voltage will be HIGH on-board so LED will be ON.

Application of tracking Sensor

  • Proximity detection
  • Obstacle detection
  • For calculation of the distance of the object
  • Line follower robot or contrast sensors 
  • Automatic Door Opening
  • Burglar Alarm & Security
  • Counting object 

Specification of TCRT5000

  • Operating Voltage - 5V
  • Diode forward Current - 60mA
  • Operating temperature - 25°C to +85°C
  • Transistor collector current - 100mA (maximum)
  • Output - both Analog and digital output

Circuit Diagram

Arduino infrared tracking

The KY-033 sensor has four pins (Analog Output, Digital Output, Ground, and VCC). A photodiode, photo-transistor, LM393 comparator, and potentiometer. The tracking module has two built-in LEDs. One LED indicates the sensor board module is in an ON state and another LED indicates the signal received by the sensor. The sensor has current limiting resistance and the second 10k resistance is grounded for the transistor. 

Connect the ground pin of the KY-033 sensor to the ground pin of Arduino, Analog pin to A0. VCC pin to 5v and Signal pin to 8. Also, connect the positive lead of LED to Arduino pin 11.

Code -

int trackingsensor = 8; 
int ledPin = 11;
int sensorvalue;
void setup()
{
  pinMode(trackingsensor, INPUT); 
  pinMode(ledPin, OUTPUT); 
  Serial.begin(115200);
}
void loop()
{
  sensorvalue = digitalRead(trackingsensor);
  Serial.println(sensorvalue); 
  if(sensorvalue == LOW) 
  { 
    digitalWrite(ledPin, HIGH);
    Serial.println("Objected detected"); 
  }
  else
  {
    Serial.println("No Objected detected"); 
  }
  delay(500);
}

First, initialize the pins of the tracking sensor & LED. We have declared a variable name sensor value. In the void setup, we configure pins as INPUT or OUTPUT. We want to read values from the tracking pin so we will declare it as INPUT and LED as OUTPUT. We also configure the baud rate to 115200.

In the void loop, we continuously read values from the tracking sensor and store values in variables. if we place an object close to the tracking sensor then the output we get is LOW. here we used LED which gets turned ON when output is LOW & gets turned ON when output is LOW. we know that black color absorbs light and white color reflects the light. when the black color object is placed near the tracking sensor as it absorbed light, no light is reflected so the output of the sensor is HIGH and when an object with white color is placed near the tracking sensor as they reflect light the output of the sensor is LOW. 

OUTPUT -

ir tracking sensor

Arduino infrared tracking

Now we used the serial monitor to observe the output. To open up the serial monitor, click on Tools > Serial Monitor or use the shortcut (SHIFT + CONTROL + M). Here you can see in the Serial monitor when there is no object present near the tracking sensor the digital output will be 1 serial monitor will display "NO object detected". But when we place an object near the tracking sensor then the digital output will be 0 and the serial output will be shown the object detected. We can adjust the sensitivity by rotating the potentiometer in the clockwise or anti-clockwise direction.

 Conclusion - 

Today we learn about what is Arduino tracking sensor, how to use a tracking sensor with Arduino, the application of the tracking sensor & working principle of the tracking sensor. tracking sensors have wide applications in obstacle detectors, range finders, calculating distance, finding objects, etc. tracking sensors are mostly used in IoT applications.


"I hope you find this IOT blog very helpful to you. In the upcoming lesson, we will see more about IoT sensors till then bye. See you all in my next blog."

Close Menu