🛒 Arduino, ESP32 & modules

Distance, Line, Motion

Distance, line and motion sensors — HC-SR04 and JSN-SR04T ultrasonic sensors, HC-SR501 PIR motion sensor, TCRT5000 line-following and obstacle-avoidance IR modules. For robots, parking sensors, automatic lighting and security projects.

Distance, Line, Motion — buying guide

The Distance, Line, Motion category is for robots to "see" their surroundings and for devices to detect human presence. Here you’ll find ultrasonic distance sensors, infrared line and obstacle modules, and PIR motion sensors.

Which one to choose?

  • Measuring distance: HC-SR04 measures between 2–400 cm. For humid and outdoor environments, JSN-SR04T with a waterproof head is more suitable, but it cannot see closer than 25 cm.
  • Distance readout without coding: The control panel shows the HC-SR04 reading on a digital display.
  • Obstacle detection: The infrared obstacle sensor detects nearby objects but does not output the distance numerically.
  • Line: KY-033 and the TCRT5000 module distinguish a black line from a light background.
  • Human motion: HC-SR501 outputs a signal to the board pin; its sensitivity and delay are set with a trimmer screw. HY-3612 is a switch that works from 12–24 V.

Compatibility

  • HC-SR04 runs at 5 V. Connect its Echo output to 3.3 V boards like ESP32 or Raspberry Pi through a voltage divider.
  • Infrared sensors can give false readings under strong sunlight and on shiny black surfaces.
  • Ultrasound reflects poorly from soft fabric and curved surfaces, so such objects may appear farther away.
  • PIR cannot see through glass. It reacts to changes in heat, so wait about a minute for it to stabilize after powering up.

Typical projects

  • Obstacle-avoiding robot: HC-SR04 and a motor driver.
  • Line-following robot: two or three line sensors.
  • Parking distance indicator for a car.
  • Stairway light that turns on when motion is detected.

Related categories

HC-SR04 or JSN-SR04T?

For indoor use and robots, HC-SR04 is sufficient. For water tanks, outdoor or dusty environments, choose JSN-SR04T, but keep in mind it cannot measure at short distances.

Why does the PIR sensor trigger when there is no motion?

Most of the time the sensor has not yet stabilized, there is noise in the power supply, or there is a flow of warm air nearby. Place the sensor away from heaters and reduce its sensitivity.