PhysicsLab is an Android app that treats a phone like a real physics instrument instead of a bag of disconnected sensor demos. It includes 35 experiments using phone sensors: accelerometer, magnetometer, gyroscope, microphone, barometer, light, proximity, GPS, and Bluetooth LE.
Built with Kotlin, Jetpack Compose, and Material 3. Inspired by phyphox (RWTH Aachen), reimplemented from scratch.
I wanted a physics lab that lives in the device everyone already has. Phones are packed with sensors, but most apps expose them as toys: a graph here, a compass there, maybe an accelerometer demo. PhysicsLab asks what it takes to make that hardware feel like lab equipment. Sensor capture, DSP, experiment-specific ViewModels, export, remote control, and custom experiment definitions all live in one Android app.
The part worth inspecting is the engineering split. Sensors are not glued directly to screens. The app has separate modules for sensor capture, signal processing, graphing, persistence/export, remote control, and experiment UX. That is the difference between a demo and a platform.
- 35 physics experiments across 6 categories
- 9 sensor inputs + speaker output
- Real-time graphing - custom Compose Canvas engine at 60fps
- DSP pipeline - FFT, autocorrelation, digital filters, peak detection
- Data export - CSV, TSV, Excel (XLS)
- Remote control - embedded web server, control from any browser on same network
- Bluetooth LE - connect to Arduino and custom devices
- Custom experiments - load phyphox-format XML experiment definitions
- Modern UI - Material 3, dark mode, dynamic color, accessibility
| Category | Count | Examples |
|---|---|---|
| Raw Data | 7 | Accelerometer, Gyroscope, Magnetometer, Light, Pressure, Proximity, GPS |
| Tools | 8 | Acceleration Spectrum, Inclination, Magnetic Ruler, Stopwatches (acoustic, motion, optical, proximity) |
| Acoustics | 9 | Audio Spectrum, Audio Scope, Doppler Effect, Sonar, Tone Generator, Frequency History |
| Mechanics | 9 | Pendulum, Spring, Centrifugal Acceleration, (In)elastic Collision, Elevator, Roll, Free Fall |
| Everyday Life | 1 | Elevator (speed and height from pressure) |
| Fun | 1 | Xmas Receiver (decode dual-tone encoded images) |
- Language: Kotlin 1.9
- UI: Jetpack Compose + Material 3
- Architecture: MVVM + Clean Architecture (multi-module)
- DI: Hilt
- Sensors: Android SensorManager, AudioRecord/AudioTrack, LocationManager, BLE
- DSP: Custom FFT, autocorrelation, Butterworth filters (pure Kotlin)
- Graphs: Custom Compose Canvas (no third-party charting library)
- Network: NanoHTTPD embedded web server
- Export: CSV/TSV (native), XLS (lightweight BIFF8 writer, no Apache POI)
- Build: Gradle Kotlin DSL, minSdk 24, targetSdk 34
core/sensors/src/main/java/com/physicslab/core/sensors/for the sensor abstraction layer.core/dsp/src/main/java/com/physicslab/core/dsp/for FFT, filters, autocorrelation, and signal utilities.core/ui/src/main/java/com/physicslab/core/ui/graph/for the custom Compose graphing components.feature/experiments/src/main/java/com/physicslab/feature/experiments/for the experiment catalog and ViewModels.feature/remote/for the embedded web control surface.
Reviewer note: the repository currently tracks generated Gradle output from development. On Windows, a full checkout may require long paths (git config --global core.longpaths true) or a sparse checkout focused on source modules. The source layout above is the part worth reviewing.
git clone <repo-url>
cd PhysicsLab
# Set Android SDK path
echo "sdk.dir=/path/to/Android/Sdk" > local.properties
./gradlew assembleDebugAPK output: app/build/outputs/apk/debug/app-debug.apk
./gradlew testDebugUnitTestTest files focus on DSP correctness, export formats, physics formulas, sensor data models, the custom experiment parser/engine, and remote-control routing.
:app - Entry point, DI wiring, navigation
:core:sensors - Sensor abstractions (9 types + audio + BLE)
:core:dsp - FFT, autocorrelation, filters, signal utilities
:core:data - Export service, Room persistence, DataStore
:core:ui - Graph components, theme, shared composables
:feature:experiments - All 35 experiment ViewModels + UI
:feature:remote - NanoHTTPD server + web interface
:feature:settings - Settings screen
This project is licensed under the GNU General Public License v3.0. See LICENSE for details.
PhysicsLab is an independent project. "phyphox" is a trademark of RWTH Aachen University.