Learn how to play the Distance Sensor as an instrument.
Piperbot and Pip need help soothing Baby Zomar to sleep. Play your Distance Sensor as an instrument to help. Ask students: “How does your instrument know when and what sound to play? How does an electric keyboard know how to make a sound?”
Students will use the distance measured by your Distance Sensor to play different notes like an instrument (particularly like a drum!).
Students will understand how to use variables, loops, and conditionals to convert distances to different notes using list mapping.
Students will understand how the Distance Sensor measures distance using sound waves that bounce off objects.
I WILL BE ABLE TO...
Understand how an ultrasonic sensors measure distance
Use code to associate distance to different sounds
Combine movement, sensors, and sound into an interactive system
Learning Activities
ELA Extension: Robot Miscommunication Comic
Pair students together or allow them to work independently based on writing level and creativity. Students will write a narrative that uses sensory detail, rhythm, and cause-and-effect to bring their robot drum to life in a story setting.
Begin by creating the scene. Ask: Where is the robot drum? What sets it off—sound, movement, or something unexpected? Examples: A talent show, a space concert, or a thunderstorm where the drum warns someone.
Build suspense or celebration by describing how the drum reacts. Use sound-based rhythm language like: “Boom! Boom! Pause. Tap-tap!”
Have students write their story in first- or third-person voice, describing how the robot affected the mood, helped a character, or became the center of attention. Encourage use of cause-and-effect and emotional reactions to drive the plot.
Students then trade stories with a peer for feedback on pacing, detail, and creativity. Revise based on input before final sharing.
Bonus vocabulary words to include: ultrasonic, sensor, distance, trigger, output, frequency, pattern
EXTENSION: Invite students to write a sound poem or spoken-word piece inspired by their robot drum’s rhythm and scene.
ELD Extension: Robot Drum Reaction Practice
Pair students so that each English Learner (EL) is working with a fluent or higher-level EL. Students will practice using rhythmic cues and sentence frames to describe motion-triggered sounds.
Begin with Vocabulary & Visuals. Introduce words using images or real-life props:
drum, sound, sensor, hand, move, beat, loud, soft
Practice commands and phrases with body movement:
“Wave your hand closer.”
“Move your hand far away.”
“The drum plays a sound when I ___.”
In pairs, students play a Reaction Game: One student moves their hand toward or away from an imaginary sensor. The other describes the result using sentence starters:
“When my hand is close, the drum goes ___.”
“When I move away, it ___.”
Wrap up with a Class Performance. Students act out short skits in which the robot drum responds to someone entering a room, dancing, or making a speech. End with a reflection, using visuals or sentence frames to describe what happened.
Math Extension: Distance vs. Drum Beat Data
Pair students together or allow them to work in groups based on grade level and measurement readiness. Students will measure how distance affects rhythm in the ultrasonic drum and represent results with data and logic.
Begin by testing how the drum responds at different distances. Example ranges: 0–5 cm, 6–10 cm, 11–15 cm, etc. Record how many beats happen at each range or describe the speed of rhythm.
Have students organize their data in a chart with these columns:
Distance range
Sound type (fast, medium, slow)
Beats in 10 seconds
Graph the results using a bar or line graph to visualize the relationship.
Prompt students to reflect:
“What happens as your hand gets closer?”
“What’s the relationship between distance and drum behavior?”
EXTENSION: Create Your Own Pattern
Students write custom if/then logic statements to describe how the drum should behave.
Examples:
“If distance < 5 cm, play 3 fast beats.”
“If distance > 15 cm, stay silent.”
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
Have an different version? Look for more information on the Support Page.
Troubleshooting Tips
Is the Distance Sensor not measuring distance?
Pay extra attention to the wiring diagram for this one.
Verify all your electrical connections, including that your Pico is connected to your computer.
It is common for the connections to be off by 1 or 2 holes. We recommend going through each build to ensure the connections are correct.
Don’t worry! One of the wires (NC) does not need to be connected.
How does the Distance Sensor work?
The Distance Sensor emits sound waves and measures the time it takes for them to bounce back. Measuring this determines the distance.
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
Circuit A conductive path for the flow of current or electricity.
Power The current or flow of electric charge and voltage.
Microcontroller An integrated circuit containing a microprocessor with memory and associated circuits.
Variables A value that can change depending on conditions or information passed to the program. A storage location with a symbolic name used to keep track of a value that can change while a program is running (similar concept to using X and Y in an algebraic equation). Variables are not only numbers; they can also hold text, including whole sentences (strings) or logical values (true or false).
Input Device A hardware device that sends data to a computer, allowing interaction and control.
Output Device A piece of hardware that converts information into a form humans can sense and understand.