$ show intel/generic-sensor-demos
This repository is a collection of standalone web application demos from Intel showcasing the W3C Generic Sensor API (Accelerometer, Gyroscope, Magnetometer, AmbientLightSensor, OrientationSensor). The demos are built with Polymer 2/3, LitElement, Three.js, and A-Frame, and include a sensor polyfill, a sensor tester with automated test cases, a punch speed meter, a VR button using magnetometer, 360-degree panorama and video viewers, and an ambient light map. The code is functional but outdated, relying on deprecated Polymer patterns and old library versions. The primary value lies in the sensor polyfill implementation and the walking detection algorithm, which are self-contained and demonstrate non-obvious engineering skill. The repo was migrated to the W3C organization and is no longer actively maintained.
The LLM identified 3 files worth highlighting for reuse:
Implements comprehensive polyfills for the Generic Sensor API (RelativeOrientationSensor, AbsoluteOrientationSensor, Gyroscope, Accelerometer, LinearAccelerationSensor, GravitySensor) using the older deviceorientation and devicemotion events. Demonstrates deep understanding of sensor event handling, quaternion math, and coordinate system transformations. This module is self-contained and could be extracted and used as a standalone polyfill for browsers lacking native sensor support.
A walking detection algorithm that processes accelerometer data to determine if the user is walking. It implements a sliding window, magnitude calculation, smoothing, peak/valley detection, FFT for frequency analysis, and step counting. The algorithm is device-dependent (tuned for Pixel) but demonstrates a reusable pattern for real-time step detection from inertial sensors. It can be extracted and adapted to other step-counting applications.
The MaxSpeedCalculator class computes the peak velocity from LinearAccelerationSensor readings by integrating acceleration over time using trapezoidal integration. It detects the first velocity peak above a threshold, stops after a timeout or when speed decreases, and returns the result in km/h. This is a clean, self-contained module that can be reused for any application needing to measure impulse velocity from linear acceleration data.