kblox Neo+ Robotics Kit
About Lesson

Line Following Robot


Inline follower robots we have to use IR sensors. They are used for sending and receiving IR Rays. IR sensor transmits infrared lights. When infrared rays fall on a surface, it’s reflected back and received by an IR receiver which generates some voltage changes. When IR rays fall on a black surface, it is absorbed by the black surface and no rays are reflected back, thus IR Sensor does not receive any ray. In this project when the sensor senses a white surface then the Kblox Neo gets 1 as input and when senses a black line Kblox neo gets 0 as input.



Components required

  • Kblox Neo Board
  • Chassis
  • IR sensor [Qty-2]
  • BO motor [Qty-2]
  • Wheels 75mm [Qty-2]
  • Castor wheel
  • Screw-driver
  • Battery 9V
  • Battery clip
  •  A to B USB cable
  •  Jumper wires  [M-F, Qty-12]



kblox kit;

void setup() {
  // put your setup code here, to run once:
  kit.motor_begin(12, 11, 5, 3);     //define motor pins
  kit.ir_begin(8, 9);                 // define ir pins


void loop() {
  // put your main code here, to run repeatedly:
  int a = kit.ir1_read();           //read first ir data and store in variable a
  int b = kit.ir2_read();           // read second ir data and store in variable b

  if ((a == 1) && (b == 1)) {      //if both ir is high move forward

  if ((a == 0) && (b == 0)) {     //if both ir is low stop motor

  if ((a == 0) && (b == 1)){      //if right motor is high move left

  if ((a == 1) && (b == 0)) {      // if left motor is high move right 


  • Industrial Applications: These robots can be used as automated equipment carriers in industries replacing traditional conveyor belts.
  • Automobile applications: These robots can also be used as automatic cars running on roads with embedded magnets.
  • Domestic applications: These can also be used at homes for domestic purposes like floor cleaning etc.
  • Guidance applications: These can be used in public places like shopping malls, museums, etc to provide path guidance.