TINKER PiEDESIGN IN INDIA

Line Follower 5

Smart Bricks · SKU TP-B02

Five IR sensors in one bar – build a fast line-following robot in minutes.

₹499

Pre-order

Works with TinkerPie V1 · same JST-PH cables as the board · Delivery across India: ₹100, 3–7 days · 7-day replacement for damaged or defective kits

About this kit

Line Follower 5 is a bar of five reflective IR sensors for line-following robots. It gives the position of the line directly, as a number from -100 (left) to +100 (right), works on black or white lines after a one-line calibration, and shows on five red LEDs which sensor sees the line. Two bars can be used on one robot.

Features

Specifications

Size56 x 32 mm
Sensing height1-3 mm above the floor
Voltage3.3 V
InterfaceI2C 0x34-0x35
BrainCH32V003

How to use it with TinkerPie

  1. Connect the brick’s BUS IN to any TinkerPie SENSOR 1-4 port with a 4-pin JST-PH cable.
  2. More bricks? Plug the next one into BUS OUT (or use the I2C Hub).
  3. Install the TinkerPie and TinkerPieBricks Arduino libraries, open the sketch below, choose the board ESP32S3 Dev Module and upload.

Libraries: TinkerPie and TinkerPieBricks (Arduino IDE: Sketch → Include Library → Add .ZIP Library). Full guide: getting started with TinkerPie Bricks.

Quick start

Upload this, open the Serial Monitor at 115200 baud and watch the TinkerPie matrix.

Quick-start sketch (Arduino C++)
// Line Follower 5 (TP-B02): quick start
// Reads the brick and shows the value on the TinkerPie matrix and in the Serial Monitor (115200 baud).
#include <TinkerPie.h>
#include <TinkerPieBricks.h>
using namespace tinkerpie;

tpb::Line5 line;

void setup() {
  Serial.begin(115200);
  tinkerpie::begin();            // also starts the SENSOR ports (I2C bus Wire1)
  if (!line.begin()) Serial.println("Line Follower 5 not found at 0x34: check the cable to SENSOR 1-4");
}

void loop() {
  int8_t pos = line.position();     // -100 (left) .. +100 (right), NO_LINE when lost
  basic::clearScreen();
  if (pos != tpb::Line5::NO_LINE) for (int y = 0; y < 5; y++) led::plot(map(pos, -100, 100, 0, 5), y, Colors::Green);
  Serial.println(pos);
  basic::pause(50);
}

Project: Line-following robot

The Line Follower 5 bar under a two-wheel robot. Press A to calibrate (the robot spins over the line for 3 seconds), then it follows the line.

Line-following robot (Arduino C++)
// Line-following robot: Line Follower 5 (TP-B02)
// The Line Follower 5 bar under a two-wheel robot. Press A to calibrate (the robot spins over the line for 3 seconds), then it follows the line.
#include <TinkerPie.h>
#include <TinkerPieBricks.h>
using namespace tinkerpie;

tpb::Line5 line;
const float KP = 0.5;              // steering strength

void setup() {
  Serial.begin(115200);
  tinkerpie::begin();            // also starts the SENSOR ports (I2C bus Wire1)
  if (!line.begin()) Serial.println("Line Follower 5 not found at 0x34: check the cable to SENSOR 1-4");
  basic::showIcon(IconNames::ArrowDown, Colors::Yellow);
  while (!input::buttonIsPressed(Button::A)) basic::pause(10);
  line.calibrateStart();
  motors::tank(-40, 40);
  basic::pause(3000);
  motors::stop();
  line.calibrateStop();
  basic::clearScreen();
}

void loop() {
  int8_t pos = line.position();          // -100 left .. +100 right
  if (pos == tpb::Line5::NO_LINE) { motors::tank(-30, 30); return; }   // lost: turn to find it
  motors::tank(45 + KP * pos, 45 - KP * pos);
  basic::pause(10);
}

More TinkerPie Bricks

IO-4 Smart Brick (TP-B01)IO-4 Smart BrickTP-B01Connect any analog or digital sensor to TinkerPie – 4 ports, each analog, digital or PWM.₹499Pre-orderUltrasonic Brick (TP-B03)Ultrasonic BrickTP-B03HC-SR04 distance sensor made safe and simple – distance in mm over one cable.₹499Pre-order5V Sensor Brick (TP-B04)5V Sensor BrickTP-B04For the 5 V parts: gas sensors, 5 V PIR, relays and fans – powered from a servo port.₹499Pre-orderServo-16 Brick (TP-B05)Servo-16 BrickTP-B05Drive 16 servos for robot arms, legs and animatronics.₹499Pre-order

See all 53 TinkerPie Bricks