Microbit SmartCar – Line Following


A line follower robot is a robot which follows a certain path controlled by a feed back mechanism from the line sensors. You can build a line following robot car using 2 sensor, 3 sensor or even upto 8 infrared sensors based on your need.

Working Principle of Line Follower Car

In this project, we have designed an Microbit based Line Follower Robot. The working of the project is pretty simple. Detect the black line on the surface and move along that line. The detailed working is explained here. We need infrared sensors to detect the line. For line detection logic, we used two IR Sensors, which consists of IR LED and Photo diode. They are placed in a reflective way i.e. side – by – side so that whenever they come in to proximity of a reflective surface, the light emitted by IR LED will be detected by Photo diode. In case of black surface, which has a low reflectance, the light gets completely absorbed by the black surface and doesn’t reach the photodiode. Using the same principle, we will setup the IR Sensors on the Line Follower Robot such that the two IR Sensors are on the either side of the black line on the floor. When the robot moves forward, both the sensors wait for the line to be detected. For example, if the IR Sensor 1 detects the black line, it means that there is a right curve (or turn) ahead.


Uses of line follower robot car:

  • Line follower Robots are commonly used for automation process in industries, military applications and consumer applications.
  • Industrial Applications: These robots can be used as automated equipment carriers in industries replacing traditional conveyor belts.
  • They are very useful as they can work without any supervision i.e. they work as automatic guided vehicles etc and many more.

Assembly Instruction

Step-1: Insert the plastic hex connectors in 2 holes in the front side and screw it.

Step-2: Provide the connection between left and right IR Sensors as per the table and picture below

Left Side Right Side
 IR Sensor (Left) Microbit Car (Left)  IR Sensor (Right) Microbit Car (Right)
DO P15 DO P14
Vcc 5v Vcc 5v


Step-3: Connect the IR sensor to hex connector using the screws

Run your Code


Either copy and paste, or re-create the following code into your own MakeCode editor by clicking the “Edit” Option in the upper right-hand corner of the editor window. You can also just download this example by clicking the download button in the lower right-hand corner of the code window.


Step-4: Place the car in black line and switch ON and see it follow the line.


Leave a Reply

Your email address will not be published. Required fields are marked *