NXT Musical Instrument





Name of Activity NXT Musical Instrument
Author Jay Clark
Keywords Mary Had A Little Lamb, simple song, NXT, switches, sensors, task, instrument, wiring, math blocks, programming, loops, MINDSTORMS, Music Engineering, numerical frequency, audible, pitch, 2 Hours Total
Subject NXTs
Grade Level 4, 5, 6, 7, 8, 9+
Time 2 Hours Total
Brief Description Students will play “Mary Had A Little Lamb” and other simple songs on their NXT using switches and touch sensors. When students complete that task, they will make an instrument using other sensors, requiring wiring and math blocks in their programs.
Lesson Objectives: Learn about loops, switches, and math blocks
Introduce Musical Instrument Engineering
Understand the relationship between numerical frequency and audible pitch
Materials Needed: NXT Kit
Computer with MINDSTORMS NXT software
Necessary Background Mary had a little lamb is a simple song consisting of just three notes. The notes and corresponding lyrics are below:


ma-ry had a lit-tle lamb


lit-tle lamb, lit-tle lamb


mar-y had a lit-tle lamb


whose fleece was white as snow

All musical notes have a corresponding frequency. Concert A (or middle A) is 440 Hz. In order to play mary had a little lamb using a light or distance sensor, you must know the frequencies of the three notes you’re using:

C – 262

D – 294

E – 330


frequency – the rate at which a vibration occurs. Determines the pitch of a note.

Procedure Introduction Introduce switches to the students. A switch is a program structure that makes decisions based on external criteria, such as a sensor value. Introduce the lesson. Show the students the notes of Mary had a little lamb. Ask them how many touch sensors they would need to play it. Guide them to realize that they could use 2, and there are 4 opportunities for notes to play with two touch sensors: Left pressed, right pressed, both pressed, none pressed. Guide them through brainstorming how the program should look. Usually it’s hard for them to see that the second switch is required. ActivityHave the students program their robots to be able to play mary had a little lamb using switch blocks and sound blocks. When they finish, have them use another sensor and wiring and math blocks in their program to create another musical instrument. Or allow them to use switches with another sensor to set up ranges for each note.
Extensions: Play a different song!
Use touch sensors in conjunction with another sensor to set the octave.
Reference 1 http://sites.tufts.edu/stompactivitydatabase/files/formidable/g.png

Wall Follower





Name of Activity Wall Follower
Author Jay Clark
Keywords NXTs, car, wall, distance, loops, conditional loops, sensor, threshold
Subject NXTs
Grade Level 4, 5, 6, 7, 8, 9+
Time 1 Hour Total
Brief Description Students will program their NXT cars to follow the outer edge of the classroom by driving along the wall at a set distance away.
Lesson Objectives: Programming using loops and conditional loops
Determining and Implementing sensor thresholds
Materials Needed: Prebuilt NXT car with a sound sensor
Clear wall space
Computers with NXT Mindstorms software
Preparation and Set Up: Find a section of the room that has the most dynamic wall. -Maybe the wall juts out for a closet and back in again afterwards-

Clear this space for cars to run next to.

For any inside turns (turning to the right if the wall is on your left), place a strip of black tape a foot or so away from the wall for the extensions.

Necessary Background A wall follower activity is very similar to the line follower programmatically. Start close to the wall. Turn away from the wall until the distance sensor reads that you are too far, then drive back towards the wall until the distance sensor reads that you are too close. Loop.

There is a challenge in trying to get the car to make an outside turn. This involves playing with the distance away from the wall you set your car to follow, and how dramatically you have the car steer.

Inside turns cannot be made using the loop. Some other sensor must tell the car that an inside turn is approaching, and then the car must react by turning. Students may use a touch sensor, a light sensor, a sound sensor, or even another distance sensor (if they have one)

Vocabulary: Threshold – The sensor value that when breached, will trigger a wait for block or a conditional loop. (Some students have had a better time understanding it as a “benchmark”)

Procedure Introduction – 10 minutes Introduce/ Review loops with the students and why they are useful in programs.

  • Loops allow us to repeat a set of commands that would otherwise be tedious to program over and over.

Introduce the activity, and ask the students if they have an idea of what the program should look like. Activity – 40 minutes Allow students to make the mistake of not including any turns in their program. They will understand their mistake when trying to make the first outside turn. Clean up/ Wrap up – 10 minutes

  • What was easiest? What was hardest?
  •  What would you have done differently?
  •  What were some good ideas you saw that other groups came up with?
Extensions: In order to make inside turns, students will have to use a conditional loop and another sensor to warn them of the upcoming turn.
Reference 1 http://sites.tufts.edu/stompactivitydatabase/files/formidable/c1.jpg
Reference 2 http://sites.tufts.edu/stompactivitydatabase/files/formidable/d.png

Light Symphony





Name of Activity Light Symphony
Author STOMP
Keywords light sensor, NXT, tone, ambient light, loops, math blocks, sound, inputs, outputs, Engineering Design Process
Subject NXTs
Grade Level 4, 5, 6, 7, 8, 9+
Time 1 Hour Total
Brief Description In this activity, students will wire a light sensor to their NXT bricks. Light sensor data
will be collected and used in a program that plays a tone based on the ambient light
in the room.
Lesson Objectives: - To learn to program using the light sensor, loops, math blocks, and sound.
Materials Needed: - NXT brick.
- Light sensor.
- Computers running MINDSTORMS NXT software.
Preparation and Set Up: Set up computers with MINDSTORMS NXT Software.
Arrange students into groups of two.
Distribute necessary materials.
Necessary Background Vocabulary:
engineering design process
  1. Have students wire a light sensor to their NXT brick. They may or may not want to attach the light sensor to the brick.
  2. Have students program their NXT bricks
    1. The program should collect light sensor data
    2. The program should take this data and multiply it by a number (It may be good to start with about 10, but students can use trial and error until they find a multiple that creates the music box that they want)
    3. This new number should determine the tone of the note that the NXT brick plays.
    4. Students should add a wait for time block so that their note will play for that amount of before the program loops and the brick plays a new note.
  3. To test this program either have students turn their light sensors towards and away from a light source to produce different tones, or change the light levels in the room.
  4. Students may have to modify their program and change the multiple in their math block, or change the amount of time between notes. Allow students to test and retest multiple times.
Extensions: Get students to match the pitch of another NXT brick.
Modifications: - This same activity could be done using the proximity sensor attached to a car.
- Students could program their NXT brick to play a tone depending on how close their car was to an object. This could be related to a safety device that would warn you if your car was going to bump into a wall.
Reference 1 http://sites.tufts.edu/stompactivitydatabase/files/formidable/62_image_1.jpg
Reference 2 http://sites.tufts.edu/stompactivitydatabase/files/formidable/62_image_2.png
Reference 3 http://sites.tufts.edu/stompactivitydatabase/files/formidable/light_symphony.doc

Line Follower






Name of Activity Line Follower
Author STOMP
Keywords car, light sensor, line, follow, loops, loop, ports
Subject and Grade Level NXTs, 4, 5, 6, 7, 8, 9+
Time 1 Hour Total
Lesson Objectives: - To learn to program using light sensors
- To learn to program using loops
- To practice building with an NXT kit
Materials Needed: - NXT Kit
- Solid colored floor or mat
- Tape that contrasts floor or mat
- Planning and Final Design Worksheets
- Computers running MINDSTORMS NXT-G Software
Preparation and Set Up: - Set up a line for students car to follow
- Set up computers running NXT software
- Photocopy worksheets
- Arrange students in groups of two
- Distribute necessary materials
  1. Have students plan out their design and program on paper before distributing materials. Help students think about the program by asking the following questions: How can the light sensor help you detect the line? What should happen when the car senses the line? What about when the light sensor detects the floor again? What is a loop? How will a loop be helpful in your program?
  2. Have students build cars using NXT-G kits, or provide a pre-built car to each group.
    1. The light sensor should be pointed at the ground.
    2. Make sure the car can easily turn by attaching a skid plate or attaching a swivel wheel to the front of the car.
    3. Attach the light sensor to the front of the car.
  3. Have students program their cars.
    1. The car should follow a line using a light sensor.
    2. Program one motor to turn until the light sensor detects the line.
    3. Use the “Wait for” block to use the light sensor data.
    4. When the light sensor detects the line, have the first motor stop and the other motor turn until the light sensor detects the floor, at which point the second motor will stop.
    5. Insert a loop around the program so that the car continually follows the line.
  4. Allow students to test their design on a tapeline on the floor.
  5. Tell students that they may redesign their car as this is an important step in the Engineering Design Process.
  6. When students have completed their cars have them fill out their final design sheets.
  7. Gather students together as a class and let each group share their car. Discuss the activity as a class.
Extensions or Modifications: - Create a theme for the project such as “rounding the bases” so that the students cars have to do more than just follow a line.
- Have a challenge at the end of the line. For example, at the end of the line there is a box that the NXT car must pick up. Students must design a robotic arm to lift the box.
Sample Image 1 http://sites.tufts.edu/stompactivitydatabase/files/formidable/60_image_2.jpg
Sample Image 2 http://sites.tufts.edu/stompactivitydatabase/files/formidable/60_image_3.png
Sample Image 3 http://sites.tufts.edu/stompactivitydatabase/files/formidable/Line-Follower.pdf
Sample Image 4 http://sites.tufts.edu/stompactivitydatabase/files/formidable/Building_Design_Sheet.pdf
Sample Image 5 http://sites.tufts.edu/stompactivitydatabase/files/formidable/Final_Design_Sheet.pdf

Switch to our mobile site