How a Caffeine Tracker Uses Decay Math to Show What's Still in Your System
A developer built a manual caffeine tracker that estimates residual caffeine in the body using an exponential decay formula based on a default five-hour half-life. Unlike a simple daily total, the tool sums the decayed residuals of every logged drink, meaning a late-night coffee from the previous day can still show up in the current estimate. Records are kept for 48 hours rather than reset at midnight, preventing the misleading scenario where a low daily total masks significant leftover caffeine. The tracker includes a Chart.js projection of residual levels over the next 24 hours, sampled at 30-minute intervals, with a configurable 50 mg sleep threshold line and a separate 400 mg daily reference. The project's key design principle is keeping dose, time, half-life, and display thresholds as distinct variables rather than collapsing them into a single opaque figure.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in