Skip to main content

Case 27 The Smart Line Following Car

Introduction

This course will take students to build a line following car that will enable the vehicle to follow a black line using the Nezha Inventor's Kit V2 and dual line following sensors. Through this project, students will learn about the working principles and applications of line following sensors, develop problem solving skills and creative thinking, and learn about the use of robotics in automated navigation.

Teaching Objectives

  • Learn about the working principle and signal output of the dual line following sensor.
  • Learn how to build the mechanics of a line following car and integrate the dual line following sensors into the bodywork.
  • Learn how to program a line following car to follow a black line in response to sensor signals.
  • Develop students' teamwork, creativity and problem solving skills.

Teaching Preparation

Nezha Inventor's Kit V2

Teaching Process

Introduce

Introduce students to the background and objectives of making a smart line following car to stimulate their interest and curiosity.

Have you ever watched a robot or cart travel along a black line? Have you ever wondered how these robots know to follow the black line? This brings us to the working principle of the line following sensor. The line following sensor detects the black line and tells the trolley which direction to travel by sending a signal.

In this course, we will take a closer look at how the two-way line following sensor works and apply it to the construction of a line following car. We will build the mechanics of the it step by step, attach the dual line following sensors to the car and learn how to program the car to automatically follow the black line in response to the sensor signals.

Exploration

Discuss in small groups and get students thinking about how to make a smart line following car out of building block materials.

  • What is the two-way line following sensor? How does it work? How can the signal be output by detecting the black wire?
  • How do you build the mechanics of the line following car? How do you integrate the two-way line following sensor into the body?
  • How do you program a line following car to follow a black line in response to a sensor signal?
  • How will the rover make decisions and adjust its direction of travel when multiple or intersecting black lines are encountered?
  • How can the performance of the rover be tuned and optimised so that it can follow the black lines consistently?

Practice

Work in groups to create a smart line following car from building block materials according to your own design.

Build a smart line following car from building blocks according to your own design.

Examples

Assembly Steps

Completed

Hardware Connection

Connect the line following sensor to the J1 and the motors to the M1 and M4 connectors of the Nezha expansion board.

Programming

Go to makecode

Create new projects

Click extensions

Search with PlanetX to download the package.

Search with nezha to download the package.

Code

Link: https://makecode.microbit.org/_3EV1ULio68sq

You may download it directly:

Demonstration

Presented in groups, students test, tune and optimise their robots to improve the accuracy and stability of their patrols, comparing the results and effectiveness of each group.

Result

The trolley travels along the black line.

Reflection

Share in groups so that students in each group can share their production process and insights, summarise the problems and solutions they encountered, and evaluate their strengths and weaknesses.