< Unit 6 - Physical Computing ('22-'23)

Lesson 11: Board Sensors

45 minutes

Overview

In this lesson, students explore how the three sensors (sound, light, and temperature) can be used to write programs that respond to changes in the environment. The use of these sensors marks a transition in terms of how users interact with a program. By using sensors as an input, the user of an app doesn't have to directly interact with it at all or may interact without actually realizing they are doing so.

Question of the Day: How can I use sensors to detect changes in the environment?

Assessment Opportunities

  1. Develop programs that respond to sensor input

    Code Studio: see rubric on the assessment level

  2. Scale a range of numbers to meet a specific need

    Code Studio: see rubric on the assessment level

CSTA K-12 Computer Science Standards (2017)
    • 2-AP-11 - Create clearly named variables that represent different data types and perform operations on their values.
    • 2-AP-12 - Design and iteratively develop programs that combine control structures, including nested loops and compound conditionals.
    • 2-AP-13 - Decompose problems and subproblems into parts to facilitate the design, implementation, and review of programs.
    • 2-AP-16 - Incorporate existing code, media, and libraries into original programs, and give attribution.
    • 2-AP-17 - Systematically test and refine programs using a range of test cases.
    • 2-AP-19 - Document programs in order to make them easier to follow, test, and debug.
    • 2-CS-01 - Recommend improvements to the design of computing devices, based on an analysis of how users interact with the devices.
    • 2-CS-02 - Design projects that combine hardware and software components to collect and exchange data.
    • 2-CS-03 - Systematically identify and fix problems with computing devices and their components.

Agenda

Objectives

Students will be able to:
  • Develop programs that respond to sensor input
  • Scale a range of numbers to meet a specific need

Preparation

  • Prepare a board and USB cable for each pair of students
  • Consider having some flashlights or other light sources on hand for testing the light sensor
  • Consider having noisemakers or whistles or small instruments on hand for testing the sound sensor
  • Check the "Teacher's Lounge" forum for verified teachers to find additional strategies or resources shared by fellow teachers

Links

Heads Up! Please make a copy of any documents you plan to share with students.

For the teachers
For the students

Teaching Guide

Warm Up (5 minutes)

Distribute: Pass out Circuit Playgrounds to each pair of students

Prompt: Humans have 5 senses - touch, taste, sight, smell, and hearing. Which of these senses do you think the Circuit Playground has? Are there any that you think the Circuit Playground has that we don’t?

As students consider this question, encourage them to look at the markings on the Circuit Playground for clues (for example: there are eye and ear icons on the circuit playground that can give clues)

Share Out: Have students share with a neighbor, then lead a full-class discussion. Take notes at the front of the room.

Discussion Goal: Using the markings on the circuit playground, students may predict that there are visual and auditory sensors, but they might not be able to describe exactly what they do - for example, does the visual sensor “see” objects, or detect distance, or detect colors, or detect light? Students may also predict that there is a temperature sensor based on the thermometer icon on the circuit playground. Students may also predict sensors that the circuit playground does not have, like humidity or heart-beat sensors, but it’s fine to list them for now as part of the brainstorm discussion.

Remarks

Today we’re going to learn about the different sensors that the Circuit Playground has and how they can be used for input.

Question of the Day: How can I use sensors to detect changes in the environment?

Activity (35 minutes)

Transition: Send students to Code Studio

Teaching Tip

Guide to Programming Levels: Additional guidance for programming levels is provided in the CSD Guide to Programming Levels. This document includes strategies and best-practices for facilitating programming levels with students.

Discussion Goal

There are three sensors on the circuit playground: a light sensor, a sound sensor, and a temperature sensor. Encourage students to relate the sensors to their own senses and interact with the circuit playground that way - for example, what happens when we show or hide things from the circuit playground? What happens when the volume changes near the circuit playground?

Through experimentation, students should notice that the minimum value is 0 and the maximum value is 1023. Students may also notice that one sensor (temperature) doesn't seem to change very much.

Assessment Opportunity

Formative Assessment: This level can be used as a formative assessment. A rubric is provided in the level, and written feedback can be given to students. Click here to learn more about giving feedback to students.

Wrap Up (5 minutes)

Sensors All Around

Journal: Considering all of the computing devices that you interact with on a regular basis, write down as many potential sensors as you can. What type of sensor do you think you interact with the most?

Discussion Goal: Students may repeat ideas from the warm-up discussion, but encourage them to make connections to other real-world devices. Emphasize that they can think of situations where devices must account for a range of values like we saw with these sensors.

Creative Commons License (CC BY-NC-SA 4.0).

This work is available under a Creative Commons License (CC BY-NC-SA 4.0).

If you are interested in licensing Code.org materials for commercial purposes contact us.