S21TCRT5000

Line Tracker

Sees black versus white just underneath it. Robots use it to follow a line.

Loading 3D Drag to orbit · scroll to zoom · double-click to reset

Try it

Slide it over a black line on white paper

AO=300 DO=0 whiteAO=3500 DO=1 LINEAO=320 DO=0 whiteAO=3480 DO=1 LINE

The sensor faces the floor (bottom side). DO goes LOW over white, HIGH over a black line.

/*
  BuiltByTyler Sensor Kit - S21 LINE TRACKER (TCRT5000)
  Board: ESP32-WROOM-32 DevKit V1 (30-pin), Arduino-ESP32 core 3.x, "ESP32 Dev Module"

  Line sensor (faces the floor). DO is LOW over white and HIGH over a
  black line; turn the pot to set where it switches. AO helps you calibrate.

  Wiring (module pin -> ESP32 pin):
    GND  -> GND
    VCC  -> 3V3
    AO   -> GPIO 34
    DO   -> GPIO 4

  Library: none needed
  Serial Monitor: 115200 baud
*/

#define AO_PIN   34
#define DO_PIN   4

void setup() {
  Serial.begin(115200);
  pinMode(DO_PIN, INPUT);
}

void loop() {
  int ao = analogRead(AO_PIN);        // 0..4095, higher = darker surface
  int dout = digitalRead(DO_PIN);     // HIGH = black line, LOW = white
  Serial.printf("AO=%4d  DO=%d  %s\n", ao, dout, dout == HIGH ? "LINE" : "white");
  delay(200);
}

Not for sale yet. Planned price $79, shipping included. Join the waitlist and we'll email you once when the kit is ready. Nothing else.