Lesson Storing Android Accelerometer Data:
App Design

Quick Look

Grade Level: 11 (9-12)

Time Required: 2 hours

The time required is based on students having working knowledge of MIT's App Inventor, acquired BEFORE this lesson.

Lesson Dependency: None

Subject Areas: Computer Science, Data Analysis and Probability, Physics

Photo shows three different Android devices that can be used in the activity: Nexus 4, Nexus 10 and Nexus 7.
Engineers use computer science knowledge to develop Android devices.
copyright
Copyright © Wikimedia Commons http://commons.wikimedia.org/wiki/File:Icon_xl.jpg

Summary

Students work through an online tutorial on MIT's App Inventor to learn how to create Android applications. Using those skills, they create their own applications and use them to collect data from an Android device accelerometer and store that data to databases. NOTE: Teachers and students must have a working knowledge of basic programming and App Inventor to complete this lesson. This lesson is not an introduction to MIT's App Inventor and is not recommended for use without prior knowledge of App Inventor to produce an end product. This lesson is an application for App Inventor that allows for the storage of persistent data (data that remains in memory even if an app is closed). This required prior knowledge can come from other experiences with the App Inventor. Also, many additional resources are available, such as tutorials from MIT. This lesson could also be used as an enrichment project for students who are self-motivated to learn the App Inventor software.

Engineering Connection

Together with its associated activity, this lesson is designed to provide students with practice in implementing the engineering design process. Students identify a problem, develop solutions, select and implement the most promising solution, test their solutions and redesign as needed to meet the requirements. The process is driven by the challenge in which students are tasked to create an Android application that performs a specific function. Software engineers employ the design process to create software, such as business software, communication software, compilers, and computer graphics. Ultimately, students plan what the application will do, decide what it looks like, decide how to structure the software, test, and edit to ensure the app works correctly. Students act as software engineers in this hands-on application of the engineering design process.

Learning Objectives

After this lesson, students should be able to:

  • Explain how the TinyDB in App Inventor can store data from an Android device.
  • Describe and compare each step in the software/system design process with the engineering design process.

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.

  • Illustrate principles, elements, and factors of design. (Grades 9 - 12) More Details

    View aligned curriculum

    Do you agree with this alignment?

  • Determine the best approach by evaluating the purpose of the design. (Grades 9 - 12) More Details

    View aligned curriculum

    Do you agree with this alignment?

  • Use technology and mathematics to improve investigations and communications. A variety of technologies, such as hand tools, measuring instruments, and calculators, should be an integral component of scientific investigations. The use of computers for the collection, analysis, and display of data is also a part of this standard. Mathematics plays an essential role in all aspects of an inquiry. For example, measurement is used for posing questions, formulas are used for developing explanations, and charts and graphs are used for communicating results. (Grades 9 - 12) More Details

    View aligned curriculum

    Do you agree with this alignment?

  • Recognize creativity, imagination, and a good knowledge base are all needed to advance the work of science and engineering (Grades 9 - 12) More Details

    View aligned curriculum

    Do you agree with this alignment?

Suggest an alignment not listed above

Worksheets and Attachments

Visit [www.teachengineering.org/lessons/view/uno_accelerometer_lesson01] to print or download.

Pre-Req Knowledge

To conduct this lesson, the teacher must have a working knowledge of MIT's App Inventor software. This software enables users to create, simulate and build Android applications that can be used on Android devices. This lesson is ideal for a computer programming environment or a setting in which students want to push the envelope of the typical curriculum. Students are required to think logically and sequentially.

Introduction/Motivation

(Be ready to show students a 12-minute online tutorial.)

In this lesson and its associated activity Android App Development, you will get to do "real" engineering. Engineers use a cyclical design process to arrive at the best possible solution to a problem. You will plan what an Android application for a mobile device will do, decide what it looks like, decide how to structure the software, as well as test and edit to ensure the app works correctly.

The writing of applications for Android devices is commonplace in today's society. A growing number of "smart phones" have the capability to be much more than communication devices. In fact, these devices are really mini-computers. A user interface such as MIT's App Inventor can enable you to create your own applications for Android devices. This lesson is a specific use of the App Inventor software that lets you use one of the sensors in a smart phone, the accelerometer, to store collected data for later use. This lesson is far more than a computer science experiment or science lab. While the skills that you will learn through exploring and using App Inventor will be fun and educational, they also will provide you with the ability to use your own smart phone in unique ways.

We begin by exploring a user interface developed by MIT to create applications for Android devices. To learn about this application, named App Inventor, we will watch a tutorial on how the App Inventor software works and then explore the possibilities of the App Inventor software. In the activity that follows, you will write an app that stores persistent data in a database on the local device. Possible uses of the App Inventor tools will be the focus of a class discussion after watching the tutorial. (Show the App Inventor tutorial to the class by following the link: https://www.youtube.com/watch?v=Iq9KkAbhxQg.)

Now that we have viewed the tutorial, let's cover a few main points. (Ask students the following questions to stimulate a class discussion.)

  • Describe the tasks that can be done by the tutorial application. (Answer: The application can show graphics, take user input, and store data.)
  • What is the purpose of the TinyDB (tiny database)? (Answer: Using the database allows data to be persistent. This means the data stays in the memory even if the app is closed.)
  • Describe how to retrieve data once it has been stored in a database. (Answer: Every entry in the database has a specific tag, usually a number or letter. By sending the tag name to the database, it knows which piece of data to send back.)
  • What kind of applications could we construct using these same tools? (Answers will vary. Example answer: Applications that store information such as directions for finding a parked car, locker combinations, phone numbers, and important dates.)

Lesson Background and Concepts for Teachers

The focus of this lesson is not really about writing the app, although that is the measurable end product. The lesson is meant to allow students to gain experience with the engineering design process. Students are exposed to this process and implement it to solve the problem of writing a mobile Android application that measures a device's acceleration and stores that data for future use.

Introduce students to the engineering design process and the software development life cycle (or review these topics if students are already familiar with them). Figure 1 shows the software development life cycle; Figure 2 shows the steps of the engineering design process. Notice the similarities.

A circular diagram shows the five fundamental steps of software design: 1) requirement analysis (software specification), 2) design, 3) implementation (coding), 4) validation (testing), 5) evolution (maintenance and further development).
Figure 1. The steps of the software development life cycle.
copyright
Copyright © 2012 Cliffydcw, Wikimedia Commons http://commons.wikimedia.org/wiki/File:SDLC_-_Software_Development_Life_Cycle.jpg
A flowchart of the engineering design process with seven steps placed in a circle arrangement: ask: identify the need and constraints; research the problem; imagine: develop possible solutions; plan: select a promising solution; create: build a prototype; test and evaluate prototype; improve: redesign as needed, returning back to the first step, "ask: identify the need and constraints."
Figure 2. The steps of the engineering design process.
copyright
Copyright © TeachEngineering.org. All rights reserved.

The software development life cycle begins with the requirement analysis phase, which can be compared to the identify the problem and identify criteria and constraints steps in the engineering design process. In both cases, this is the time when the project goal is identified. Questions such as "What am I trying to solve or create?", "What is the purpose?", "How should the end product function?", "What are my limitations?", "What materials can be used or are needed?" are answered at this stage.

Once the goal is clearly defined, as well as additional constraints or requirements, the next phase in the software development life cycle is design. This corresponds to the brainstorm possible solutions, generate ideas, explore possibilities, and select an approach steps in the engineering design process. At this point, research is often conducted to gather relevant information. Different ideas for designs are explored, and eventually the most promising design or solution is selected and refined. Specifically for software design, this phase may be focused on the development of a code or series of codes. In the associated activity, this includes first creating a pseudo code.

The next two phases in the software development life cycle are implementation and testing, which correspond to the create a model or prototype step in the engineering design process. At this point, the prototype or code, for example, is completed and tested.

The last phase in the software development life cycle is the evolution phase, which is comparable to the refine the design stage of the engineering design process. At this point, the results of the testing phase are analyzed and incorporated into the project. Based on the testing results, the cycle is repeated (an iteration) as many times as necessary to satisfy the overall project goal.

This lesson is designed for use in a programming or other technology class in which the focus is on students programming. It can be used as an experience with the App Inventor software to create a database that stores persistent data. In a follow-up lesson, Android Acceleration, students can utilize the applications that they create to explore the relationship between acceleration and velocity.

Refer students to the MIT App Inventor website (http://appinventor.mit.edu/explore/) for tutorials and curricula to work though to gain knowledge of how to use the App Inventor.

Tutorials for getting started, installing app inventor and practice projects: http://appinventor.mit.edu/explore/learn.html

Teacher curricula: https://appinventor.mit.edu/explore/teach

Associated Activities

  • Android App Development - Students apply the engineering (software/system) design process to plan, develop and test mobile apps. The app they design uses the TinyDB on an Android device to store persistent data for later use. The activity focuses on the creation of a software program, but the underlying goal is to provide students with experience and practice in applying a design process to accomplish a goal.

Vocabulary/Definitions

accelerometer: A sensor that measures the acceleration of an object.

persistent data: Data that remains accessible for later use even after the application that created it closes and stops functioning.

TinyDB: A database on an Android device that can be used to store persistent data.

Assessment

Pre-Lesson Assessment

Use the following prompts to have students write or discuss the topic.

  • Describe what you know about the engineering design/software design process. (Answer: It is a cyclical and iterative process that helps to accomplish a task/goal. It includes numerous steps: analysis of the problem, design of a solution, implementation of the design, testing of the design, and possible revisions, refinements and/or extensions of the design.)
  • How can you apply a design process specifically to writing a mobile Android app? (The design process can be applied to many situations including the creation of mobile apps. First, you identify the specific problem you want to address. Next, you develop some possible solutions and implement the most promising one. Then, you thoroughly test your implementation to see if it functions correctly. Finally, you make any revisons and refinements to the implementation.)

Post-Lesson Assessment

Have students complete the writing prompt found on Storing Android Accelerometer Data: App Design Assessment. This worksheet presents students with a screenshot of sample App Inventor code that that controls two buttons. The prompt asks students to explain what happens when each button is clicked and how it works. Assign this post-lesson assessment after students have completed the associated Android App Development activity, as students work with the code displayed in the screenshot during the process of developing their apps.

Subscribe

Get the inside scoop on all things TeachEngineering such as new site features, curriculum updates, video releases, and more by signing up for our newsletter!
PS: We do not share personal information or emails with anyone.

More Curriculum Like This

Middle School Lesson
Algorithmic Remote Rover Programming: Curiosity Killed the App

Students gain experience with the software/system design process, closely related to the engineering design process, to solve a problem. The lesson culminates in a hands-on experience with the design process as students simulate the remote control of a rover.

Middle School Lesson
Program Analysis Using App Inventor

In this lesson, students learn about, design and create flow charts for different scenarios, including a game based on the Battleship® created by Hasbro©. In the associated activity, Flow Charting App Inventor, students apply their knowledge from this lesson and gain experience with a software appli...

Middle School Activity
Mars Rover App Creation

Based on their experience exploring the Mars rover Curiosity and learning about what engineers must go through to develop a vehicle like Curiosity, students create Android apps that can control LEGO® MINDSTORMS® robots, simulating the difficulties the Curiosity rover could encounter. The activity go...

Middle School Activity
Flow Charting App Inventor Tutorials

Students design and create flow charts for the MIT App Inventor tutorials in this computer science activity about program analysis. In program analysis, which is based on determining the behavior of computer programs, flow charts are an important tool for tracing control flow.

Copyright

© 2013 by Regents of the University of Colorado; original © 2012 Board of Regents, University of Nebraska

Contributors

Scott Burns, Brian Sandall

Supporting Program

IMPART RET Program, College of Information Science & Technology, University of Nebraska-Omaha

Acknowledgements

The contents of this digital library curriculum were developed as a part of the RET in Engineering and Computer Science Site on Infusing Mobile Platform Applied Research into Teaching (IMPART) Program at the University of Nebraska-Omaha under National Science Foundation RET grant number CNS 1201136. 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: August 27, 2020

Free K-12 standards-aligned STEM curriculum for educators everywhere.
Find more at TeachEngineering.org