PIPER MAKE

EDUCATOR GUIDES


YOU ARE HERE

Sensors expedition

Mission 3 of 6

Sensors expedition: Mission 3 of 6

Resistor Piano


Intermediate

1 hour

Grades 3 - 8

MISSION OBJECTIVE

Learn to create a piano using resistors.

Take our musical talents to the next level as Piperbot and Pip jam out with their new Adult Zomar buddy on a piano made of resistors. Ask students: “What is your code measuring to know when and what sound to play? How is this different from your ultrasonic drum?”

View student interface at make.playpiper.com
MISSION CHARACTERS

Piperbot

Pip

Adult Zomar
MISSION MATERIALS

Computer with USB port and Chrome or Edge browser
Piper Make Base Station or Starter Kit

MISSION RESOURCES

Learning Goals

  1. Students will create a panel of resistors and use a jumper wire to “play notes” and craft musical creations.
  2. Students will understand how to use lists and mapping in code to map a voltage to a sound.
  3. Students will understand how voltage drops are associated with the number of resistors set up in series, as shown in the circuitry.
I WILL BE ABLE TO...
  • Create my own musical creations by “playing notes” on a panel of resistors using a jumper wire
  • Understand how resistors set up in series are associated with voltage drops

Learning Activities

ELA Extension: Resistor Piano Narrative

  • Pair students together or allow them to work independently based on writing level and interest. Students will write a first-person narrative, journal entry, or fictional article from the perspective of a robot, inventor, or musician who creates or discovers a piano powered by resistors.
  • Start by setting the scene. Ask students: Where is the resistor piano? Is it on Earth, Mars, or in a secret underground lab? Who built it—and why?
  • Next, describe the moment the character realizes the resistors make different sounds. Use language that captures discovery and wonder, such as:
    • “Each note buzzed like a hummingbird’s wings.”
    • “The red resistor hummed low and steady, like a cello.”
  • Have students compose a song through description. Encourage sensory detail, musical metaphors, and emotional reactions to the sound.
  • Wrap up the story with a reflective paragraph from the robot or musician about what they learned—about sound, coding, creativity, or connection.

Bonus vocabulary words to include: resistor, tone, input, sound, circuit, frequency, value

EXTENSION: Students illustrate the keys of their piano and annotate which resistor values create specific tones. Then, write a “behind-the-scenes” artist statement explaining their creative process.


ELD Extension: Resistor Piano Language Practice
  • Pair students up so that one English Learner (EL) works with one other student who is a non-EL or a higher-level EL. They will begin by exploring different tones from the resistor piano together. One student will press a key while the other describes the sound using sentence frames and visual supports.
    Examples:
    • “The red resistor sounds ___.”
    • “It was higher/lower than the last one.”
    • “I played the ___ resistor. It sounded like ___.”
  • Students will then switch roles and repeat the activity, ensuring both partners practice describing and listening. After both students have taken turns, they will draw a simple diagram of the resistor piano and label the keys with words or symbols that represent the sounds they heard.
  • Each student will then retell what their partner described, using their drawing and sentence frames to support accuracy.
    Examples:
    • “My partner said the green resistor was soft.”
    • “They thought the blue one sounded like a bell.”
  • Partners will give each other feedback based on how clearly and accurately the sounds were described and retold.

Math Extension: Resistor Piano Data & Patterns
  • Pair students together or allow them to choose their partners. Partner A will press the resistor piano buttons, while Partner B records the timing, order, and tones. Then, they will switch roles.
  • Connect back to sound sequencing and ask students to describe the pattern they hear using everyday or musical language (e.g., “It went slow-fast-slow,” or “It repeated the first note twice.”)
  • Start by having students record the following during play:
    • The order of notes played (e.g., 1-2-3-2-1)
    • The timing between each press (e.g., 1 second, 2 seconds)
    • The tone of each note (e.g., low beep, high beep)
  • Then have students create a Rhythm Chart to organize their data, showing:
    • Button press order
    • Time delay between presses
    • Tone labels or pitch categories
  • Have students graph their pattern using a bar chart or line graph:
    • X-axis = time or button order
    • Y-axis = tone pitch or category label
  • Encourage students to describe the pattern mathematically:
    • “Every 2nd note is repeated.”
    • “The tone changes every 3rd beat.”
    • “Note = Button number × delay in seconds”
  • Finally, challenge students to compose a repeating pattern using sequencing and logic, such as ABAB or ABCABC, and label it using ordinal numbers or functions.

Bonus vocabulary words to include: sequence, pattern, input, delay, repeat, order, output.


Career Connections

Robotics Engineer: Salary $104,600/yr
Automotive Engineer: Salary $95,300/yr
Civil Engineer: Salary $88,050/yr
Electro-Mechanical and Mechtronics Technicians: Salary $60,570/yr

Hardware Diagram




Code Diagram




Tutorial Steps

Resistor Piano

We are going to build a musical instrument using your Pico, a few wires, and a lot of Resistors! Do you remember using Resistors in the Blink and Stoplight tutorials?

A Resistor is used to limit the flow of electricity. One of the ways we can use Resistors is to divide a voltage. If we use a lot of Resistors, we can make something that has a bunch of different voltages - and that's what we will use to tell the Pico and your computer what notes to play!
Click NEXT to get started!

Before you build your circuit, please look at the drawing below.

When you "play" your Resistor piano, you will touch one end of the green wire to the Resistor leads marked with numbers in the drawing below.

There are two areas where you should NOT touch the green wire. They are marked with the yellow triangle symbol:
Touching the green wire to the areas marked with the yellow triangles ⚠️ will cause a short circuit and could damage your Pico module.

Your Pico has a protection circuit, but it's best not to take an unnecessary risk.

Click NEXT.

Let's start by gathering our supplies. You'll need your Pico and Breadboard, ten 330 Ω Resistors, and five Jumper wires.

The Jumper wires don't have to be the same color as the ones in the diagrams - you can use any color wires that you have.
Click NEXT to start building your circuit!

Let's build the circuit! Use the diagram below to place 10 Resistors on the Breadboard. Start in the lower-right corner, and insert them from right to left.
Make sure that the lead of one Resistor is in the same Breadboard row as the lead of the next one.
Even though you are putting 10 Resistors into your circuit, your piano will only play 9 notes. Don't worry, we'll explain why later.

After all ten Resistors are inserted, connect one of the black Jumper wires from the right-most Resistor's right lead to a pin in the GROUND rail at the top of the Breadboard. Then, connect another black Jumper wire from a GROUND pin on the Pico to the GROUND rail at the top of the Breadboard.

Next, connect the red Jumper wire from the left-most Resistor's left lead to the Pico's 3.3V pin.

Then, connect the blue Jumper wire from the second Resistor's left lead to the A2 pin of the Pico.

Finally, connect one end of the green Jumper wire into the same Breadboard row as the black Jumper wire and the right-most Resistor.

Once you've built your circuit, click NEXT.

Why are there so may Resistors? It's because we are using them as a big voltage divider:
The image above shows a few different voltage dividers. When ground is connected to one end and a voltage is connected to the other, the junctions in between each Resistor will be at a fraction of the voltage from one end of the voltage divider to the other end of the voltage divider.

Look carefully at the image above. If the circuit has two Resistors, the junction will be at 1/2 of the voltage. If there are five Resistors in the circuit, then the first junction will be 4/5 of the voltage.

Click NEXT.

You may have noticed that one of the Jumper wires was connected to a GPIO pin named A2. The "A" stands for analog.

Most of the pins on the Pico are digital. this means that when they are set as an input, they can only tell if the voltage coming into the pin is closer to 3.3 volts (ON) or closer to 0 volts (OFF). An analog pin can read any voltage between 0 and 3.3 volts.

This means that we can connect it to our voltage divider and read all of the different voltages that our voltage divider makes!

Let's try it out! Build the program below by dragging out a start block, a repeat forever block, a print block, and a read voltage from block and connecting them together. Set the wait time in the repeat forever block to 0.5 seconds:
You can delete the "_" block. Then, set the pin variable on the read voltage from block to A2.

Click NEXT.

Click on the CONSOLE tab at the bottom of the workspace to open it.

Then, click CONNECT and START to run the testing program.

The console will start displaying numbers - try touching the green wire to the leads of the Resistors:
When you touch the green wire to each point, the console will show a different value. Do you see the pattern yet?

If you touch the green wire to the lead labeled (1) in the image above, the console should show 0 (or something very close to it). This is because when you make that connection, you are connecting pin A2 to 0V (ground).

When you touch the green wire to lead (2), you console should show approximately 1.7.
This is because your are making a voltage divider with pin A2 in the middle between 3.3V and 0V.

Lead (3) should show approximately 2.2. 2/3 of 3.3V is 2.2.

Lead (4) should show approximately 2.5. 3/4 of 3.3V is 2.5.

Do you see the pattern yet? Click NEXT.

Go ahead and click STOP if your program is still running.
Did you notice that the values in the console match what we learned about voltage dividers?
Our circuit can detect different values from our voltage divider, but the numbers are hard to use. The good news is that we can do a little bit of math to make them easier to use!

Click NEXT to find out how.

If we do a little bit of subtraction, we can make the value from pin A2 easier to use.

The voltage of our circuit is 3.3V. All we have to do is take 3.3V minus the value from pin A2:
Click NEXT.

We can use blocks from the Logic and Values menus to do a little bit of math.

First, pull the read voltage from pin block out of the print block.

Drag out a _ + _ block from the Logic menu and place it in the print block. Then, grab a 0 block from the Values menu and place it into the left side of the _ + _ block.

Place the read voltage from pin block into the right side of the _ + _ block. Finally, change the "+" (plus) to a "-" (minus), and change the 0 to 3.3:
If you run your program, the CONSOLE will show these approximate values when you touch the green wire to the different Resistor leads:

Lead (1) → 3.3Lead (2) → 1.65Lead (3) → 1.10Lead (4) → 0.83Lead (5) → 0.67

We are getting closer, but with a little more math, we can actually see which lead the green wire is touching.

Click NEXT to find out how.

You might have noticed that the bottom part of the fraction is actually the number of the lead the green wire is touching. Touching the green wire to lead (1) is 1/1 of 3.3V, lead (2) is 1/2 of 3.3V, and lead (3) is 1/3 of 3.3V.

All we have to do is get the bottom number of the fraction by itself. We do that by dividing 3.3 by our value:
Click NEXT to learn how we will do this in our program.

First, pull the 3.3 - read voltage from blocks out of the print block.

Drag out a round block from the Values menu and place it into the print block.
Drag out a _ + _ block from the Logic menu and place it in the round block. Then, grab a 0 block from the Values menu and place it into the left side of the _ + _ block.

Then, change the "+" (plus) to a "÷" (divide by), and change the 0 to 3.3. Finally, place the 3.3 - read voltage from blocks into the right side of the _ ÷ _ block:
Now, when you run your program, the CONSOLE will show which lead the green wire is touching.

Cool, right? One more thing - what is the value in the CONSOLE when the green wire is not touching any of the Resistor leads? Make a note if it because we are going to need to know that for later.

Click NEXT.

Now that we know what lead is being touched with the green wire, it's time to use that to play different notes.

Let's start by storing which Resistor lead is being touched by the green wire into a variable.

Click the Variables menu and create a variable named "note played."

Drag out the set note played to block into the repeat forever loop. Then, pull the blocks from the inside of the print block out and place them in the set note played to block. Finally, delete the empty print block:
Click NEXT.

Now it's time to make a list of notes that can be played. Click on the Variables menu can then click the Create variable button. Name your new variable "note list."

Drag out the set note list to block and place it right after the start block. Then, grab a create list with block from the Lists menu and drag it into the set note list to block:
Our circuit can play 9 different notes, so let's add more blanks to our list.

Click the blue gear icon. Drag item blocks into the stack of item blocks until there are 9 of them. Then, click the blue gear icon to close the block's menu:
Click NEXT.

Now we are ready to add notes to the list.

Click the Values menu to open it. Near the bottom of the list, there is a note block. Drag 9 of those blocks into the list you created in the last step.

Then, click on the variable of each note block and choose a different note for each block:
The create list block is huge! Since it takes up so much space, it makes it a bit tricky to work with our program - so let's make it smaller!

Right-click the create list block and choose "Collapse Block."

If you need to make it bigger again so that you can make changes to it, you can always right-click it again and choose "Expand Block."

Click NEXT.

Remember a few slides back when we noticed what number the program showed when the green wire was not touching a Resistor lead?

10 or 11, right? Basically, our program should only play a note if the note played variable is less than 10.

We want our program to keep reading the A2 pin untilthe note we play is less than 10, and if it is less than 10, exit the loop.

Drag an if _ = _ block from the Logic menu and connect it below the set note played block inside of the repeat forever block. Change the "=" to a ">."

Grab a note played block from the Variables menu and drag it into the left side of the _ > _ block. Drag a 0 block from the Values menu and place it into the right side of the _ > _ block. Change the value to 9.
Set the repeat forever block's wait time to 0. Grab the repeat forever block and pull it away from the set note list block.

Then, grab another repeat forever block from the Loops menu and connect it to the set note list block. Finally, put the first repeat forever block into the new one:
Click NEXT.

Let's add the block that will play our notes.

Drag out a play sound block from the Sounds menu and connect it after the inside repeat forever block.

Drag out a instrument block from the Sounds menu and place it into the play sound block. Finally, delete the note block in the instrument block's pitch input:
Click NEXT.

Since we made a list of notes earlier, we can tell the Pico to play a note from that list using the in list _ get block from the Lists menu.

Drag that block out and place it in the pitch input of the instrument block.

Grab a note list block from the Variables menu and place it in the left side of the in list block. Then, grab a note played block from the Variables menu and place it in the right side of the in list block.

Finally, change the wait time of the outside repeat forever block to 0.15 seconds.
Click NEXT.

Now click START and touch the green wire to the Resistor leads. Is your Resistor Piano playing beautiful music?

Click EXIT to return to the home screen and try out more tutorials!

Blueprint

OPEN IN BLUEPRINT VIEWER  DOWNLOAD

Have an different version? Look for more information on the Support Page.

Troubleshooting Tips

  • Are some notes failing to play when you touch the jumper wire to the resistors?
    • Make sure you touch the jumper wire to the metal part of the resistor instead of the plastic.
    • Ensure that you have set up the resistors correctly with the metal leads lined up along the rails so they complete the circuit. Check the wiring diagram if you’re not sure.
  • Why do you have to be careful with the top portion of the Pico?
    • Touching the green wire to the areas marked with the yellow triangles ⚠️ will cause a short circuit and could damage your Pico module. Be careful!

Our customer support specialists are on hand to ensure your implementation of Piper runs seamlessly.
View Support Docs or Contact Support
EXPANDED RESOURCES

Term Glossary


Engineer Someone who designs, builds, or fixes things to solve problems.

Sensor A device that produces an output signal to sense a physical phenomenon.

Conditional Statement A coding instruction used to compare values and express and make decisions, like an if-then statement.

List A sequence of several values grouped under a single name in code. A group of items or components. A tool used to store multiple pieces of information at once.

View Full Glossary

Standards Alignment


Individual Standards
  • CA 3-5.CS.1 Describe how computing devices connect to other components to form a system. (P7.2)
  • 3-5.AP.18 Perform different roles when collaborating with peers during the design, implementation, and review stages of program development.