What’s around me?

Part of:

Code Smart

Encounter Edu offers a classroom bundle for Code Smart Ages 11-14 which contains everything you need to get started with coding and robotics in your classroom.

Visit the store

Lesson overview

In the fourth lesson of this unit of work, your class will learn about obstacles and sensors. They will discuss the risks that a smart city presents, focusing on the challenges that an autonomous vehicle faces while navigating in the real world. They will then learn about the ultrasonic sensor on board the mBot and how to use it to avoid obstacles. Finally, they will think about how driving speed can influence a vehicle’s ability to react to obstacles.

Learning outcomes

  • Describe what smart cities are and give examples of smart city initiatives
  • Describe risks for autonomous vehicles in smart cities
  • Describe how an ultrasonic sensor functions
  • Apply code and sensor output to navigate around an obstacle
  • Debug programs
  • Identify and share ways of solving problems

Lesson steps

  1. Video opener (5 mins)
    An introduction to smart cities and risk. The video will set this lesson’s challenge: to get the robot to notice and react to obstacles.
  2. Classroom discussion (10 mins)
    Students will discuss the video. What risks can they think of that their autonomous car will need to notice and avoid?
  3. Make (25 mins)
    Introduction to the ultrasonic sensor hardware and how to control it with code. students should code the robot to stop when it detects an obstacle, then react and manoeuvre around obstacles of known and unknown sizes.
  4. Test (10 mins)
    Test the robot moves as expected. Does it react in time or crash into the obstacle?
  5. Reflect (10 mins)
    Students will reflect on their learning, including problems they had and how they solved them. Does how quickly your robot drive have an effect on how good it is at this challenge?

Equipment required (per group)

  • mBot
  • Laptop or tablet with mBlock
  • Boxes or other materials to use as obstacles, e.g. buildings, fallen trees or gates