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

1.18 – Accelerometers

45 Minutes

Lesson Overview

Another sensor that Marty has is the accelerometer which can track his movement. In this lesson, students will anaylse Marty’s accelerometer readings and use this to create a small game in Scratch where when we move Marty around, this moves the sprite around on the screen.

Key vocabulary:
    Accelerometer , Movement , Programming , Input , Values , Game,

Content Sections

  • Learning Objectives
  • Extensions & Challenges
    • Additional Reading
    • 1.18 – Accelerometers

      45 Minutes

      Lesson Overview

      Another sensor that Marty has is the accelerometer which can track his movement. In this lesson, students will anaylse Marty’s accelerometer readings and use this to create a small game in Scratch where when we move Marty around, this moves the sprite around on the screen.

      Key vocabulary:
        Accelerometer , Movement , Programming , Input , Values , Game,
      • Lessons 1.1-1.17
      • Laptop, PC or Tablet
        • Marty the Robot
        • Marty Workbook (Lesson 4)
        • Laptops/Computers/Tablets
        • Access to the Scratch editor

      Learning Objectives

      • Understand what an accelerometer is and what other devices may contain accelerometers
      • Monitor the values that are stored by the accelerometer in Marty
      • Create a small game where moving Marty around will move the sprite around on the screen

      1. Research into what an accelerometer is and what other devices contain them

      a. What is an accelerometer?

      b. What is it used for?

      c. Task in workbooks to look at which devices have accelerometers in them

      2. Split students into small groups that will be experimenting with the values that the accelerometer calculates by storing the values into variables so that we can monitor them (note that students may want to multiple the value by 1000 to get an easily readable number)

      a. How do these values change when Marty walks?

      b. How do these values change when you physically move Marty from side to side or forwards and backwards?

      c. Which one changes when you move Marty left to right? (X, Y or Z)

      3. Create a small game where Marty is the input to move the sprite around the screen

      a. Based on the notes that students took whilst monitoring the sensor values, they can work out what the thresholds are for the sprite to start to move left or right

      Extensions & Support

      • Extend the game by turning it into a multiplayer game where two people can play using two Marty’s as input
      • Can students use X, Y and Z values to move sprite around on screen?

      Additional Reading

      • Educator’s Guide
      • Introduction to Programming with Marty using Scratch