← Back to Library
Lesson PlanFreeEN

CyberPi: Intelligent Vehicles

In this lesson students will explore the concept of intelligent vehicles in modern society. They will understand the role of data in intelligent vehicles and how to control the vehicles.

Gr. 7–8
CyberPi: Intelligent Vehicles

Lesson

Overview

Description

In this lesson students will explore the concept of intelligent vehicles in modern society. They will understand the role of data in intelligent vehicles and how to control the vehicles.

Objectives

  • Identify the roles and importance of data in intelligent vehicles.

  • Describe the working principles of autonomous lane keeping and Internet-based navigation systems in intelligent vehicles.

  • Use mind maps to visualize how an intelligent vehicle project should be.

  • Include functions in programs to simulate autonomous lane keeping and an Internet-based navigation system.

Before the Lesson

Preparation

For the teacher and students:

  • Computer with mBlock 5 installed from here: https://www.mblock.cc/en/download/ or mBlock Web version

  • Wi-Fi connection to student devices for IoT connectivity

  • This lesson does not require CyberPi as we will be using keyboard controls

  • Computer microphone use is required

Example program(s): CyberPi – Lesson 7 - Intelligent Vehicles

For students:

  • Proficiency in block-based coding

  • Prior knowledge of CyperPi's major features

Review

Warm Up

Objective: 

  • Introduce intelligent vehicles and their applications to students. Have them understand the difference between intelligent vehicles and conventional vehicles. And encourage students to consider the roles of data in intelligent vehicles.  

Procedures:

  • Introduce intelligent vehicles: Intelligent vehicles adopt intelligent driving systems, which include Internet-based navigation, autonomous driving and human intervention. Internet-based navigation systems help cars decide the best routes to their destinations. Autonomous driving technologies detect road scenes, including the status of traffic lights, road signs and more, based on which the vehicles make decisions.The vehicle may call for human intervention under certain conditions, requiring the driver to take over command and make decisions based on the instructions given by the intelligent system.

  • Summarize the practical application: Countries around the world invest plenty of resources in developing intelligent vehicles. That's not only because intelligent vehicles can make people's life more convenient, but also reduces safety risks by detecting road scenes and autonomously avoiding obstacles. In addition, the development of intelligent vehicles can significantly reduce energy consumption and greenhouse gas emissions, eliminate traffic congestion, and improve social efficiency. 

  • Ask: The use of data is essential in developing intelligent driving systems. Please bear this question in mind throughout the following sessions: How do lane-keeping and navigation use data? 

  • Have students note down the question on paper or on the computer so that they can keep thinking about it. 

Direct Instruction

Tour of mBlock 5

1. Open the mBlock software or mBlock 5 Web version.

2. Introduce students to the following key areas of the software interface:

Connect the CyberPi

3. Plug the CyberPi into the computer using the included cable. The CyberPi should boot up and the screen will display either the last program uploaded or the Home menu.

4. On the "Devices" tab in mBlock, click the "Add" button. Select CyberPi and click "Ok".

5. Click the "Connect" button. Then, select the USB port and click "Connect".

6. If connected successfully, the button will change to "Disconnect".

Guided Practice

Hands On

Objective:

  • Show students what  the project should be like and encourage them to consider how to achieve the effects to improve students' independent and creative thinking skills.

Procedures:

  • Introduce the project: In the picture, we see an intelligent vehicle. People could just say where to go and the vehicle will receive the oral command and start planning the best route to the destination. Without human intervention, the vehicle just automatically drives to the destination. 

  • Ask: How do we use mBlock to make an intelligent vehicle? What intelligent features should the vehicle have? 

  • Summarize: Based on your answers, the functionalities could be categorized as:

o   Lane-keeping

o   Positioning 

  • Work with students to make a mind map to visualize the functionalities.

Independent Practice

Try It

Objective:

  • Give students freedom to explore further, so that they can enhance their programming skills.

 Procedures:

  • Add the extension Cognitive Services in mBlock to give your vehicle the speech recognition ability.

  • This can be found by pushing extension then Sprite Extensions in the bottom left corner of the Block Area

Set up the starting point:

Retrieve destination information:

  • To recognize the oral commands, we need the speech recognition coding block below. 

  • Add the Cognitive Services extension to find this block:

  • The vehicle receives the recognition result:

NOTE:

  • The event block when space key pressed is used to trigger the program for detection. Students can use other events to trigger the program.

  • You may need to close the recognition box and click in the blocking area after using the this block

Mark destination with map pin:

  • Set up the initial status: Hide the map pin before the vehicle receives the destination information.

  • NOTE: Use go to front layer to locate the map pin layer at the headmost of other buildings. 

  • You can get exact grind locations by pressing the grind icon found in the Stage Area

Add an animated effect:

  • Program the map pin to show up with a bouncing effect, after the vehicle gets the destination information.  

  • To quickly recall the code in the program, create a function named show up that defines a bouncing effect:

  • Input show up to name the function. Define the function as shown:

  • Map pin shows up at the destination after receiving the destination information: When the vehicle receives the oral command, it sends the destination information to the map pin.

  • Recall the function show up to program the map pin to appear as needed. 

NOTE:

  • Use the hospital and convenient store as examples. Have students program their vehicles to get home, to a tower, to school, and other destinations.

The vehicle automatically drives to the destination after it receives the destination information. The vehicle should have these abilities:

  • Autonomous lane-keeping: The vehicle can stay in its lanes when driving

  • Recognizing destinations: Stops at destinations

Autonomous lane-keeping:

  • To ensure the vehicle can automatically drive to destinations, program the vehicle to detect road scenesand stay in its lanes.

  • Use color-sensing blocks to help the vehicle detect road scenes so that the vehicle can automatically stay in its lane while driving. The color picker is used to precisely define the color values of the vehicle and lanes.

Detect roads:

  • To ensure the vehicle stays in its lanes, we use Sensing blocks. The vehicle is green and the lane is dark grey. Use the script below to detect whether the two colors touch each other:

Recognize corners:

  • Program the vehicle to perform a turn when coming to a corner.

  • To detect whether to turn left or right, add a sensor to the left and one to the right of the vehicle as shown below. 

  • Open the vehicle sprite's Costumes. Look at the two sensors at the front. The left sensor is light blue, while the right sensor is dark blue. 

Decide whether to perform a turn:

  • If the left sensor touches the color outside the lane, then it's time for the vehicle to turn right. 

  • If the right sensor touches the color outside the lane, then it's time for the vehicle to turn left. 

Create a function named drive:

  • Create a function named drive to include the following reusable code: Keep driving and decide whether to turn left or right.  

Recognize destinations:

  • Destination - hospital

  • Destination – grocery

NOTE:

  • Use hospital and grocery as examples. Have students program their vehicles to get to a tower, to school and home. 

  • Rely on distance to decide whether the vehicle reaches the destinations. For instance, the car stops when the distance between it and the destination is 55. "55" is only for reference. Have students set up the distance value as appropriate.

Extension

  • Have students verify the location by getting their program to repeat it back and asking if it is the correct location

  • Here is an example:

Wrap Up

Wrap-Up & Quick Check

Objective:

  • Have students think about the relation between data and intelligent vehicles.

Procedures:

  • Have 1 or 2 students to share their intelligent vehicle design.

  • Bring students back to the previous question, have them discuss and answer: How do you monitor lane-keeping and navigation using data? (based on the projects completed today)

Downloadable Material

Example Program

Educational Standards

K12 CS Framework

K12 CS Framework

  • Practice 5-2: Create a computational artifact for practical intent, personal expression, or to address a societal issue.

ISTE

ISTE

  • 3d: Students build knowledge by actively exploring real-world issues and problems, developing ideas and theories and pursuing answers and solutions.

Alberta - Grade 7-8 - CTF

Grade 7-8

CTF

  • Planning, creating, appraising and communicating in response to challenges.

  • Working independently and with others while exploring careers and technology.

British Columbia - Grade 7-8 - ADST

Grade 7

ADST

• Generate potential ideas and add to others’ ideas

• Identify and evaluate the skills and skill levels needed, individually or as a group, in relation to a specific task, and develop them as needed

• Select, and as needed learn about, appropriate tools and technologies to extend their capability to complete a task

Grade 8

ADST

• Generate potential ideas and add to others’ ideas

• Make a plan for production that includes key stages, and carry it out, making changes as needed

• Identify and evaluate the skills and skill levels needed, individually or as a group, in relation to a specific task, and develop them as needed

• Select, and as needed learn about, appropriate tools and technologies to extend their capability to complete a task

Manitoba - Grade 7-8 - Science

Grade 7

Science (Overall Skills and Attitudes)

  • 7-0-4a Carry out procedures that comprise a fair test. Include: controlling variables, repeating experiments to increase accuracy and reliability.

  • 7-0-4c Work cooperatively with team members to carry out a plan, and troubleshoot problems as they arise.

Grade 8

Science (Overall Skills and Attitudes)

  • 8-0-4a Carry out procedures that comprise a fair test. Include: controlling variables, repeating experiments to increase accuracy and reliability.

  • 8-0-4c Work cooperatively with team members to carry out a plan, and troubleshoot problems as they arise.

New Brunswick - Grade 7-8 - Science

Grade 7-8

Science (Attitude Outcome)

  • 425 show a continuing curiosity and interest in a broad scope of science-related fields and issues

  • 430 persist in seeking answers to difficult questions and solutions to difficult problems

  • 431 work collaboratively in carrying out investigations, as well as in generating and evaluating ideas

Newfoundland & Labrador - Grade 7-8 - Science

Grade 7-8

Science

  • GCO: Skills - Students will develop the skills required for scientific and technological inquiry, for solving problems, for communicating scientific ideas and results, for working collaboratively, and for making informed decisions.

Nova Scotia - Grade 7-8 - ICT & Mathematics

Grade 7

Technology

  • GCO1: Students will be expected to design, develop, evaluate, and articulate technological solutions.

  • GCO2: Students will be expected to operate and manage technological systems.

Mathematics

PR05 Students will be expected to evaluate an expression given the value of the variable(s). 

Performance Indicator: 

PR05.01 Substitute a value for an unknown in a given expression and evaluate the expression. 

PR02 Students will be expected to create a table of values from a linear relation, graph the table of values, and analyze the graph to draw conclusions and solve problems. 

Grade 8

Technology

  • GCO1: Students will be expected to design, develop, evaluate, and articulate technological solutions.

  • GCO2: Students will be expected to operate and manage technological systems.

Ontario - Grade 7-8 - Mathematics

Grade 7

Mathematics

Algebra

  • C3.1 solve problems and create computational representations of mathematical situations by writing and executing code, including code that involves events influenced by a defined count and/or sub-program and other control structures

Grade 8

Mathematics

Algebra

  • C3.1 solve problems and create computational representations of mathematical situations by writing and executing code, including code that involves the analysis of data in order to inform and communicate decisions

Prince Edward Island - Grade 7-8 - Science

Grade 7-8

Science

  • GCO: Skills - Students will develop the skills required for scientific and technological inquiry, for solving problems, for communicating scientific ideas and results, for working collaboratively, and for making informed decisions.

Quebec - Grade 7-8 - Science

Grade 7-8

Science (Strategies)

  • Exploring various ways of solving the problem

  • Exchanging information

  • Comparing different possible explanations for or solutions to a problem in order to assess them (e.g. full-group discussion)

Saskatchewan - Grade 7-8 - Science

Grade 7-8

Science (Goals)

  • Develop Scientific and Technological Skills – Students will develop the skills required for scientific and technological inquiry, problem solving, and communicating; for working collaboratively; and for making informed decisions.