SPEAK LIKE A MACHINE

PIPER MAKE EDUCATOR RESOURCES SERIES

To do this project, you will need a Piper Make Starter Kit. Get yours here:

Help Piperbot and Pip understand what Binator is saying!

To get started, head to Piper Make and hit this icon:

Time: 30 minutes

Age Range: 8+

Difficulty: Intermediate

In this project, students build two tactile buttons and use functions to convert from binary to decimal numbers.

Note: There are step by step instructions for the students to follow in the tutorials included in each project on Piper Make. These provide directions both for writing code and for building the electronic circuits. The tutorials are well-defined and most students will be able to follow them with little assistance required.

LEARNING OBJECTIVES

Students will:

 

  • Practice breadboarding and wiring
  • Review and understand computational concepts of:
    • loops: running the same sequence multiple times.
    • sequence: identifying a series of steps for a task
  • Demonstrate computational thinking core concepts, including:
    • Algorithm Design by creating an ordered series of instructions for solving similar problems or for doing a task, such as turning a light off and on in the right order.
  • Create programs that include events, loops, and conditionals.
  • Decompose problems into smaller, manageable tasks which may themselves be decomposed.)
  • Test and debug a program or algorithm to ensure it accomplishes the intended task.
  • Perform different roles when collaborating with peers during the design, implementation, and review stages of program development.

STANDARDS ALIGNMENT

CSTA's K-12 Standards 

1B-CS-03: Determine potential solutions to solve simple hardware and software problems using common troubleshooting strategies. Subconcept: Troubleshooting; Practice 6.2

1B-AP-09: Create programs that use variables to store and modify data. Subconcept: Variables; Practice 5.2

1B-AP-10: Create programs that include sequences, events, loops, and conditionals.Subconcept: Control; Practice 5.2

1B-AP-11: Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process. Subconcept: Modularity; Practice 3.2

1B-AP-12 Modify, remix, or incorporate portions of an existing program into one's own work, to develop something new or add more advanced features. Subconcept: Modularity; Practice 5.3

1B-AP-15 Test and debug (identify and fix errors) a program or algorithm to ensure it runs as intended. Subconcept: Program Development; Practices 6.1, 6.2

CCSS Math

CCSS.MATH.CONTENT.6.EE.A.1: Write and evaluate numerical expressions involving whole-number exponents.

CCSS.MATH.CONTENT.6.EE.A.2.C: Evaluate expressions at specific values of their variables. Include expressions that arise from formulas used in real-world problems. Perform arithmetic operations, including those involving whole-number exponents, in the conventional order when there are no parentheses to specify a particular order (Order of Operations).

CCSS ELA

CCSS.ELA.L.W.3.8: Recall information from experiences or gather information from print and digital sources; take brief notes on sources and sort evidence into provided categories.

CCSS.ELA.L.W.3.10: Write routinely over extended time frames (time for research, reflection, and revision) and shorter time frames (a single sitting or a day or two) for a range of discipline-specific tasks, purposes, and audiences.

World-Class Instructional Design and Assessment (WIDA) English Language Proficiency Standards

ELD-SI.K-3.Argue:

  • Ask questions about others’ opinions
  • Support own opinions with reasons
  • Clarify and elaborate ideas based on feedback
  • Defend change in one’s own thinking
  • Revise one’s own opinions based on new information

 

ELD-SC.2-3.Argue.Interpretive:

  • Interpret scientific arguments by
  • Identifying potential evidence from data, models, and/or information from investigations of phenomena or design solutions
  • Analyzing whether evidence is relevant or not
  • Distinguishing between evidence and opinions

California's K-12 Computer Science Standards

3-5.CS.3: Determine potential solutions to solve simple hardware and software problems using common troubleshooting strategies.

3-5.AP.11: Create programs that use variables to store and modify data.

3-5.AP.12: Create programs that include events, loops, and conditionals.

3-5.AP.13: Decompose problems into smaller, manageable tasks which may themselves be decomposed.

3-5.AP.14: Create programs by incorporating smaller portions of existing programs, to develop something new or add more advanced features.

3-5.AP.17: Test and debug a program or algorithm to ensure it accomplishes the intended task.

Math Content Standards

CCSS.MATH.CONTENT.6.EE.A.1: Write and evaluate numerical expressions involving whole-number exponents.

CCSS.MATH.CONTENT.6.EE.A.2.C: Evaluate expressions at specific values of their variables. Include expressions that arise from formulas used in real-world problems. Perform arithmetic operations, including those involving whole-number exponents, in the conventional order when there are no parentheses to specify a particular order (Order of Operations).

Common Core English Language Arts

CCSS.ELA.L.W.3.8: Recall information from experiences or gather information from print and digital sources; take brief notes on sources and sort evidence into provided categories.

CCSS.ELA.L.W.3.10: Write routinely over extended time frames (time for research, reflection, and revision) and shorter time frames (a single sitting or a day or two) for a range of discipline-specific tasks, purposes, and audiences.

California English Language Development Standards

CA ELD.3.C.11: Supporting own opinions and evaluating others’ opinions in speaking and writing

CA ELD.3.C.12: Selecting and applying varied and precise vocabulary and language structures to effectively convey ideas

Michigan Integrated Technology Competencies for Students (MITECS)

1B-CS-03: Determine potential solutions to solve simple hardware and software problems using common troubleshooting strategies. Subconcept: Troubleshooting; Practice 6.2

1B-AP-09: Create programs that use variables to store and modify data. Subconcept: Variables; Practice 5.2

1B-AP-10: Create programs that include sequences, events, loops, and conditionals.Subconcept: Control; Practice 5.2

1B-AP-11: Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process. Subconcept: Modularity; Practice 3.2

1B-AP-12 Modify, remix, or incorporate portions of an existing program into one's own work, to develop something new or add more advanced features. Subconcept: Modularity; Practice 5.3

1B-AP-15 Test and debug (identify and fix errors) a program or algorithm to ensure it runs as intended. Subconcept: Program Development; Practices 6.1, 6.2

Michigan Math Standards

6.EE.1: Write and evaluate numerical expressions involving whole-number exponents.

6.EE.1.c: Evaluate expressions at specific values of their variables. Include expressions that arise from formulas used in real-world problems. Perform arithmetic operations, including those involving whole number exponents, in the conventional order when there are no parentheses to specify a particular order (Order of Operations).

Michigan English Language Arts

Michigan ELA, Grade 3-8, Research, 8: Recall information from experiences or gather information from print and digital sources; take brief notes on sources and sort evidence into provided categories.

Michigan ELA, Grade 3-8, Range of Writing, 10: Write routinely over extended time frames (time for research, reflection, and revision) and shorter time frames (a single sitting or a day or two) for a range of discipline-specific tasks, purposes, and audiences.

WIDA English Language Development

ELD-SI.K-3.Argue:

  • Ask questions about others’ opinions
  • Support own opinions with reasons
  • Clarify and elaborate ideas based on feedback
  • Defend change in one’s own thinking
  • Revise one’s own opinions based on new information

 

ELD-SC.2-3.Argue.Interpretive:

  • Interpret scientific arguments by
  • Identifying potential evidence from data, models, and/or information from investigations of phenomena or design solutions
  • Analyzing whether evidence is relevant or not
  • Distinguishing between evidence and opinions

Science Texas Essential Knowledge & Skills

Grade 3

(b)(2) Scientific investigation and reasoning. The student uses scientific practices during laboratory and outdoor investigations. The student is expected to:
(A) plan and implement descriptive investigations, including asking and answering questions, making inferences, and selecting and using equipment or technology needed, to solve a specific problem in the natural world;

(b)(3) Scientific investigation and reasoning. The student knows that information, critical thinking, scientific problem solving, and the contributions of scientists are used in making decisions.

Grade 4

(a)(1)(A) Within the physical environment, students know about the physical properties of matter including mass, volume, states of matter, temperature, magnetism, and the ability to sink or float. Students will differentiate among forms of energy including mechanical, light, sound, and thermal energy. Students will explore electrical circuits and design descriptive investigations to explore the effect of force on objects.

(b)(3) Scientific investigation and reasoning. The student uses critical thinking and scientific problem solving to make informed decisions. The student is expected to:

    (A) analyze, evaluate, and critique scientific explanations by using evidence, logical reasoning, and experimental and observational testing;

    (B) represent the natural world using models such as the water cycle and stream tables and identify their limitations, including accuracy and size; and

    (C) connect grade-level appropriate science concepts with the history of science, science careers, and contributions of scientists.

Grade 5

(a)(1) In Grade 5, scientific investigations are used to learn about the natural world. Students should understand that certain types of questions can be answered by investigations and that methods, models, and conclusions built from these investigations change as new observations are made. Models of objects and events are tools for understanding the natural world and can show how systems work. They have limitations and based on new discoveries are constantly being modified to more closely reflect the natural world.

(a)(3) Recurring themes are pervasive in sciences, mathematics, and technology. These ideas transcend disciplinary boundaries and include patterns, cycles, systems, models, and change and constancy.

Math Texas Essential Knowledge & Skills Grade 6

(7) Expressions, equations, and relationships. The student applies mathematical process standards to develop concepts of expressions and equations. The student is expected to:
(A) generate equivalent numerical expressions using order of operations, including whole number exponents and prime factorization;

ELA Texas Essential Knowledge & Skills Grade 3

(b) (1)Developing and sustaining foundational language skills: listening, speaking, discussion, and thinking--oral language. The student develops oral language through listening, speaking, and discussion. The student is expected to:

    (A) listen actively, ask relevant questions to clarify information, and make pertinent comments;

    (B) follow, restate, and give oral instructions that involve a series of related sequences of action;

    (C) speak coherently about the topic under discussion, employing eye contact, speaking rate, volume, enunciation, and the conventions of language to communicate ideas effectively;

    (D) work collaboratively with others by following agreed-upon rules, norms, and protocols; and

    (E) develop social communication such as conversing politely in all situations.

ELA Texas Essential Knowledge & Skills Grades 4 & 5

(b) (1)Developing and sustaining foundational language skills: listening, speaking, discussion, and thinking--oral language. The student develops oral language through listening, speaking, and discussion. The student is expected to:

    (A) listen actively, ask relevant questions to clarify information, and make pertinent comments;

    (B) follow, restate, and give oral instructions that involve a series of related sequences of action;

    (C) express an opinion supported by accurate information, employing eye contact, speaking rate, volume, enunciation, and the conventions of language to communicate ideas effectively; and

    (D) work collaboratively with others to develop a plan of shared responsibilities.

(b)(13) Inquiry and research: listening, speaking, reading, writing, and thinking using multiple texts. The student engages in both short-term and sustained recursive inquiry processes for a variety of purposes. The student is expected to:

    (A) generate and clarify questions on a topic for formal and informal inquiry;

    (B) develop and follow a research plan with adult assistance;

    (C) identify and gather relevant information from a variety of sources;

    (D) understand credibility of primary and secondary sources;

    (E) demonstrate understanding of information gathered;

    (F) differentiate between paraphrasing and plagiarism when using source materials;

    (G) develop a bibliography; and

    (H) use an appropriate mode of delivery, whether written, oral, or multimodal, to present results.

§74.4. English Language Proficiency Standards

(c) Cross-curricular second language acquisition essential knowledge and skills.

(3) Cross-curricular second language acquisition/speaking.

(D) speak using grade-level content area vocabulary in context to internalize new English words and build academic language proficiency;

(E) share information in cooperative learning interactions;

(F) ask and give information ranging from using a very limited bank of high-frequency, high-need, concrete vocabulary, including key words and expressions needed for basic communication in academic and social contexts, to using abstract and content-based vocabulary during extended speaking assignments;

(G) express opinions, ideas, and feelings ranging from communicating single words and short phrases to participating in extended discussions on a variety of social and grade-appropriate academic topics;

(H) narrate, describe, and explain with increasing specificity and detail as more English is acquired;

CONCEPTS

Students will help translate Binator's language, binary, using functions and two tactile buttons.

PARTS

Raspberry Pi Pico, breadboard, charging cable, M2M Blue Jumper Wire, M2M Green Jumper Wire, 2 M2M Black Jumper Wires, 2 Small Tactile Buttons

GPIO SETUP

Tactile Button GP13, Tactile Button GP14

OVERVIEW OF STEPS

Step 1: Beep Boop, Binator.

Help Piperbot and Pip understand what Binator is saying! Maybe it's the code to get into that old safe that has the tools they need...

Step 2: Binary Code

We're going to start by building a simple keypad—one button for 1 and one for 0. Then we're going to write a function that decodes machine language (ahem, binary) and prints out values that are well, more human language (that's base 10).

Click NEXT.

Step 3: Gather Your Supplies

Let's gather our things, we're going to need some wires and two buttons to start!

Click NEXT.

Step 4: Wire Up Your Buttons

Set up your buttons like you see here, and make sure you connect one side of each button to a ground pin on the Pico and the other side to the GPIO pin shown in the picture below:

Click NEXT.

Step 5: Let's Get Coding

Open the Functions menu and grab a to do something block. Drag the block out to the workspace. Change the name of your new function to "scan buttons".

Then, let's define a variable called number value. Click the Variables menu, then click the Create variable... button, and then enter "number value" as the name.

When button 1 is pressed, we want to add a value to the number value variable. Our variable needs to start at zero, so grab the set number value block and add it to the to scan buttons function.

Click NEXT.

Step 6: How Does Binary Work?

We are used to counting and working with decimal numbers. Decimal numbers use powers of 10.

And instead of powers of 10 for each place - binary uses powers of 2.

We can enter an 8 digit binary number. This means we need two blocks - a loop that keeps track of the count, and a list of the binary place values.

Let's add the loop first. Grab a for each item block from the Loops menu and add it to the to scan buttons block. Now we need the list. Grab a create list with block from the Lists menu and drag it into the input of the for each item block.

Now, click the blue gear icon on the create list with block. This will open a mini-workspace just for the create list with block. Add item blocks until you have a total of 8 inputs. Then click the blue gear icon again to close the mini-workspace.

Click NEXT.

Step 7: Powers of Two

Grab a 0 block from the Values menu and add it to the first input of the create list with block. Do this gain 7 more times until all of the inputs are filled.

Click NEXT.

Step 8: Wait For It...

Grab a wait until block from the Chip block and place it inside of the for each item block. Next, grab an and block from the Logic menu and place it into the input of the wait until block.

Since our buttons are connected to GP13 and GP14 we need to wait until either one of them is pressed. Grab an is pin block from the Chip menu and place it into the first input of the or block. Change the pin number to 13. Grab another is pin block, drag it into the second input of the or block, and change its pin number to 14.

Click NEXT.

Step 9: Which Button?

Grab an if do else block from the Logic menu. Right-click the is pin 13 block and select Duplicate. Drag the new copy of the block into the input of the if do else block.

Grab a change by block Variables menu and place it in the do part of the if do else block. Set the variable to number value. Then, grab an i block from the Variables menu and it in the input where the 1 is in the change number value by block:

Since the left-most digit of an 8 digit binary number has a place value of 128, it grabs that value first, and if we pressed the left button on our two-button keyboard, we 128 to our number value variable. Each time the loop goes around, it grabs the next value in the list.

Click NEXT.

Step 10: Feedback

A response like that is called "Feedback", and it's an important part of any device that gets input from a user!

Grab a print without new line from the Chip menu and place it below the change number value block. Type 1 into the "_" block. Grab another print without new line from the Chip menu and place it into the else part of the if do else block. Type 0 into the "_" block:

Step 11: Wait Some More...

If our program doesn't wait for the button's release, it will loop around again and treat it like another button press.

Grab a wait until block from the Chip block and place it below the print "1" without new line block. Change the until to while. Right-click one of the is pin 13 blocks from earlier in the program and select Duplicate. Place the new block into the input of the wait while block. Duplicate the wait while block and place the new copy below the print "0" without new line block. Change the 13 to 14:

Step 12: Start Putting it Together

Drag a start block from the Chip menu onto the workspace:

Grab a repeat forever block from the Functions menu and connect it below the start block. Then, grab a scan buttons block from the Functions menu and place it into the repeat forever block:

Step 13: Shout The Number

Grab a shout block from the Chip menu and connect it below the scan buttons block in the repeat forever block.

Drag the "_" block out of the shout block and drag it to the trash can to delete it. Then, grab a number value block from the variables menu and place it into the shout block:

Step 14: Try it Out!

Now it’s time to run our code and test it yourself!

Click CONNECT. Select your Pico and then click START.

Click the Console tab at the bottom of the workspace to see what buttons you are pressing.

Press the buttons and see how the combinations of zeroes and ones form numbers.

Step 15: You Finished!

Once you’re ready to quiz yourself, pick a number between 0 and 255. Using the buttons, try to find the correct combinations of ones and zeroes that make up the number you chose.

Once you've gotten a good feel for how binary works, let's try going from machine to human language by switching from binary to decimal! To do so, simply change the values in the create list with block - try 1000000, 1000000, 100000, 10000, 1000, 100, 10, and 1. You can also adjust the length of the input by changing how many values are in the create list with block.


Click EXIT to return to the menu and start your next coding challenge.