← Back to Library
Lesson PlanFreeEN

CyberPi: Sound Machine

In this lesson, students will create a disco party using the on-board LEDs and speaker. This program will use the CyberPi buttons to trigger events and run scripts. Students will also program a button to stop all sounds and lights, as well as a button to restart the CyberPi.

Gr. 6–8
CyberPi: Sound Machine

Lesson

Overview

Description

In this lesson, students will create a disco party using the on-board LEDs and speaker. This program will use the CyberPi buttons to trigger events and run scripts. Students will also program a button to stop all sounds and lights, as well as a button to restart the CyberPi.

Objectives

  • Identify CyberPi’s input(s) and output(s).

  • Write pseudocode to plan and design a program in mBlock.

  • Create a program in mBlock using the CyberPi buttons to trigger events.

  • Select and use programming blocks to control the speaker and LED strip.

Before the Lesson

Preparation

For the teacher and students:

Review

Warm Up

Input vs Output

1. Discuss the following definitions with the students.

2. Using a smartphone as an example, have students work in pairs or small groups to create a list of the input and output for a mobile phone. Some examples may include:

3. Have students reflect on Lesson 1 - Meet the CyberPi and create a list of the input and output for the CyberPi. Encourage students to refer back to the product documentation included with the CyberPi if they get stuck.

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

Plan a Program with Pseudocode

1. Discuss with the students the importance of planning a program before developing it in the software. Introduce student to pseudocode which can be a helpful tool for planning an mBlock project.

2. Using the following project description, guide students through writing the pseudocode for the project.

3. Have students examine the pseudocode above and identify the input and output for the program.

Write the Program

1. Now that the program is planned, it is time to learn about the new blocks needed to program the pseudocode.

2. Open the mBlock 5 software or mBlock 5 Web version. Add the CyberPi in the Devices tab and connect in Live mode.

3. Remind students how to drag-and-drop blocks from the color-coded categories in the Block Area. Instruct them to build each of the following scripts:

4. Test the program in Live mode and/or Upload mode.

5. Have students experiment with different values for the buzzer and LED blocks to observe how the CyberPi performs.

6. Extension: If time permits, teach students about RGB color values or allow them to use a color picker to identify the RGB values of specific colors.

Randomizing the Output

7. In the code above, a specific buzzer frequency and RGB color value were programmed in the code. The CyberPi is repeating the same sound and same LED color forever. The following block can be used to allow the program to select a random value each time the forever loop repeats.

8. Modify the previous programs to include the following random blocks:

Note, these ranges correspond to the range of values accepted for each block.

9.   Have students test the new program. Note, students can change the seconds value in the play buzzer block to a decimal if they would like a faster buzzer sound.

Restart a CyberPi

10. Programming a button to restart the CyberPi can be a helpful tool in upcoming lessons. So, guide students through programming a button to manually restart the CyberPi.

11. Instruct students to build the following script and test the program:

Independent Practice

Try It

Create a Sound Machine

1. Provide students time to experiment with their existing code. Encourage them to try different values for the parameters in the blocks.

2. Challenge students to explore other blocks in the LED and Audio categories in the Block Area. Some blocks of interest may be:

3. Once they’ve explored the various blocks. Have students write pseudocode for an enhanced version of the Sound Machine project.

4. Have students create their project using their pseudocode as a guide.

Extension

  • Program a stop button using the Repeat Until block with the 

    block.

  • Use the joystick buttons to program multiple different sounds and light shows.

Wrap Up

Wrap-Up & Quick Check

Project Showcase

1. Group students into pairs and have students present their CyberPi Sound Machine to their partner. 

2. Have students ask each other the following questions:

  • What feature of your project are you most proud of? 

  • What was most challenging about this project?

Downloadable Material

Example Program

Educational Standards

CSTA

CSTA

  • 2-AP-10: Use flowcharts and/or pseudocode to address complex problems as algorithms.

K12 CS Framework

K12 CS Framework

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

Alberta - Grade 6-8 - CTF

Grade 6-8

CTF

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

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

British Columbia - Grade 6-8 - ADST

Grade 6-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 6-8 - Science

Grade 6

Science (Overall Skills and Attitudes)

  • 6-0-4a: Carry out procedures that comprise a fair test. Include: controlling variables; repeating measurements to increase accuracy and reliability.

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

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 6-8 - Science

Grade 6-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 6-8 - Science

Grade 6-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 6-8 - ICT & Mathematics

Grade 6

Mathematics

N09 Students will be expected to explain and apply the order of operations, excluding exponents, with and without technology (limited to whole numbers). 

Performance Indicators: 

N09.01 Demonstrate and explain, with examples, why there is a need to have a standardized order of operations. 

N09.02 Apply the order of operations to solve multi-step problems with or without technology (e.g., computer, calculator). 

PR03 Students will be expected to represent generalizations arising from number relationships using equations with letter variables. 

Performance Indicators: 

SCO PR03 Students will be expected to represent generalizations arising from number relationships using equations with letter variables. [C, CN, PS, R, V] 

PR03.01 Write and explain the formula for finding the perimeter of any regular polygon. 

PR03.02 Write and explain the formula for finding the area of any given rectangle. 

PR03.03 Develop and justify equations using letter variables that illustrate the commutative property of addition and multiplication (e.g., a + b = b + a or a × b = b × a). 

PR03.04 Describe the relationship in a given table using a mathematical expression. 

PR03.05 Represent a pattern rule using a simple mathematical expression, such as 4d or 2n + 1. 

SP04 Students will be expected to demonstrate an understanding of probability by 

▪ identifying all possible outcomes of a probability experiment 

▪ differentiating between experimental and theoretical probability 

▪ determining the theoretical probability of outcomes in a probability experiment 

▪ determining the experimental probability of outcomes in a probability experiment 

▪ comparing experimental results with the theoretical probability for an experiment 

Performance Indicators: 

SP04.01 List the possible outcomes of a probability experiment, such as 

o tossing a coin 

o rolling a die with a given number of sides 

o spinning a spinner with a given number of sectors 

SP04.02 Determine the theoretical probability of an outcome occurring for a given probability experiment. 

SP04.03 Predict the probability of a given outcome occurring for a given probability experiment by using theoretical probability. 

SP04.04 Conduct a probability experiment, with or without technology, and compare the experimental results to the theoretical probability. 

SP04.05 Explain that as the number of trials in a probability experiment increases, the experimental probability approaches the theoretical probability of a particular outcome. 

SP04.06 Distinguish between theoretical probability and experimental probability, and explain the differences. 

ICT

  • P2: Students will be expected to use digital tools to develop ideas and original works in innovative ways.

  • TOC1: Students will be expected to

* safely use many forms of current technology for learning with growing competence

* demonstrate conceptual understanding of how information and communication technology, digital tools, and authorized networks support their learning

* use terminology related to information and communication technology

Grade 7

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. 

SP04 Students will be expected to express probabilities as ratios, fractions, and percents. 

Performance Indicators: 

SP04.01 Determine the probability of a given outcome occurring for a given probability experiment, and express it as a ratio, fraction, and percent. 

SP04.02 Provide an example of an event with a probability of 0 or 0% (impossible) and an example of an event with a probability of 1 or 100% (certain). 

SP06 Students will be expected to conduct a probability experiment to compare the theoretical probability (determined using a tree diagram, table, or other graphic organizer) and experimental probability of two independent events. 

Performance Indicators: 

SP06.01 Determine the theoretical probability of a given outcome involving two independent events. 

SP06.02 Conduct a probability experiment for an outcome involving two independent events, with and without technology, to compare the experimental probability with the theoretical probability. 

SP06.03 Solve a given probability problem involving two independent events. 

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 6-8 - Mathematics

Grade 6

Mathematics

Algebra

  • C3.1 solve problems and create computational representations of mathematical situations by writing and executing code, including code that involves conditional statements and other control structures

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 6-8 - Science

Grade 6-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 6-8 - Science

Grade 6-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 6-8 - Science

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