Brain DeCoded with CodeX - Mission 2, Objective 4: Neural LinkUP

Mission 2 · Objective 4 Lesson Plan

Neural LinkUP

Students chain their CodeX devices together over radio, turning a room full of single neurons into one working network.

⏱ 45-70 min 🎯 Grades 8-12+ 💻 CodeSpace 🎮 CodeX 📡 Radio
View Lesson Outline
📋

Overview

Objective 3 gave every student one neuron on one CodeX. This objective wires them together. The program neural_network1 uses the CodeX radio to pass a signal from one device to the next, so the unplugged chain from Objective 2 runs for real, in code, across the room.

You have two ways to run it. One long chain with the whole class is the simplest, and the only code change is setting CHAIN_NUM to the number of students. Or split into teams, where each team forms its own chain on its own radio channel. Teams need nonadjacent channels, all even or all odd, or they will pick up each other's signals.

🎯 Project Goal: Students add code to a program that simulates a single neuron network.

🎯

Learning Targets

  • I can collaborate in a team to form a neural chain using the CodeX devices.
  • I can write a program that uses a radio signal to communicate with other CodeX devices.
💡

Key Concepts

  • The program uses a radio signal for communication.
  • If the class is divided into multiple teams, assign each team a different nonadjacent radio channel.
✅

Assessment Opportunities

  • Turn in the Activity Guide.
  • Complete the program neural_network1.
☑

Success Criteria

  • Complete the CodeTrek steps
  • Program runs correctly without errors
  • Activity Guide is completed
📂

Digital Resources

🧰

Classroom Materials

  • ▸CodeX device and USB cable, one per student
  • ▸Laptop/computer with Chrome browser
🚀

Extensions & Cross-Curricular

ExtensionStudents who are familiar with coding can adjust some values in the code: the weighted randint range in send_signal(), any value added to or subtracted from strength, and the value added to start_time.
MathTeams run their simulation several times and collect data. The data can be made into a graph and compared with other teams' data. Use the graph to make inferences or draw conclusions, such as do teams get faster with more trials? Develop an equation to describe the data.
🐍

New Python Code

▾
CHAIN_NUM = 5Assign a value to a constant, designated by ALL CAPS. Constants are often found near the top of the code for easy access.
my_role = 0Assign an initial value to a variable, designated by all lower case letters.
📐

Standards

▾

Computer Science

9-12.AP.21
📝
Preparing for the Lesson
  • Decide up front whether you are running one class-wide chain or multiple team chains. That choice changes what students type, so make it before class starts.
  • If you are using teams, pick the radio channels yourself ahead of time. Use all even or all odd numbers so no two teams sit on adjacent channels.
  • Decide how students get the Activity Guide. You can print a copy for each student or assign it digitally.
  • Read the Hints in the objective. They add detail that complements the instructions in the Activity Guide.
  • Plan your room layout and how students will physically line up as a chain, and count heads so you know the number to use for the chain length.

🧑‍🏫
Teacher Notes
  • The Hints give additional information about the activity. You may want to emphasize this or review with the students. It complements the instructions in the activity guide.
  • The Objective has an Activity Guide for students, which can be printed or assigned digitally.
  • This is a single chain simulation. It can be run as a class and one long chain. If you use this option, the only change in code is for each student to put the number of participants (students in class) as the value for CHAIN_NUM.
  • Or, you can place students in teams, and each team can form its own chain. If you divide the class into teams, each team needs to be on its own channel. Please assist teams in selecting channels. They should not be adjacent. For example, use even numbers or odd numbers. Then the changes in code are for the students to put the number of participants (students in the team) as the value for CHAIN_NUM and the number of their radio channel for TEAM_CHANNEL.
  • Make sure that when students run the code and assign roles, that no role number is skipped. A gap in the roles breaks the chain and the signal will not make it to the end.
  • Extensions and cross-curricular projects are included to enhance the concepts in the objective. You can use the extensions to extend students' learning.
🗺️

Lesson Outline

🗣️Warm-up / Hook

Point back at the two things students have already built.

  • Ask: "You each have one neuron running on your CodeX. What would it take to connect them into the chain we made with our bodies in Objective 2?"
  • Ask: "If every CodeX in the room is shouting on the same radio channel, what goes wrong?"
Teaching tip: The second question sets up the channel rule before students hit it as a bug. Let them predict the crosstalk instead of discovering it mid-activity.
📖Set Up the Chain

Get the structure sorted before anyone starts coding.

  1. Tell students whether you are running one class chain or team chains.
  2. Assign roles in order and confirm out loud that no role number is skipped. Have students say their number down the line.
  3. Give students the chain length to use for CHAIN_NUM. For teams, also give each team its radio channel for TEAM_CHANNEL, keeping the channels nonadjacent.
  4. Hand out or assign the Activity Guide, and review the Hints with the class.
Teaching tip: Write the chain length and each team's channel on the board. Students copying a number off the board make far fewer typos than students remembering one you said out loud.
💻Student Work Time

Students build neural_network1 and run the network.

  1. Students work through the CodeTrek steps, adding code to neural_network1.
  2. Students set their constants and variables, including CHAIN_NUM and their own role number.
  3. Run the chain. The signal should travel from the first role to the last with no gaps.
  4. Run it several times, then complete the Activity Guide. Fast finishers move to the extension and start adjusting values.
Teaching tip: When a chain stalls, check the roles first and the channel second. A skipped role number and a team on an adjacent channel account for nearly every failure here, and both are faster to check than the code.
✏️Wrap-up & Review

Compare the coded network to the human one.

  • Discussion: how was the coded chain different from the unplugged chain in Objective 2, and what stayed the same?
  • Ask: "What is the radio signal standing in for in a real brain?"
  • Collect the Activity Guides.
Teaching tip: If you are doing the math extension, have teams record their run times today while the chain is still set up. Rebuilding it later just to collect data costs another class period.