LESSONS

# Augmented Reality

Students learn augmented reality coding concepts such as motion sensing, color calibration and gesture detection to build interactive experiences.

• INTERMEDIATE

1.

2.

3.

4.

5.

6.

7.

8.

# Lesson 2: Detecting Motion

• Introduction
• Concepts
• Broken Machine Intro
• Broken Machine
• Sci Fi Symphony Intro
• Sci Fi Symphony
• Quiz

## Lesson Plan

### Introduction

In this lesson, students will use coding concepts to detect real-world motion on a virtual Actor. Activities include repairing a virtual machine, creating a virtual soundboard, and creating an augmented reality Alien Invaders game!

### New Code Blocks

• : Track the amount of motion in the video behind an Actor
• : React when the specified amount of motion in the video is detected behind an Actor
• : Make the Actor repeat this loop over and over.
• : Play the specified sound file.
• : Make the Actor repeat this loop over and over.
• : Pause the program for a specified amount of time.
• : Enable the physics engine to run physics blocks.
• : Set the horizontal and vertical forces of gravity.
• : If the condition is true, then run the code inside the block.
• : Apply the chosen physics property on the specified Actor with the given X and Y components.

### Vocabulary

• Loop: An action that repeats over and over
• Infinite loop: A loop that repeats a command over and over
• Costume: Any pose or picture of the Actor
• Sensitivity: The extent to which an Actor responds to real-world motion

### Objectives

Students will...
• Use new code blocks to repair a virtual machine
• Create a virtual soundboard by programming an Actor to respond to motion and play a sound
• Use physics blocks to program Actors to move and bounce around the Stage
• Create an augmented reality Alien Invaders game

### Materials

• Computers or iPads (1 per student) with a working camera and student account access to Tynker.com

### Warm-Up(5 minutes)

1. Tell students to take out a piece of paper and a pencil.
2. Tell students to answer the short-response question:
• How would you describe “augmented reality” to someone who does not know what it means? Give an example.

### Getting Started(5 minutes)

1. Use your projector to display “Module 2: Concepts.”
2. Play each concept (Motion Value, Detecting Motion) and read the captions to the class.

### Activities(30 minutes)

Facilitate as students complete all Detecting Motion modules on their own:
1. Introduction (Video)
• This short video introduces the Detecting Motion lesson.
2. Concepts (Video)
• This video introduces two coding concepts: “Motion Value” and “Detecting Motion.”
• The “video motion on actor” block is introduced.
• Explain that the camera can pick up different intensities of motion.
3. Broken Machine Intro (Video)
• This short video introduces the broken machine puzzle module.
4. Broken Machine (Puzzle)
• In this puzzle module, students need to code the broken panel, joystick, lever, and scanner to repair themselves when there’s motion behind them—all before time runs out!
• Tell students to adjust the number in the given “when occurs” block to change the Actor’s sensitivity to motion. A smaller number increases an Actor’s sensitivity, and a larger number decreases an Actor’s sensitivity.
• Tell students to use the drop-down menu on the “video motion on actor” block and the drop-down menu on the “repair” block to change the parameter.
5. Sci Fi Symphony Intro (Video)
• This short video introduces the Sci Fi Symphony DIY (do it yourself) activity.
6. Sci Fi Symphony (DIY)
• In this DIY, students will create a virtual soundboard by programming Actors to play sounds when they detect motion!
• Tell students that multiple Actors can test for movement at the same time.
• How to play: Tell students to wave their hand behind the button Actors to make noise.
• As students work on the Bonus Challenge, remind them how to add sound…
Step 1: Click the drop-down menu on the “play sound” block.
Step 3: Search the different categories (e.g., Sci Fi, Fantasy, Adventure) and browse the Sound options.
Step 4: Click “play” to sample it.
Step 5: Click the sound icon (above the words “play”) to select it.
• This short video introduces the Alien Invaders DIY activity.
• In this DIY, students will build an augmented reality Alien Invaders game!
• This module introduces “physics blocks” to move and bounce Actors.
• How to play: Tell students to use their hand to bounce the virtual meteor into the enemies on the Stage.
9. Quiz (Multiple-Choice)
• Students will be tested on Detecting Motion concepts.

### Optional Activities(20 minutes x 2)

Quartet
• Divide your class into four groups and assign each group a different category from the Tynker Media Library—for example: Group 1 = Performance, Group 2 = Nature, Group 3 = Adventure, Group 4 = Sports.
• Tell students to repeat “Module 6: Sci Fi Symphony,” but clarify that they can only use Sound options from the category they were assigned to (e.g., Students assigned to “Group 4” can only select Sound options from the “Sports” category).
• As students finish, place them in teams of four and encourage them to compose musical melodies in their quartet.

Review Questions
Discuss the following with students:
• What does the "video motion on Actor" block do in your code? (tracks the amount of motion in the video behind an Actor)
• What is sensitivity? How would you make an Actor more or less sensitive to motion? (Sensitivity is the extent to which an Actor responds to real-world motion. Use a smaller number in a “when video motion occurs” block to make an Actor more sensitive, and use a larger number to make an Actor less sensitive.)
• If you moved one hand slowly but waved the other hand quickly, which would make the "video motion on Actor" block return a bigger number? (the hand that waved quickly because it caused more motion)

### Standards

CCSS-Math: MP.1
CCSS-ELA: SL.3.1, SL.3.3, W.3.1.C, W.3.2, SL.4.1, SL.4.1.C, W.4.2, SL.5.1, SL.5.1.C, SL.5.1.D, W.5.2, SL.6.1, SL.6.1.C, W.6.2, SL.7.1, SL.7.1.C, SL.7.1.D, W.7.2, SL.8.1, SL.8.1.C, SL.8.1.D, W.8.2
CSTA: 1A-AP-09, 1A-AP-10, 1A-AP-11, 1A-AP-14