A QMK keyboard RGB animation where each key glows based on typing activity. Three independent decay blocks per key respond to different timescales — conversation, session, and sprint — and their temperatures sum to drive the LED color.
The physics is Newton's law of cooling: each keystroke adds energy, and temperature decays exponentially with a tunable half-life.
No simulation loop — just expf() on every frame.
QMK RGB Matrix on ARM boards (STM32F4, RP2040) with hardware FPU.
Per-key state is 3 floats (one per block) × 4 bytes × 104 keys = 1248 bytes.
Decay rates and energy values are compile-time constants.
The hot path is one expf() per block per key per frame.
- physics.md — Newton's law of cooling, Fourier's rod, and the discrete rod. The math and history behind the model.
- exploration.md — Early experiments with coupled blocks and eigendecomposition. The path that led to the simpler independent-blocks approach.
- simulation.js — JavaScript demo that tunes presets by simulating realistic typing scenarios: a Discord chat, a morning of deep work, a crunch week. Run with
pnpm simulation. - implementation.c — The C firmware. Three blocks per key, precomputed decay rates, color interpolation from a temperature-to-color table.