583  Mobile Phone Sensors: Hands-On Labs and Assessment

Overview

This section provides hands-on experience building mobile sensing applications and assesses your understanding of smartphone sensor concepts. Through practical labs, you’ll create real applications that demonstrate the sensing capabilities covered in the previous chapters.

NoteWhat You’ll Build

Complete four hands-on labs covering the full spectrum of mobile sensing:

  1. Activity recognition using accelerometer data
  2. GPS tracking with geofencing for location-aware applications
  3. Progressive Web Apps with offline capability
  4. Noise monitoring for participatory sensing

Plus comprehensive knowledge checks to validate your understanding.

Chapter Structure

583.0.1 Part 4A: Web-Based Sensor Applications

Labs covered:

  • Lab 1: Accelerometer Activity Recognition - Build a web app that recognizes walking, running, and stationary activities using motion patterns
  • Lab 2: GPS Geofencing Tracker - Create location tracking with entry/exit notifications using the Haversine formula

Learning outcomes: - Access smartphone sensors via Generic Sensor API - Implement activity classification using statistical analysis - Build geofencing with persistent storage

Estimated time: 45-60 minutes


583.0.2 Part 4B: PWA and Audio Sensing

Labs covered:

  • Lab 3: Multi-Sensor PWA - Create an installable Progressive Web App that works offline
  • Lab 4: Noise Level Monitor - Build a participatory sensing app using the Web Audio API

Learning outcomes: - Create offline-capable PWAs with Service Workers - Process audio data in real-time - Implement crowdsourced data collection with location

Estimated time: 45-60 minutes


583.0.3 Part 4C: Assessment and Review

Content:

  • 10 Knowledge Check Questions - Test understanding of sensor types, APIs, and best practices
  • 10 Comprehensive Review Questions - In-depth assessment covering participatory sensing, privacy, and battery optimization
  • Visual Reference Gallery - AI-generated figures for key concepts

Learning outcomes: - Validate understanding through self-assessment - Identify knowledge gaps for further study

Estimated time: 30-40 minutes


Prerequisites

Before starting the labs, ensure you’ve completed:

Learning Path

TipRecommended Sequence

Complete beginner (90 minutes): 1. Start with Lab 1 (accelerometer) - easiest entry point 2. Try the first 5 knowledge check questions 3. Experiment with Lab 4 (noise monitoring) - visually engaging

Intermediate (2-3 hours): 1. Complete Labs 1-3 in order 2. Take the full knowledge check 3. Review explanations for any incorrect answers

Advanced (4+ hours): 1. Complete all four labs 2. Implement the extension exercises 3. Take both knowledge check and comprehensive quiz 4. Build a custom application combining multiple sensors

Materials Required

  • Smartphone with sensors (accelerometer, GPS, microphone)
  • Modern web browser (Chrome or Edge recommended for full API support)
  • Text editor for HTML/JavaScript
  • Local web server (Python’s http.server or similar)
  • Optional: Internet connection for uploading data

Begin Labs

Ready to start building? Begin with web-based sensor applications:

Start Lab 1: Accelerometer Activity Recognition