SummaryStudents develop an app for an Android device that utilizes its built-in internal sensors, specifically the accelerometer. The goal of this activity is to teach programming design and skills using MIT's App Inventor software (free to download from the Internet) as the vehicle for learning. The activity should be exciting for students who are interested in applying what they learn to writing other applications for Android devices. Students learn the steps of the engineering design process as they identify the problem, develop solutions, select and implement a possible solution, test the solution and redesign, as needed, to accomplish the design requirements.
As students create Android applications that performs specific functions, guided by the steps of the engineering engineering design process, they are doing just what software engineers do as they develop applications that we all encounter on a daily basis. This includes business software, communication software, compilers, computer graphics, and more. Ultimately, students must 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. Thus, students act as software engineers in this hands-on application of the engineering design process.
Students should have a basic understanding of computer programming design and control structure. Students should also have a basic knowledge of how MIT's App Inventor works. If this activity is conducted with students who have not previously worked with App Inventor, allow additional time for students to work through the MIT tutorials (http://appinventor.mit.edu/explore/learn.html) to gain an understanding of how App Inventor works.
After this activity, students should be able to:
- Design a mobile app for an Android device.
- Create a mobile app for an Android device using MIT's App Inventor.
- Apply the software/system (engineering) design process.
More Curriculum Like This
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.
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...
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.
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...
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.
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.
- The design process includes defining a problem, brainstorming, researching and generating ideas, identifying criteria and specifying constraints, exploring possibilities, selecting an approach, developing a design proposal, making a model or prototype, testing and evaluating the design using specifications, refining the design, creating or making it, and communicating processes and results. (Grades 9 - 12) Details... View more aligned curriculum... Do you agree with this alignment? Thanks for your feedback!
- Established design principles are used to evaluate existing designs, to collect data, and to guide the design process. (Grades 9 - 12) Details... View more aligned curriculum... Do you agree with this alignment? Thanks for your feedback!
- 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) Details... View more aligned curriculum... Do you agree with this alignment? Thanks for your feedback!
Each group needs:
- MIT's App Inventor (a web-based, free software available at http://appinventor.mit.edu/explore/content/setup-mit-app-inventor.html; this site provides information on how to set-up for and install App Inventor)
- sheet of large paper or dry-erase white board
- markers (dry erase markers if a dry-erase white board is used)
- Android device, such as a smartphone or tablet (The website http://appinventor.mit.edu/explore/ lists all devices known to work with App Inventor in the right column under the title "Phones & Tablets Database".) **Note: Each group needs this item. This activity has been performed with students using their own Android mobile devices, which may not be available for every classroom. Adjust group sizes depending upon how many devices are available for use, or if the class is small enough, working together as one group sharing a teacher-provided Android mobile device. These options may limit the learning experience of each student, though.**
In this activity, you will develop an app for an Android device. However, the activity is about more than the single app you develop. It is about the skills that you gain while you interact with the software that helps you develop your app. At the end of the activity, you should have the skills in place to write other apps for an Android device that use the internal sensors to collect data and store that data. If you desire, you can use the skills that you learn to write other apps for Android devices that can be published for public access and use.
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.
pseudo-code: A computer programming method where students design what the application must do without writing any actual code in the programming language's syntax.
TinyDB: A database on an Android device that can be used to store persistent data.
Students develop an app for an Android device that stores data collected during an experiment that can be used for analysis later. The Storing Android Accelerometer Data: App Design lesson has students complete online tutorials based on using MIT's App Inventor. At the end of this lesson, students should be prepared to write applications that can access an Android device's internal sensors.
The procedure is an outline and does not provide specific details on exactly what steps students must take to create their Android apps. This is because the purpose of this activity is for students to work through the process themselves. They might not figure out a code that works correctly the first time. This is an expected part of the learning process that forces students to evaluate their mistakes and redesign their codes. If too much information is provided, students never experience this critical part of the design process.
Before the Activity
- Install and set up the App Inventor software. Instructions for how to do this are provided in a tutorial on the MIT website: http://appinventor.mit.edu/explore/content/setup-mit-app-inventor.html
- The teacher and students should have a basic working knowledge of programming and how App Inventor works. Refer to MIT's tutorials for App Inventor at: http://appinventor.mit.edu/explore/
With the Students
Students plan a mobile android app that can access the accelerometer on an Android device. This planning consists of the first two steps in the software/system design process, namely the requirement analysis and design steps. When working through these steps, facilitate a lot of discussion about how the application should function. No actual code is written at this point; rather, students write pseudo-code.
Pseudo-code is a rough draft of written computer code. It is syntax independent; meaning the language being used is irrelevant, so the pseudo-code simply puts the blueprint or plan for all or part of a program into words that can next be translated into a specific programming language using that language's particular syntax. Refer to the attached Pseudo-code Example.
Writing pseudo-code is a computer programming method in which the designer determines what an application must do without writing any code in the programming language's syntax. It might take the form of a flow chart or block diagram. In each stage of the pseudo-code, students need to think about the ordering, control structures and algorithms that are necessary to accomplish that stage. Have students work in groups of 2-3 to each discuss and figure out a design that allows them to create code that directs an android device to store and recall data. During the discussion, encourage them to use markers and large sheets of paper or dry-erase boards. Once group comes consensus on how to build the code is achieved, have students draw detailed diagrams of the necessary App Inventor blocks to share with the class. The diagram should include labels, colors and the correct connection types.
Students use MIT's App Inventor to create an application that stores the accelerometer data from an Android device. This part of the activity is the implementation, testing and evolution phases of the software/system design process. Students create the software code using App Inventor (implementation), test to see if the code functions, and look for possible improvements (evolution). The program they create also allows students to retrieve the data and manually transfer it for analysis using Microsoft Excel, Geogebra, or a similar programs.
Follow this general process to create a program within App Inventor. Encourage students to add or modify these basics in order to make the program user-friendly. These steps are provided only as a guideline to help facilitate the implementation phase.
- Create a new application titled "AccelerometerData."
- The program needs a clock (the clock should not be enabled; wait until the start button is clicked to enable the clock), labels for displaying the data, start, stop and submit buttons, a TinyDB, and an AccelerometerSensor. Drag these in from the Palette.
- Open the Blocks Editor.
- In the Blocks Editor, the program needs the following:
- A variable to keep track of the timer
- A StartButton. Click that resets and enables the timer
- A Clock1.Timer thT increments the timer by one, sets the acceleration text box to the chosen value of the accelerometer sensor (x, y or z), and stores that value in the TinyDB, using the timer value as the tag
- A StopButton.Click that disables the timer and clears any text boxes
- A SubmitButton.Click that sets the text of the acceleration text box to the value from the TinyDB using the number typed into the timer text box as the tag
Review the software/system (engineering) design process with students and how it can be applied to this type of activity. Ask students to list each step in the process and write an example of what they might do during each step. Ask students to share their response with the class. (Details on the steps of the engineering design process and the software development life cycle may be found in the Background section of the associated lesson.
Activity Embedded Assessment
Circulate around the room while students are designing (writing pseudo-code) to assess their progress. Later, when the designs are implemented, be available to assess progress and assist with implementation.
For the teacher's use, refer to screenshots of example App Inventor Code for this program in the App Inventor Code for Accelerometer Activity, and the Android App developed in App Inventor is provided in Accelerometer Android App. Use these files as an answer key or teacher guide.
Have students complete the following performance assessment: Create an application that stores your GPS locations over a given time interval.
This code looks similar to the acceleration application, but requires a "Location Sensor" from App Inventor instead of an "Accelerometer Sensor." To grade this challenge, look at the design elements that students created as well as the code. The ultimate test of the program is to run the developed Android app and see if it indeed stores GPS locations over a time interval. Base part of the assessment on how students applied the software/systems design (engineering) process in the completion of the mobile app.
For the teacher's use, example screenshots of the GPS Location Storing App created in App Inventor are provided in App Inventor Code for GPS Location, and the Android App for storing GPS data is provided in GPS Location Android App.
Assign students to complete one of the following writing assessments. Answers are provided in the attached file: Android App Design Assessment Solutions.
- Describe the purpose of the TinyDB when creating an Android app.
- Create a button that toggles off and on in an Android app. Explain what steps you would have to include in App Inventor to create this button and draw some pseudo-code that represents the programming of the button.
Have students create other mobile apps of their choosing to solve a problem or challenge decided by the teacher or the class.
ContributorsScott Burns, Brian Sandall
Copyright© 2013 by Regents of the University of Colorado; original © 2012 Board of Regents, University of Nebraska
Supporting ProgramIMPART RET Program, College of Information Science & Technology, University of Nebraska-Omaha
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: May 10, 2017