Hands-on Activity: Music by Touch: Programming Robot Tactile Sensors to Play Sounds

Contributed by: GK-12 Program, Computational Neurobiology Center, College of Engineering, University of Missouri

Two photographs: A palm-sized gray plastic device (LEGO touch sensor). A girl pushes a button on a remote control device in her hand.
Students program LEGO robots to respond to information from touch sensors. Tactile sensors are used in the remote control devices we use every day.
Copyright © (left) LEGO https://shop.lego.com/en-CA/EV3-Touch-Sensor-45507 (right) 2004 Microsoft Corporation, One Microsoft Way, Redmond, WA 98052-6399 USA. All rights reserved. http://office.microsoft.com/en-us/images/results.aspx?qu=remote+control&ex=1#ai:MP900411755|


Students' understanding of how robotic touch sensors work is reinforced through a hands-on design challenge involving LEGO® MINDSTORMS® EV3 intelligent bricks, motors and touch sensors. They learn programming skills and logic design in parallel as they program robot computers to play sounds and rotate a wheel when a touch sensor is pressed, and then produce different responses if a different touch sensor is activated. Students see first-hand how robots can take input from sensors and use it to make decisions to move as programmed, including simultaneously moving a motor and playing music. A PowerPoint® presentation and pre/post quizzes are provided.
This engineering curriculum meets Next Generation Science Standards (NGSS).

Engineering Connection

Touch (tactile) sensors are key components of many devices we use every day. For instance, the touch sensors in keyboards and keypads tell computers which keys you are pressing. Similarly, you can open a car door using a touch sensor that generates an infrared signal that goes to the car's computer informing it to unlock the door. Phone and tablet touchscreens on phones enable even more exquisite communication between people and machines. The use of touch sensors has exploded into the engineering design of all sorts of devices.

Computer programming is a key component of many modern engineering designs. As students create robot programs in this activity, they must have a "goal" or "concept" of what the program solution needs to do and how, before they begin writing the code. Then, the process of working on the code and "debugging" it inherently constitutes "revising and improving their designs based on the results of testing." Hence, the thought processes required to code programs that meet problem constraints are very similar, if not identical, to those required for traditional engineering design of physical objects and products.

Pre-Req Knowledge

  • Experience using and programming the LEGO MINDSTORMS EV3 robot and intelligent brick (computer) so that it takes input from sensors for decision making.
  • An understanding of how touch sensors work, both human and robotic, as presented in the associated lesson.
  • Completion of the Our Bodies have Computers and Sensors unit and the What Is a Sensor? lesson.

Learning Objectives

After this activity, students should be able to:

  • Program a LEGO robot to take input from touch sensors to play music and activate a motor.
  • Explain how the program and the touch sensors work.
  • Relate the program (robotic response to touch sensor information) to human responses to touch.

More Curriculum Like This

How Does a Touch Sensor Work?

Students learn about how touch sensors work, while reinforcing their similarities to the human sense of touch. They look at human senses and their electronic imitators, with special focus on the nervous system, skin and touch sensors.

How Does a Sound Sensor Work?

Students learn about how sound sensors work, reinforcing their similarities to the human sense of hearing. They look at the hearing process—sound waves converted to electrical signals sent to the brain—through human ear anatomy as well as sound sensors.

What Is a Sensor?

Students gain a rigorous background in the primary human "sensors," as preparation for comparing them to some electronic equivalents in the associated activity. Students learn the concept of "stimulus-sensor-coordinator-effector-response" to describe the human and electronic sensory processes.

Elementary Lesson
Control Using Sound

Students gain a deeper understanding of how sound sensors work through a hands-on design challenge involving LEGO® MINDSTORMS® taskbots and sound sensors. Student groups each program a robot computer to use to the sound of hand claps to control the robot's movement.

Elementary Activity

Educational Standards

Each TeachEngineering lesson or activity is correlated to one or more K-12 science, technology, engineering or math (STEM) educational standards.

All 100,000+ K-12 STEM standards covered in TeachEngineering are collected, maintained and packaged by the Achievement Standards Network (ASN), a project of D2L (www.achievementstandards.org).

In the ASN, standards are hierarchically structured: first by source; e.g., by state; within source by type; e.g., science or mathematics; within type by subtype, then by grade, etc.

  • Use argument supported by evidence for how the body is a system of interacting subsystems composed of groups of cells. (Grades 6 - 8) Details... View more aligned curriculum... Do you agree with this alignment?
  • Gather and synthesize information that sensory receptors respond to stimuli by sending messages to the brain for immediate behavior or storage as memories. (Grades 6 - 8) Details... View more aligned curriculum... Do you agree with this alignment?
  • Various relationships exist between technology and other fields of study. (Grades 3 - 5) Details... View more aligned curriculum... Do you agree with this alignment?
  • Knowledge gained from other fields of study has a direct effect on the development of technological products and systems. (Grades 6 - 8) Details... View more aligned curriculum... Do you agree with this alignment?
  • Describe how new technologies have helped scientists make better observations and measurements for investigations (e.g., telescopes, magnifiers, balances, microscopes, computers, stethoscopes, thermometers) (Grade 4) Details... View more aligned curriculum... Do you agree with this alignment?
  • Describe how new technologies have helped scientists make better observations and measurements for investigations (e.g., telescopes, electronic balances, electronic microscopes, x-ray technology, computers, ultrasounds, computer probes such as thermometers) (Grade 5) Details... View more aligned curriculum... Do you agree with this alignment?
  • Explain the interactions between the nervous and muscular systems when an organism responds to a stimulus (Grade 8) Details... View more aligned curriculum... Do you agree with this alignment?
Suggest an alignment not listed above

Materials List

Each group needs:

To share with the class:

Note: This activity can also be conducted with the older (and no longer sold) LEGO MINDSTORMS NXT set instead of EV3; see below for those supplies:


We have learned how the human sense of touch works from the previous lesson. Now how do we implement the "stimulus-sensor-coordinator-effector-response" framework in a LEGO robot?

In today's design challenge activity, you will carefully program a LEGO robot to alter how some music is played and how a wheel is turned, depending on which touch sensors are activated. Let's get started!


sensor: A device that converts one type of signal to another; for instance, the speedometer in a car collects physical data and calculates and displays the speed the car is moving.

stimulus: A thing or event that causes a reaction, such as a specific functional reaction in an organ or tissue.

tactile: Related to touch.


Before the Activity

  • Gather materials so each group has a LEGO MINDSTORMS EV3 intelligent brick, motor and two touch sensors, and cables for connecting them, as well as a computer with the LEGO EV3 software installed.
  • Make copies of the Music by Touch Pre-Quiz and Music by Touch Post-Quiz, one each per student. The quizzes are provided as separate attachments, and also embedded in the presentation so they can be presented to the class as a whole, if desired.
  • Perform the activity prior to doing it with students. Make sure you are familiar with the design challenge and answers, which are provided in detail on slides 4-7 of the presentation.
  • Use the 13-slide Music by Touch Presentation, a Microsoft® PowerPoint® file, to teach and conduct the activity. Set up a computer/projector to show the presentation to the class.
  • Divide the class into groups of three students each.

With the Students

  1. Administer the pre-quiz by handing out paper copies; the quiz is also on slide 2. The answers are provided for the teacher on slide 3 for discussion after students have completed the quiz.
  2. As a quick review, remind students of the similarities between human and robot designs (slide 4). Your hand is commanded by your brain. Similarly, the LEGO intelligent brick commands its motor to move.
  3. Then introduce the activity's design challenge. Slide 5 provides a description and diagram of the equipment setup and explains the program requirements. Have students write the program on paper and check them as completed. Program requirements:
  • If one touch sensor is touched, play a piece of music and keep rotating the wheel (attached to the motor) slowly.
  • If the other sensor is also touched, play the music faster and make the wheel turn faster.
  • Do this in a loop, continuously, until the program is stopped.
  1. Review with students how the LEGO EV3 motor works:
  • The EV3 motor is an electric motor that works by converting electricity into motion, and is similar to many other motors that you see around you daily.
  • The EV3 motor has a built-in wheel rotation sensor that helps it control its motion, that is, it can move precise distances using this rotation sensor.
  1. Hand out to each group a LEGO brick, motor and two touch sensors.
  2. Assist students as they work through the challenge. Make sure to check each group's plans and provide encouragement and suggestions so that they develop successful programs. Slides 6-9 provide the programming solution for the teacher.
  3. Have each group demonstrate that its program works successfully.
  4. At activity end, lead a class discussion about the activity, as described in the Assessment section.
  5. Administer the post-quiz by handing out paper copies; the quiz is also on slide 10. The answers are provided on slides 11-12. Slide 13 contains vocabulary terms and definitions.



Pre-Activity Assessment

Pre-Quiz: Before starting the activity, administer the Music by Touch Pre-Quiz (also on slide 2) to assess students' base understanding of the stimulus-to-response framework and touch sensors. Answers are provided on the Music by Touch Pre-Quiz Answer Key (and slide 3).

Activity-Embedded Assessment

Button Check: As students are conducting the activity, check to see if students understand what each of the individual programming buttons mean, whether they can follow the logic of the program step-by-step and explain their programs (refer to the programming answer for the teacher on slides 6-9).

Post-Activity Assessment

Concluding Discussion: At activity end, lead a class discussion about the activity, asking students to share their experiences and lessons learned. Ask students:

  • Describe the challenges you faced.
  • What issues or difficulties did you encounter?
  • What are examples of how touch sensors are used in real-world devices? (Example answers: Remote control devices that open car and garage doors, turn on/off ceiling fans, etc.).
  • What might you now want to learn about touch sensors?

Post-Quiz: Administer the Music by Touch Post-Quiz (also on slide 10) to assess students' understanding of the stimulus-to-response framework, touch sensors and programming. Answers are provided in the Music by Touch Post-Quiz Answer Key (and slides 11-12). Review students' answers to assess their understanding of the concepts explored in the activity.

Additional Multimedia Support

LEGO EV3 robots and sensors: http://mindstorms.lego.com/eng/Overview/default.aspx

List of sensors: http://en.wikipedia.org/wiki/List_of_sensors

What is a transducer? http://en.wikipedia.org/wiki/Transducer

What is a sensor? http://en.wikipedia.org/wiki/Sensors


Trisha Chaudhary, Pranit Samarth, Satish S. Nair


© 2013 by Regents of the University of Colorado; original © 2013 Curators of the University of Missouri

Supporting Program

GK-12 Program, Computational Neurobiology Center, College of Engineering, University of Missouri


This curriculum was developed under National Science Foundation GK-12 grant no. DGE 0440524. However, these contents do not necessarily represent the policies of the National Science Foundation, and you should not assume endorsement by the federal government.

Last modified: March 17, 2018