I've never been a great sleeper. I knew caffeine could be a factor and I understood, at least intellectually, that caffeine’s half-life clearance meant that some of it might still be floating around my brain later in the day. But I didn't fully grok the dynamics until seeing it play out visually.
So this is a (simple) simulator, built to visually explore 2 questions:
1. How long can caffeine stay in your system?
2. When will caffeine levels fall back below a threshold with minimal sleep disruption?
Take this with a big grain of salt. I'm not a pharmacist, physician, chemist, etc, and this hasn't been reviewed by one. But at least for me, being able to turn the dials on a simple half-life model and see the consequences has been eye-opening.
Used to suffer occasional dizzy spells totally preventing me moving normally. A doctor said another patient removed caffeine from her diet, problem solved! I did same and each subsequent event was weaker, until now disappeared.
List of food and drinks containing it here...
https://www.nutrientsreview.com/articles/caffeine.html
The defaults are based on published papers, but should be interpreted loosely given the variability. A few considerations:
1. Even though some companies list precise #s for caffeine content, actual caffeine content can vary widely from day to day (259mg - 564mg) according to [1]
2. Caffeine half life varies from person to person, from ~1.5 to ~9.5 hours. So 5 is typical according to [2], but unless you're a smoker or on certain birth control I haven't found anything yet to say which end of the distribution to expect for yourself.
3. Caffeine sensitivity also seems to vary from person to person. And the "sleep threshold" is more of an upper bounds than a target, based on working backwards to figure out how much caffeine subjects had in their system and still saw sleep disruption in [3,4,5]. So participants in [5] slept worse when you'd expect them to have ~25mg of caffeine remaining in their system on avg, but that doesn't necessarily mean they'd have slept normally at 24mg.
Yikes! I'd assumed you might reach toxicity before running out of digits! If you post the "share" link from the notebook I'll take a look. Or feel free to email me, my address is in my profile.
So this is a (simple) simulator, built to visually explore 2 questions:
1. How long can caffeine stay in your system?
2. When will caffeine levels fall back below a threshold with minimal sleep disruption?
The answer is, it depends... so I parameterized the notebook to try different options. Notes on the parameters / lessons learned are here: https://towardsdatascience.com/interactive-visualizing-caffe...
Take this with a big grain of salt. I'm not a pharmacist, physician, chemist, etc, and this hasn't been reviewed by one. But at least for me, being able to turn the dials on a simple half-life model and see the consequences has been eye-opening.
Default params are chosen based on: * https://www.ncbi.nlm.nih.gov/books/NBK223808/ * https://doi.org/10.1038/clpt.1987.126 * https://doi.org/10.1002/cpt197824140 * https://doi.org/10.5664/jcsm.3170 * https://doi.org/10.1111/j.1365-2869.2006.00518.x * https://doi.org/10.1016/0006-8993(95)00040-W