How to use the
Learning Portal

Learning Portal

Our hands-on, comprehensive lesson plans span a range of levels. Browse our free STEM and coding learning resources.

Marty Image

2.23: Noise Sensors and Parallel Programming

45 Minutes

Lesson Overview

In this lesson, learners are introduced to noise sensors, like the add-on available with Marty v2. These sensors allow Marty to respond when a pre-determined amount of noise is detected. Learners will begin by thinking about noise sensors in their environment, like a classroom, a city street or in a computer, and extend this to program responses, for Marty, when certain conditions are met.

Please read the knowledge base article about the noise sensor addon, before engaging with this lesson.

Key vocabulary:
    sensor, loop, wait block,

Content Sections

  • Learning Objectives
  • Warm up
  • Unknown block type "youtube", please specify a serializer for it in the `serializers.types` prop
    Unknown block type "figure", please specify a serializer for it in the `serializers.types` prop
    Unknown block type "figure", please specify a serializer for it in the `serializers.types` prop
    Unknown block type "figure", please specify a serializer for it in the `serializers.types` prop
    Unknown block type "youtube", please specify a serializer for it in the `serializers.types` prop
    Unknown block type "videoEmbed", please specify a serializer for it in the `serializers.types` prop
  • Get Learning
  • Unknown block type "figure", please specify a serializer for it in the `serializers.types` prop
    Unknown block type "figure", please specify a serializer for it in the `serializers.types` prop
    Unknown block type "youtube", please specify a serializer for it in the `serializers.types` prop
  • Time for Practice
  • Cool Down
    • Extensions & Challenges
    • Extend
      • Support
        • Additional Reading
        • 2.23: Noise Sensors and Parallel Programming

          45 Minutes

          Lesson Overview

          In this lesson, learners are introduced to noise sensors, like the add-on available with Marty v2. These sensors allow Marty to respond when a pre-determined amount of noise is detected. Learners will begin by thinking about noise sensors in their environment, like a classroom, a city street or in a computer, and extend this to program responses, for Marty, when certain conditions are met.

          Please read the knowledge base article about the noise sensor addon, before engaging with this lesson.

          Key vocabulary:
            sensor, loop, wait block,
          • Experience using sensors with Marty, parallel programming (more than one event block) and nested conditional statements
          • Tablet with Bluetooth 4.2+
            • Marty the Robot V2
            • Marty Workbook
            • Tablets
            • Access to the MartyBlocks editor
            • Noise Sensor add on for Marty v2

          Learning Objectives

          • I can read and use the output from a sensor
          • I can write a condition, in a program, to have a device perform an action depending on the result from a sensor
          • I can create parallel blocks of code

          Warm up

          Before starting the lesson, prepare Marty with the code from the lesson, it will respond to sounds and have an action depending on the level of the sound.

          Encourage learners to enter the classroom quietly, "Marty is in the room listening and I want to see how quietly we can enter the room; can we be quiet enough for him not to notice?" If the learners manage to enter silently, offer congratulations and tell them that we will need to run a controlled test to see if Marty can hear us. Engage learners in an exercise often used as an icebreaker, called the rainmaker. Show the slides from the presentation with the rainmaker title so that learners do this quietly.

          If the environment makes this start to a lesson very difficult, postpone this part of the lesson until after the discussion on noise sensors in our environment. If you are able to show Marty moving, as above, here are the code blocks that were used.

          The precise values used in the code, above, are a result of using the code from below to determine how long an action can take. Share the trial and error process with the learners, it can support them on their journey of exploration. The code iteself need not be kept when the code is complete, it is just for testing purposes.

          If you show the video, or program Marty, for the learners' entrance, discuss what learners think has happened. Record the ideas that they share.

          Challenge learners to think about the different processes that were included in the code: Marty didn't just have one action, his responses changed depending on the level of sound. Learners should identify that there is either a nested conditional, a logic block or parallel events being used. If these ideas are suggested, question as to the possible organization. Learners may suggest that it could be Marty is testing if the noise meets a certain threshold, if it does, an action may occur, if it doesn't, a different action might take place. Answers could vary and are explored further in the teacher guide.

          *This could be the first part of the warm up, if quiet is difficult to achieve for the classroom environment at the start of the lesson.*

          Display the start of the presentation, showing the objectives and success criteria for today's lesson.

          Ask learners if they have ever heard of noise sensors being used in an environment. If they have, ask why it might be important to measure sound. How might a certain level of sound affect people? What can certain sounds indicate, for groups or machines? Are there times when certain levels of sound are acceptable or not? Record the suggestions.

          This video showcases a product that monitors noise in a home and reports the values to a user's computer.

          The video below highlights how noise sensors monitor city noise and alerts city workers to areas where noise is too high, so that they can respond to complaints efficiently. There is no need to play the full video.

          Get Learning

          Show examples of a sound monitor running on a device, here are links that could be used to download add-ons to your device:

          Decibel Meter

          Sound Meter

          Display the noise sensor block on the board, from the sensing section, either from the presentation or within Scratch. Have learners do the same and, if you are displaying Scratch, click the block to see the result, have the learners click the block whether or not you are displaying Scratch. Have them do this several times to see the different results that are returned. Explain that the drop-down menu is only used where there are two noise sensors being used: if there is only one sensor, left or right can be selected

          Encourage learners to think about the value being returned and what a reasonable level is, for a working or learning environment. Revisit the content from the videos, either looking at noise from a hard drive indicating potential breakdown, noise in an office or street indicating potential noise pollution.

          Display the scratch screen on the board with the noise sensor block ticked to have its value always displayed. This code block will continually return a value for the noise sensor, but Marty is not acting at all, other than the flashing light in the foot.

          Have learners discuss the use of this value. We need Marty to respond to what is returned. We can see that the value returned changes regularly because the microphone is sensitive. How can we make some conditions that result in different actions depending on the sound; what should the changing actions be; should we display the actions for a short or long time?

          Learners may have noticed that the sound was made at the same time as the movement; additionally, the left and right arms move at the same time. Question if they can think about how this might happen. Remind that in learner's code, they have an event to start one sequence. What happens if we have two events at the same time? If learners have forgotten parallel programming, have them start small with a simple movement in the different blocks, that don't interfere - left arm and right arm - without the need for ifs, loops or sensors. Once they have seen the different non-overlapping actions, have them work to trigger the actions based on noise.

          After some time for group discussion, bring learners together to talk about what they might want Marty to do and how they plan to have Marty do it.

          Time for Practice

          Learners need to take their ideas, form a plan, and begin to code responses for Marty. This process should include a lot of testing and changing values for wait times, for conditional values and for movement timings and for the movements themselves. Encourage experimentation, encourage discussion about what is seen and if it is what the whole group wants. When learners get it wrong, feel free to inform that the person who developed this code definitely didn't get it on the first, second or even third attempt.

          Before learners begin working on their code, remind them of the success criteria that were shared, earlier. While groups are designing their code, have them document the challenges they faced and the steps they took. It will support sharing at the end of the lesson.

          Cool Down

          Bring learners back together to discuss the challenges they faced and overcame. Have groups model their creations and explain what is happening, when. Encourage other groups to ask questions to deepen the understanding of the processes.

          Suggested questions you might ask:

          • How did you determine what values to use for the conditional statements?
          • Did you address all of the values that the noise sensor could record? How did you manage that?
          • Did you check the value from the noise sensor regularly, or just once? Is there value in checking the noise sensor periodically? Why, why not?
          • Were there some actions that did not work well with the code? If you found some, did you decide what the issue was?

          Carry out any end of lesson routines.

          Log off devices and clear everything away.

          Extensions & Support

          Extend

          Challenge learners to fine tune the sensor values:

          • fine tune the responses to different noise levels - increase the number of conditions and make reactions faster
          • Include logic blocks in the code to either make conditions more specific or to combine different actions

          Support

          Have physical code cards available for learners to use, when building their scripts:

          • if/then and if/then/else blocks
          • loops
          • light sensor blocks
          • operator blocks: <, >, =
          • a variety of movement blocks

          Have a print out of the basic loop statement, using the noise sensor.

          • Technologies: Computing Science
          • Literacy & English: Listening and Talking
          • Health and Wellbeing: Mental, Emotional, Social and Physical Wellbeing
          • Numeracy: Number, Money and Measure
          • Literacy & English: Writing
          • Computing, Design and Technology: Design and Technology
          • Computing, Design and Technology: Computing
          • CSTA Education Standards
          • Digital Technologies, Design & technologies: Digital Technologies
          • International Society for Technology in Education (ISTE)