Line Detection Sensor
STM32-Experiments Free Updated Sep 26, 2026

Line Detection Sensor

Line Detection Sensor

Introduction

Autonomous line-following robots, a common project in robotics competitions, rely entirely on exactly this kind of sensing to know whether they are still tracking their intended path. In this experiment, an infrared line-tracking sensor module is wired to the STM32F070RB as a simple digital input, and the microcontroller reports over UART whether it currently detects the line beneath it.

2. Scope

This experiment covers understanding how surface reflectivity differences, a dark line against a light background or the reverse, are detected using infrared reflectance sensing, and reading the sensor's digital output. This is a straightforward digital sensor reading, forming the fundamental building block a full line-following robot would extend into a multi-sensor array.

3. Prerequisite

3.1 Hardware

  • STM32 Nucleo-F070RB development board

  • IR line-tracking sensor module, single channel, digital output

  • A test surface with clear light and dark contrast, such as a black line drawn on white paper

  • Breadboard and jumper wires

  • Micro-USB cable

  • PC with PuTTY

3.2 Software

  • STM32CubeMX (standalone)

  • STM32CubeIDE

  • ST-LINK USB driver

  • PuTTY, or an equivalent serial terminal application

Community Q&A

0 questions

Ask questions and get answers from our community and staff moderators.

No questions yet — be the first to start the conversation!

Ask a Question

Please log in to ask a question or post a reply.

Login to Participate