Skip to main content

Case 26 The Obstacle Avoidance Car 2


In this course, we will work together to build a smart obstacle avoidance vehicle, using the Nezha Inventor's Kit V2, an ultrasonic sound sensor and the technology of a tiller to control steering. We will learn how the ultrasonic sound sensor works and understand how it helps the robot to sense its surroundings, as well as explore the knowledge points of the car's front axle structure to enable the vehicle's steering function. Through this project, we will develop creativity, problem solving and teamwork skills while learning about the application of robotics and the principles of mechanical construction.

Teaching Objectives

  • Understand how ultrasonic sound sensors work and their application in robotics.
  • Understand how a servo works and the principles of steering control.
  • Master the basic methods and techniques of building a robot using the Nezha Inventor's Kit V2.
  • Learn to write programs to enable the robot to avoid obstacles and implement steering functions based on data from the ultrasonic sound sensors.
  • Develop creativity, problem solving and teamwork skills.

Teaching Preparation

Nezha Inventor's Kit V2

Teaching Process


Introduce students to the background and objectives of making the Smart Obstacle Avoidance Car to stimulate their interest and curiosity.

Do you often encounter situations where you need to make a turn, such as when driving a car where you need to control the steering wheel to make a turn? Today, we will explore an interesting technology, a smart obstacle avoidance car that uses a steering wheel to control steering. This vehicle will be able to automatically detect obstacles ahead and avoid them by steering the front wheels with a tiller control. We will use ultrasonic sound sensors to sense the distance ahead and a tiller to control the steering of the vehicle.

In this project we will learn how an ultrasonic sensor works, how it emits ultrasonic waves and measures the return time to calculate distance. We will also learn about the structure of the front axle of a car and understand how steering works and how a tiller works. By applying these points to a practical project, we will be able to create a smart obstacle avoidance vehicle and program it to automatically avoid obstacles and steer.

Let's explore how ultrasonic sensors work and the structure of a car's front axle, get creative, solve problems and have fun making a smart robot! Are you ready? Let's get started!


Discuss in small groups and get students thinking about how they can make a smart obstacle avoidance car using block materials.

  • How does an ultrasonic sensor work? How does it measure distance?
  • What is the tiller? How does it work? How can the tiller be used to control the steering of the vehicle?
  • What is the front axle structure of a vehicle? What role does it play in the steering of a vehicle?
  • How can the ultrasonic sensor be combined with the Nezha Inventor Kit V2 to enable the robot to detect obstacles ahead?
  • How can the robot be programmed to make appropriate movements to avoid obstacles based on the data from the ultrasonic sensors?


Work in groups to create a smart obstacle-avoidance car from block materials according to your own design.

Follow your own design to create a smart obstacle-avoidance car out of building blocks.


Assembly Steps


Hardware Connections

Connect the ultrasonic sensor to the J1, the motor to the M1 and the servo to the S1 connector of the Nezha expansion board.


Go to makecode

Create new projects

Click extensions

Search with PlanetX to download the package.

Search with nezha to download the package.



You may download it directly:


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


When there is an obstacle in the way of the trolley, the trolley will turn to travel.


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.