Educator Resource Servo Bug – Piper

SERVO BUG

PIPER MAKE EDUCATOR RESOURCES SERIES

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

Create your very own Servo Bug and program it to walk!

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

Time: 60 minutes

Age Range: 8+

Difficulty: Advanced

In this project, students build a walking servo bug using loops, angles and buttons.

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.
    • Simulation by developing a program to imitate a real-world process.
  • 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-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; Practice 6.1, 6.2

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.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.

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-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; Practice 6.1, 6.2

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.

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 implement loops and buttons on the breadboard to make their Servo Bug walk forward and backward.

PARTS

Raspberry Pi Pico, breadboard, charging cable, 2 M2M Blue Jumper Wires, 2 M2M Green Jumper Wires, 2 M2M Yellow Jumper Wires, 2 M2M Red Jumper Wires, 2 M2M Black Jumper Wires, 2 Servo Motors, 2 Tactile Buttons

GPIO SETUP

Black Jumper Ground, Yellow Jumper GP1, Yellow Jumper GP2, Push Button GP14, Push Button GP15

OVERVIEW OF STEPS

Step 1: Let's make a robot!

Robots are cool, right? In this tutorial, we are going to make a small robot that crawls like a bug!

Step 2: Collect your Materials

You'll need a lot of jumper wires to make your robot. Each motor needs 3 wires, and each button needs 2 wires — that's 10 wires!

You'll also need the parts that came with the servos. 2 wood pieces, 4 adhesive squares, and 4 rubber feet (black or clear).

Once you have all of your parts ready, click NEXT.

Step 3: Build the circuit

IMPORTANT: Before you start connecting any wires, make sure your Pico is unplugged from your computer.

Motors use a little bit more power than anything else you may have connected to your Pico so far - so we are going to make all of our connections carefully.

Start by connecting the two red jumper wires. Plug one end into the breadboard row of the 5V pin on the Pico. Then, plug the other end of each wire into the middle socket of each servo motors' 3-pin cables.

Connect the two black jumper wires to the breadboard row connected to the Pico's GROUND pin, and plug the other ends of the jumper wires into the socket of the servo motors' 3-pin cables that lines up with each connector's black wire.

Next, connect one of the yellow jumper wires to GP1 on the Pico. Plug the other end of the jumper wire into the last socket on one of the servo's cables. Connect the other yellow jumper wire from GP2 to the other servo's cable.

Finally, using the jumper wires you have left, connect one side of each of the two pushbuttons to GP14 and GP15 and the other side to one of the Pico's GROUND pins like it is shown in the image above.

When your wiring is finished, click NEXT.

Step 4: Centering the servos

When you opened up the bag with the servo, you probably noticed a few funny-looking parts in the bag. The small white plastic pieces are called "horns". There are several differently-shaped horns in the bag, but for this project, you need the largest one.

Before you attach any of the horns to the servos, we need to center the servos. This means that we are going to send the servos a command that turns their outputs to the middle.

To do this, grab a start block from the Chip menu and drag it into the workspace.

Then, grab a servo pin block from the Action menu and attach it to the start block. Right-click the servo pin block and select "Duplicate" to make a copy. Attach the new servo pin block to the end of the program.

Set the second servo pin block's pin variable to 1.

Once you've built the program above, plug in your Pico to your computer's USB port, click CONNECT, and then click START.

Did that make you jump just a bit? :)

The servos will move a little and then stop. Go ahead and click STOP, and then click NEXT.

Step 5: Attach the horns

Now that our servos are both centered, go ahead and attach the servos' horns. Align them like the image below shows, and push them on.

Step 6: Let's try some angles

Look at the animation below. It shows a servo turning to 60° and then turning to 120°.

Try experimenting with different angles in your blocks to see what your servos will do.

Step 7: Attach the feet

Find the rubber feet, adhesive squares, and wood pieces. We are going to use them to build your Servo Bug.

Let's start with the feet. Peel the rubber feet off of the sheet they came on and press them onto the servo horns like it shows in the image below.

Do this to both servos, and then click NEXT.

Step 8: Attach the Adhesive Squares

Now we're going to work on giving our servo bug its body. Grab both of the wood pieces and the 4 adhesive squares. Peel the paper off of the adhesive squares to expose the sticky sides and attach them to the wood pieces like it shows in the image below.

Step 9: Attach the Servos

There are few important things you need to know before you attach the servos to the first wood piece.

First, there needs to be an angle between the servos. If you align the servos to the top edge of the wood piece, it should create a 25° angle between the servos.

Second, make sure the servos are turned so that the feet on the front of the bug are not too close to the feet on the back of the bug.

Double check both the angle and that the servos are flipped the right way before you stick them onto the first wood piece.

Once both servos are attached to the first piece of wood, attach the other piece of wood to the other side.

Then, click NEXT.

Step 10: How does it walk?

Look carefully at the animation of a dog running below. Notice how the feet on one side come together, and then they move apart and the feet of the other side come together?

We are going to imitate this movement with the servos.

Step 11: Start Coding the Walk

Now we want to change our code so we can set the angle to change in a way that lets the servo bug "walk forward." How could we create a loop that does that?

Start by dragging out your servo pin blocks from the start block. Drag out a repeat forever block from the Loops menu and connect it to the start block. Then, grab a repeat while true block and place it inside of the repeat forever block.

Put the servo pin blocks inside of the repeat while true block.

Inside of the repeat while true block, you will need 4 servo pin blocks. You can right-click a block and select "Duplicate" to make a copy.

Finally, grab a wait block from the Chip menu and connect it right below the first servo pin block. Do this 3 more times so that there is a wait block right after each servo pin block.

Step 12: Do the Bug Walk!

Set all of the wait block times to 0.25 seconds. Then, set the servo pin blocks so they are in this order:

- servo pin 0 set angle to 60
- servo pin 1 set angle to 120
- servo pin 0 set angle to 120
- servo pin 1 set angle to 60

Then, set the repeat forever block's wait time to 0.

Once your program is ready, click START. Your Servo Bug should start walking.

Once it's working and you've tried it out, click STOP. Then, click NEXT.

Step 13: Really Push Its Buttons

Now, let's try to control our Servo Bug using the pushbuttons. Pull the true block out of the repeat while block and drag it to the trash can.

Grab an is pin block from the Chip menu and place it where the true block was in the repeat while block. Set the pin variable to 14.

Next, right-click the repeat while block and select "Duplicate". Grab the new blocks and connect them right below the first repeat while block.

Change the second is pin block's pin variable to 15. Then, inside of the second repeat while loop, change the servo pin blocks so they are set to these values:

- servo pin 0 set angle to 60
- servo pin 1 set angle to 60
- servo pin 0 set angle to 120
- servo pin 1 set angle to 120

Once your program is ready, click START. Press the buttons on your breadboard to make your Servo Bug walk forward and backward.

When you're done, click STOP. Then, click NEXT.

Step 14: Make it Your Own!

Now that you've got your bug moving, let's take Piperbot and Pip for a ride!

Go ahead and cut the outline of Piperbot and Pip from your card and insert the black tab into the slot between your servo motors.

Now let's change up what Piperbot and Pip are riding on by adding designs to our wood pieces! All you have to do is cut out a design and use your remaining adhesive squares to attach them on.

Maybe you want them to be riding a ladybug? Or how about a turtle? Ooh or maybe even the Mars Rover? Here are some rough outlines to get you started, print them out and then create and color your own! Click here to open the outlines in a new tab.

Share your designs with us on social media using the handle @startwithpiper or email them to us at hi@playpiper.com

Step 15: You've Finished!

Here are some challenges for you to try with your Servo Bug:

- Make it go faster or slower by changing the wait block times.
- Make it veer to the right or to the left by making small adjustments to some of the servo angles.