Lesson 3: Sending Binary Messages with the Internet Simulator
Overview
Students are introduced to the Internet Simulator, a tool they will return to many times in the first two units of the course. Today, the Internet Simulator will be used to simulate a single shared wire, connecting two people. The wire can only be in one of two possible states (state A or state B) and either partner may set or read the state of the wire at any time, but this is the only way in which students may communicate. Students must invent a binary call-response protocol using this system. Coordination, speed and timing are problems that need to be solved. At the conclusion of the lesson, students compete to demonstrate the speed and accuracy of their protocols, and calculate the bit rate of their message exchange.
Purpose
The major purpose of this lesson is to engage students in a rather challenging problem of engineering a physical network for digital communications. if you must communicate in binary by setting the state of some object (such as a wire) to one of its two possible states, merely defining “State A” and “State B” is insufficient because there is no way to distinguish between a single bit "A" and a string of "AAA" for example. Some element of time must be incorporated into a communication protocol to make it functional for exchanging bits. This time-per-bit leads naturally to calculating a bitrate for a given device, or a measure of how quickly a system transmits digital data.
This is the first lesson in which we use the Internet Simulator. The Internet Simulator is a robust learning tool developed by Code.org specifically for Computer Science Principles, that has many different variants that you will see in the first two units of the course. It was designed to give students a hands-on experience experimenting with (and solving) different kinds of problems associated with networked computers and the Internet. A goal of using the internet simulator was put best by a student near the conclusion of Unit 1 who said "Whoa, I feel like I just invented the Internet!"
Agenda
Getting Started (10 mins)
Activity (35 mins)
Wrap-up (10 mins)
Assessment
Extended Learning
View on Code Studio
Objectives
Students will be able to:
- Explain how synchronization and coordination enable the transmission of binary messages.
- Develop a protocol for exchanging binary messages in two directions.
- Calculate the bit rate for a binary message exchange.
- Provide a definition of "bit" and relate it to the binary messages they have seen so far.
Preparation
- Code Studio section setup (required for using Internet Simulator)
Links
Heads Up! Please make a copy of any documents you plan to share with students.
For the Teachers
- U1L03 - Teaching Tips & Tricks Video - Video (download)
- [KEY] Worksheet - Video Guide for “Wires, Cables & WiFi” (optional)
For the Students
- Coordination and Binary Messages - Activity Guide
- Flashlight Binary Signal Test - Presentation
- Internet Simulator - Part 1 - Video (download)
- The Internet: Wires, Cables & WiFi - Video (download)
- Worksheet - Video Guide for “Wires, Cables & WiFi” (optional) - Video Worksheet
Vocabulary
- Bandwidth - Transmission capacity measure by bit rate
- Bit - A contraction of "Binary Digit"; the single unit of information in a computer, typically represented as a 0 or 1
- Bit rate - (sometimes written bitrate) the number of bits that are conveyed or processed per unit of time. e.g. 8 bits/sec.
- Latency - Time it takes for a bit to travel from its sender to its receiver.
- Protocol - A set of rules governing the exchange or transmission of data between devices.
Teaching Guide
Getting Started (10 mins)
Content Corner
The word "protocol" has a variety of meanings outside of computing. It typically refers to a formal procedure or set of rules. In computing a protocol usually implies a "communication protocol" that governs how devices should transmit and interpret data. There are many similarities between protocols and algorithms that can be made later in the course.
Remarks
- Yesterday you all made your own binary message devices.
- We learned that we could compose any number of messages by sending a sequence of states.
- In order to interpret the message we needed to know
- which signal meant A and which meant B and
- some kind of mapping between sequences of signals and a possible message.
- What we were really doing was beginning to develop a communication protocol
- Today you're going to develop a protocol to solve a problem.
Binary Signal Test
The following demonstration can be done in two ways:
- Teacher use a flashlight
- Use this presentation Flashlight Binary Signal Test - Presentation which has animations that simulate the flashlight.
Instructions:
"Imagine that you and your friend have made a binary signaling protocol using a flashlight. The light on is state A, off is state B."
Test 1
"Your friend sends you this message. What is being signaled here? Write down what you think the message is."
Teaching Tip
Many students likely decoded the first message as B A B A B
initially. The second message might have more variants, but BB A B A BB AA BB
is one possibility.
As soon as they received the second message they may have updated their original answer to account for the implied timing they saw in the second message. Depending on how fast you think you could interpret signal changes the first message could easily be any number of consecutive Bs and As.
- Pulse the flash light on and off at ~1 second intervals 4 times
-
Give students a few seconds write
-
Students can confer with neighbor or as whole class as to what the message was.
Test 2
"Uh oh! Your friend realizes she actually made a mistake encoding the message from before and decides to re-send the message. Decode this new version of the message and write it down."
- Pulse the flashlight on and off quickly, then a few pulses at ~1 second intervals
- Give students a few seconds to write
- Again, discuss with neighbor
Discussion Goal
This brief warm-up activity and discussion is meant to draw out two main points:
- A flashlight turning on and off truly has only two states. Many of the devices students made, even if they used flashlights, probably had at least a third "do nothing" state that was used to signal a break between As and Bs.
- When there are truly only two states, time and synchronization become huge factors and must be accounted for in a protocol.
Discussion
Lead a discussion that explores the assumptions made when decoding these messages, and more importantly, explores what information they would need in order to decode it.
- Did this new message make you think about your answer to the first question? Do you want to change your answer to the first question?
- What assumptions did you make in interpreting these messages?
- Is this protocol specific enough to allow useful communication of a binary message? If not what information would need to be added to it?
Activity (35 mins)
Quick Vocabulary
We need to get some terminology down so that we can speak about our problems and solutions more efficiently.
-
Protocol - For our purposes today a "protocol" is simply a set of rules about sending, receiving and interpreting binary messages.
-
Bit We will call each element of a binary message a bit. "Bit" is short for binary digit. So for example if you have a binary message
A B B A
, we would say that is a 4-bit message.
Today you and your partner will be developing a protocol for exchanging 2-bit messages using an Internet Simulator.
Use a discovery-based method
Discovery-based introduction of tools in nutshell:
- Get students into/connected to the tool
- Give students working in partners a fixed amount of time (5 minutes or so) to poke around and see if they can figure out what it does and doesn't do -- typically this might be presented as a mystery worth investigating
- Ask the group to report what they found
- Teacher fill in any gaps or explanations of how the tool works afterwards
The Internet Simulator - and all other tools created by Code.org - are meant as learning tools. You cannot break them so you are encouraged to let students play and investigate to figure out how the tools work.
These discovery-based methods of introducing tools have been tested in professional development and have worked well for teachers who use this curriculum. This method is effective for a few reasons, but overall students find this approach more engaging and fun, and they tend to be more receptive to, and motivated to hear, explanations of how the tool works after trying to "solve the mystery" themselves.
First time with Internet Simulator?
If you are using the Internet Simulator for the first time you should watch the U1L03 - Teaching Tips & Tricks Video - Video that shows what the classroom environment should look like and how students should be interacting. You should also watch the student video: Internet Simulator - Part 1 - Video
Introduce the Internet Simulator
We encourage you to use a "discovery-based introduction" to this and all other tools in the Code.org curriculum. (See teaching tip at right).
Remarks
- Today we will be using the Internet Simulator to explore some of the challenges of sending bits on the Internet.
- This tool simulates a single wire connecting two people who cannot otherwise see or speak to each other.
- The Internet Simulator helps to enforce "the binary rule" for sending messages -- it will present challenges that they will need to problem solve around.
Demonstrate how to connect to a partner in the widget but explain nothing else.
Give students the following 5-minute discovery challenge:
- "Your job is to explore this tool with a partner - click all the buttons, type in the text areas what you can."
- "You cannot break it so don't worry."
- "There is a bit of a mystery in what the tool does...and doesn't do. Can you figure it out?"
- "You and your partner have 5 minutes to poke around and see what you can find."
After 5 minutes bring the group back together and poll the group to see what they found.
It is likely that they will have uncovered most of the properties of the simulator, but if they haven't you can explain now.
Clarify any misconceptions about the tool at this point and then move on with the challenge.
- The major challenge is that the wire is SHARED between the two people.
- The wire can hold only a single state - A or B - and it can be set by either person at any time.
- At any time either person can read the wire to see which state it's in
- misconception: that either partner is "sending" or "receiving" anything. Partners can set and see the current state of the wire.
The challenge of today’s activity is to figure out a way to coordinate actions with your partner to make this tool into a functioning two-way bit-sending device.
Video Demonstration of the Widget:
If necessary, you can show or have students watch the tutorial video: Internet Simulator - Part 1 - Video which covers how to: * join or connect with another classmate * set the state of the wire * read the wire.
You can show it to the whole class or students can watch it on the Code Studio stage for this lesson.
Teaching Tip
Students will likely need some time to connect with their partners and experiment with the interface of the Internet Simulator. Once they feel comfortable with the basics of the tool, they should proceed as a class through the challenges found in Coordination and Binary Messages - Activity Guide.
Tips for Teaching with the Internet Simulator
- Understanding the concept of the "shared wire" can be very challenging at first. The bit-sending devices students created in the previous lessons and the tool they are using today function differently, and students will likely need help developing the appropriate mental model.
- Students are setting the state of a wire but have no guarantee their partners will receive that message.
- In fact it is very likely students will set the state of the wire and then read their own message.
- Only through carefully coordinating when they set and get the state of the wire can students use this tool to communicate.
- Highlight this difference to students and feel free to emphasize that coordination / timing is the goal of the activity.
- A timer has been included in the widget to help coordinate timing. NOTE: the timer doesn't get or set the wire - it's just a pulse that students can follow to coordinate getting and setting.
- Groups should be encouraged to reconvene to add to or modify their protocol in order to be able to coordinate this kind of call-and-response message.
Sending Bits with the Internet Simulator
Experiment: Coordination and Single-Bit Protocols
Students experiment with sending a single bit and develop protocols that allow them to send more complex messages with more bits.
- Distribute a copy of Coordination and Binary Messages - Activity Guide
- Place students in pairs and send them to the Internet Simulator.
- It’s recommended that partners who want to send data to each other sit close together so they can talk, even though they need to be on different computers.
The 2-bit Message Exchange Challenge!
Students will practice relaying a 2-bit sequence with their partners. The goal is to exchange 2-bit messages (partner sends a 2-bit message, other partner sends a 2-bit message back) as quickly and accurately as possible. In other words, students are trying to get the fastest bit rate possible.
- Each initial sender should be able to confirm that the message was received correctly and resent because the message that they have received is the same as the original.
- As students iterate and perfect their protocol, they should try to extend their protocol to send more bits or send them more quickly, while maintaining accuracy. When each group has a working protocol and has time to practice (~10 minutes), have an all-class showdown to see who can do it the fastest.
Rules for the Challenge:
- Student pairs can decide who sends first.
- Teacher reveals sequence of bits to be sent. Partner A of each group may enter this sequence of bits into Internet Simulator but may not begin sending them.
- Teacher will say “GO” and partners will exchange messages.
- During the challenge students may not communicate with one another. (Note: feel free to put partners on opposite sides of a room or in separate rooms altogether.)
- Students yell “STOP” once they have completed their exchange.
- Teacher will verify that each partner received what the other sent by checking outgoing and incoming messages.
Wrap-up (10 mins)
Video - The Internet: Wires Cables and WiFi
Teaching Tip
Vocubulary words that show up in the video like:
- latency - how long does it take the first bit to get there?
- bit rate (sometimes bitrate) - at any moment in time how many bits per second are being transmitted?
- bandwidth - what is the maximum capacity of this link? (difference from bitrate: just because a link it can send 100 bits per second - its bandwidth - doesn't mean it is at that point in time.)
are all in the CSP framework. While they form a very small part of the content and skills students need, these words are also easy fodder for exam questions. It's worth reviewing them so that a student might be able to pick out their definitions in context. You can relate each of these terms to the activities students have already done in class.
-
It also has an associated worksheet: Video Guide: Wires, Cables and WiFi that is optional but you may find helpful for calling out vocabulary that shows up in the video.
-
NOTE: The video is also available to students through Code Studio - it's the level after the Internet Simulator level.
Content Corner
Students would be hard-pressed to achieve a bit rate much faster than 1 bit/sec in this activity. You might think that, say, 1,000 bits/sec would be fast for a computer, but even typical household modems in the early 90s had bit rates higher than about 10,000 bits/sec.
These days transmission rates are well in excess of millions of bits/sec (or Mbps - Megabits per second). Typical mobile phone speeds range from 5-10 Megabits per second,
Discussion:
Relate what's shown in the video to what students had to do in the previous two lessons:
- first making a bit-sending device
- second solving the coordination problem of sending bits using a wire that can only have 1 of 2 possible states.
- These are both problems that real engineers had to solve as well when building the internet for the first time.
If students have not already done so, they should calculate the fastest bit rate they were able to achieve. Lead a quick classroom discussion about the following topics, using these prompts:
- How has today’s activity added to or altered your definition of a bit?
-
A major focus of today’s activity was timing and coordination. What things did you need to coordinate or agree about ahead of time in order for your protocol to work?
-
What is the best bit rate you were able to achieve? What would it take to go faster?
- How fast do you think computers transmit bits?
Assessment
Code Studio: Assessment questions are available on the Code Studio.
Extended Learning
- Continue to increase the number of bits that students must be able to transmit in the challenge and showdown.
- Require students to relay a message, but the response must be sent backwards. This ensures partner B must receive the entire message before responding. (e.g. if partner A sends: ABAB partner B should respond: BABA.)
- Lesson Overview
- Teacher Overview
- Student Overview
- Internet Simulator: Sending Binary Messages
- Student Overview
Coordination and Binary Messages Activity
Develop your Protocol Develop a protocol that allows you to use Internet Simulator to relay a message, i.e. one member sends a message and the other member sends the same message back. You or a teacher will say “Go” to begin the exchange but otherwise all communication must be through the widget. As you’re working, consider:
- How will you know when the exchange is supposed to begin?
- How will you know whose turn it is to send or receive the message?
- How will you coordinate your actions?
Document your protocol on the worksheet provided, and test your protocol using the Internet Simulator
- The Internet: Wires, Cables, and Wifi_2019
- Teacher Overview
- Student Overview
One of the goals of this lesson is to help students understand why binary is important. This video about the Internet was created for the Code.org Computer Science Principles course. The video could be used to help motivate why binary is important in computer science.
Teaching Tip
The answer is AABB. If person 1 is setting the wire at a rate of one bit every 2 seconds, and person 2 is reading once per second you can look at the timeline...
person 1(set) A---------B---------A--------B person 2(read) ^----^----^----^----
You can see person 2 is going to read the wire twice while A is still on the wire.
Student Instructions
A binary message consisting of four bits was sent to you by a friend. The message was supposed to be ABAB. Unfortunately, your friend set the bit on the wire once every 2 seconds, but you read the wire once every second. Assuming that the first bit was sent and read at the same time, what message did you receive instead?
Student Instructions
Student Instructions
A binary message was recorded as a wave as shown in the image below. Can you decode the message? Explain what information you would need in order to successfully decode the message into A’s and B’s.
Student Instructions
Standards Alignment
View full course alignment
CSTA K-12 Computer Science Standards (2011)
CL - Collaboration
- CL.L2:3 - Collaborate with peers, experts and others using collaborative practices such as pair programming, working in project teams and participating in-group active learning activities.
- CL.L2:4 - Exhibit dispositions necessary for collaboration: providing useful feedback, integrating feedback, understanding and accepting multiple perspectives, socialization.
CT - Computational Thinking
- CT.L2:7 - Represent data in a variety of ways including text, sounds, pictures and numbers.
- CT.L2:8 - Use visual representations of problem states, structures and data (e.g., graphs, charts, network diagrams, flowcharts).
- CT.L2:9 - Interact with content-specific models and simulations (e.g., ecosystems, epidemics, molecular dynamics) to support learning and research.
Computer Science Principles
2.1 - A variety of abstractions built upon binary sequences can be used to represent all digital data.
2.1.1 - Describe the variety of abstractions used to represent data. [P3]
- 2.1.1A - Digital data is represented by abstractions at different levels.
- 2.1.1B - At the lowest level, all digital data are represented by bits.
- 2.1.1C - At a higher level, bits are grouped to represent abstractions, including but not limited to numbers, characters, and color.
- 2.1.1E - At one of the lowest levels of abstraction, digital data is represented in binary (base 2) using only combinations of the digits zero and one.
2.1.2 - Explain how binary sequences are used to represent digital data. [P5]
- 2.1.2D - The interpretation of a binary sequence depends on how it is used.
- 2.1.2E - A sequence of bits may represent instructions or data.
- 2.1.2F - A sequence of bits may represent different types of data in different contexts.
2.3 - Models and simulations use abstraction to generate new understanding and knowledge.
2.3.1 - Use models and simulations to represent phenomena. [P3]
- 2.3.1A - Models and simulations are simplified representations of more complex objects or phenomena.
- 2.3.1B - Models may use different abstractions or levels of abstraction depending on the objects or phenomena being posed.
- 2.3.1C - Models often omit unnecessary features of the objects or phenomena that are being modeled.
- 2.3.1D - Simulations mimic real world events without the cost or danger of building and testing the phenomena in the real world.
2.3.2 - Use models and simulations to formulate, refine, and test hypotheses. [P3]
- 2.3.2A - Models and simulations facilitate the formulation and refinement of hypotheses related to the objects or phenomena under consideration.
3.1 - People use computer programs to process information to gain insight and knowledge.
3.1.3 - Explain the insight and knowledge gained from digitally processed data by using appropriate visualizations, notations, and precise language. [P5]
- 3.1.3A - Visualization tools and software can communicate information about data.
3.3 - There are trade offs when representing information as digital data.
3.3.1 - Analyze how data representation, storage, security, and transmission of data involve computational manipulation of information. [P4]
- 3.3.1A - Digital data representations involve trade offs related to storage, security, and privacy concerns.
- 3.3.1B - Security concerns engender tradeoffs in storing and transmitting information.
6.1 - The Internet is a network of autonomous systems.
6.1.1 - Explain the abstractions in the Internet and how the Internet functions. [P3]
- 6.1.1A - The Internet connects devices and networks all over the world.
- 6.1.1C - Devices and networks that make up the Internet are connected and communicate using addresses and protocols.
6.2 - Characteristics of the Internet influence the systems built on it.
6.2.2 - Explain how the characteristics of the Internet influence the systems built on it. [P4]
- 6.2.2D - Interfaces and protocols enable widespread use of the Internet.
- 6.2.2J - The bandwidth of a system is a measure of bit rate — the amount of data (measured in bits) that can be sent in a fixed amount of time.
- 6.2.2K - The latency of a system is the time elapsed between the transmission and the receipt of a request.
CSTA K-12 Computer Science Standards (2017)
AP - Algorithms & Programming
- 3A-AP-21 - Evaluate and refine computational artifacts to make them more usable and accessible.
DA - Data & Analysis
- 3A-DA-09 - Translate between different bit representations of real-world phenomena, such as characters, numbers, and images.
NI - Networks & the Internet
- 2-NI-04 - Model the role of protocols in transmitting data across networks and the Internet.