I had a similar idea to track my caffeine intake(assuming that the half-life is 6 hours). The only question I haven't had time to look into yet is what is the biological effect of previously taken vs newly taken caffeine?
Say I had a cup of coffee at 9 am and then have another one at 9+6 hours=3 pm. Assume that 1 cup of coffee has 90 mg of caffeine. Does it mean that at that moment, I will have to track 2 different half-lifes?
That is, I have 90/2=45 mg of caffeine from cup #1 and 90 mg of caffeine from cup #2 at 3 pm. Should I just add those up and track the combined amount now or should it be kept separate? I am leaning towards the latter because I think that the effect(i.e. alertness) will be higher with the newly digested caffeine and not the one taken 6 hours ago? No idea how true this is though as I am not a biologist :)
If I were to estimate my blood caffeine, I'd calculate the caffeine right before I took more, add that to the new caffeine, and use that in the exponential decay function.