← Back to Library
Lesson PlanFreeEN

CyberPi: Parcel Locker

In this lesson students will use variables to send and verify pickup codes while learning about parcel lockers.

Gr. 7–8
CyberPi: Parcel Locker

Lesson

Overview

Description

In this lesson students will use variables to send and verify pickup codes while learning about parcel lockers.

Objectives

  • List the ways to receive parcels and describe the significance of parcel lockers.

  • Explain how a parcel locker works and write programs to send pickup codes and collect parcels with a pickup code.

  • Use mind maps to analyze the features of a parcel locker.

  • Apply variables in programs to complete a parcel locker system.

Before the Lesson

Preparation

For the teacher and students:

Example program(s): CyberPi – Lesson 6 - Parcel Locker

For students:

  • Proficiency in block-based coding

  • Prior knowledge of CyperPi's major features

  • Knowledge of variables

Review

Warm Up

Objective: 

  • List the ways to collect parcels and explain the application of parcel lockers.

Procedures:

  • Ask: How do you receive parcels?

  • Give your answer: We can receive a parcel at home, pick it up at a specified collection point, such as a guard booth and a store, or collect it from a parcel locker nearby.

  • Ask: If nobody is at home, which will be your choice? Why?

  • Summarize: When nobody is at home, having the parcel delivered to a parcel locker will be the best choice. Think about it. If the courier just drops the parcel at the door, it may get lost. If the parcel is sent to a collection point like a store, other people may mistakenly take it. A parcel locker can avoid such problems because only the recipient with the one-off pickup code can open the locker into which the courier put the parcel. Also, a parcel locker works 24/7.

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:

  • Describe the features of a parcel locker and encourage the students to brainstorm how to develop the features.

 Procedures:

  • Ask: After the courier puts a parcel into the parcel locker, how does the recipient know the parcel arrived and is ready for pick up?

  • Give your answer: The recipient will receive a text message carrying a pickup code. Then the recipient needs to go to the parcel locker and enter the pick-up code. A door will open if the recipient enters the code correctly.

  • Work with students to analyze what features a parcel locker should have and draw a mind map.

Independent Practice

Try It

Objective:

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

Procedures:

  • Connect CyberPi to mBlock.

  • Open the preset program file.

Notify recipient:

  • Send pick-up code: When a parcel is delivered to a parcel locker, a pickup code is sent to CyberPi. Create a variable Pick-up Code to store the code, making it easier for the program to check whether the input code is correct.

  • Use this block to display the parcel information:

NOTE:

  1. Generate pseudorandom numbers as pick-up codes. The example program generates 4-digit codes. If you want 5-digit codes, limit the range to 10,000 to 99,999.

  2. Compare print ( ) and print ( ) and move to a new line.

Pickup reminder:

  • If the parcel isn’t collected after a certain period, a pick-up reminder will be sent to the recipient. This setting improves the efficiency of the parcel locker. Set two timeframes so that a reminder will be sent if a parcel isnot collected after 24 hours and 48 hours.

NOTE: 

  • To save time, use 24 seconds to represent 24 hours in this project.

Pick up parcel:

  • After receiving the pickup code, tap the Pick Up button and enter the code:

  • If the pick-up code is correct, a door will open, and a message Parcel taken out will be sent to CyberPi. 

Parcel locker sprite:

Back in Devices:

  • After taking out the parcel, click the door to close it.

Extension

  • Have students add a feature that limits that amount of incorrect password entires

  • After three incorrect attempts CyperPi should notify them to contact the company and prevent them from trying again

Warp Up

Wrap-Up & Quick Check

Objective:

  • Allow students time to test their projects. Have them think about the relationship between parcel lockers and the data as well as the use of data in everyday life.

Procedures:

  • Invite students to present their work.

  • Ask: How are data used in a parcel locker system? What are the roles of data in the system?

  • Possible answer: The pick-up code generated by the program and the one entered by a recipient are all data. The system needs data to verify the identity of recipients.

Downloadable Material

Example Program

Educational Standards

K12 CS Framework

K12 CS Framework

  • Practice 3-1: Identify complex, interdisciplinary, real-world problems that can be solved computationally.

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

CSTA

CSTA

  • 2-CS-02: Design projects that combine hardware and software components to collect and exchange data.

  • 2-AP-11: Create clearly named variables that represent different data types and perform operations on their values.

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 - Technology & 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. 

Performance Indicators: 

PR02.01 Create a table of values for a given linear relation by substituting values for the variable. 

PR02.02 Create a table of values, using a linear relation, and graph the table of values (limited to discrete elements). 

PR02.03 Sketch the graph from a table of values created for a given linear relation, and describe the patterns found in the graph to draw conclusions (e.g., graph the relationship between n and 2n + 3). 

PR02.04 Describe, using everyday language, in spoken or written form, the relationship shown on a graph to solve problems. 

PR02.05 Match a given set of linear relations to a set of graphs. 

PR02.06 Match a given set of graphs to a given set of linear relations. 

Grade 7-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.