KY-033 Line Tracking Sensor Module

The KY-033 Line Tracking module is an infrared sensor that detects whether the surface in front of it is reflective or opaque. Sensitivity to ambient light can be adjusted using the knob to achieve a fairly accurate reading.

This sensor is typically used on wheeled robots and can operate at 3.3V to 5V which makes it compatible with a variety of microcontrollers like Arduino, ESP32, Raspberry Pi, ESP8266, Teensy, and others.

KY-033 Line Tracking Sensor Module Fritzing Part
KY-033 Line Tracking Sensor module

KY-033 Specifications

On the front side, this module has an infrared emitter/receiver, an adjustable potentiometer, a LM393 differential comparator, and an indicator LED. The back side has 4 resistors, two of which are 10 kΩ, one is 1.5 kΩ and the other one is 220 Ω.

The KY-033 has 3 pins: GND, OUT, and VCC. The output pin of the module is digital, its state is HIGH when the module is on top of a black surface, signaling that a line is detected. The state is LOW when the module is on top of a white surface, signaling that a line is not detected.

The indicator LED turns on when the infrared light is reflected back to the receiver, meaning that a line is not detected.

Working voltage 3.3V — 5.5V DC
Output signal TTL level (high level if line detected, low if no line detected)
Board Size 1cm x 4.2cm [0.39in x 1.65in]

Connection Diagram

Connect the GND pin on the KY-033 to GND on the Arduino and the VCC pin to 5V. Then connect the OUT pin of the module (middle one) to pin 7 on the Arduino.

Keep in mind that some modules have a different pin configuration, always check your module before connecting it to the Arduino.

OUTPin 7
Arduino KY-033 connection diagram

KY-033 Arduino Code

In the following Arduino sketch, we’ll read the digital signal from the output pin of the KY-033 every 500 milliseconds, and use the serial interface to send messages to the computer.

The signal will be HIGH when the module is in front of an opaque (black) surface, indicating that a line has been detected. The signal will be LOW when the module is in front of a reflective (white) surface, meaning that a line is not detected.

int sensorPin = 7;  // line detection sensor interface
int val;            // variable to store sensor reading

void setup() {
  pinMode(sensorPin,INPUT);  // define sensor as input  
  Serial.begin(9600);     // initialize serial communication with PC

void loop() {
  val = digitalRead(sensorPin); // read value from sensor
  if (val == HIGH) { 
    Serial.println("Line detected"); 
  } else { 
    Serial.println("Line NOT detected"); 


Use Tools > Serial Monitor on the Arduino IDE to see the results, make sure to adjust the transmission speed to 9600 baud.

Arduino KY-033 serial monitor output


Leave a Comment