Category Archives: The War On Sleep

A trick for getting to sleep

I used to have a lot of trouble getting to sleep. These days I manage better (partly because I’m sufficiently tired all the time that I’m much sleepier when I’m trying), but for a long time the biggest obstacle to my sleep was just that I couldn’t shut off my mind well enough to go to sleep.

And there are still nights where that’s the case and my thoughts end up keeping me up. e.g. because I can’t shut my brain off thinking about work, or because I’m having an anxiety day and my brain really wants to remind me of all my failings. Thanks brain.

The trick for those nights which I hit on ages ago is basically to give myself something to focus on that is sufficiently mentally engaging that I can keep paying attention to it, but insufficiently so to keep me up.

Historically I’ve basically made up stories to do this – not high quality ones, often just variations on whatever I’ve been reading recently (i.e. basically bad self-insert fanfic. Don’t worry, I won’t inflict it on you). This works… pretty well, some of the time. It rather relies on my feeling sufficiently creative in order to work though, which I often don’t.

But I’ve recently found a new technique that I think works strictly better. I thought I had got it from this article about a sleep app, but on a recent reread I realised that not only had I completely got the wrong end of the stick about what their technique was, what they’re actually proposing is completely impossible for me to use due to my inability to visualise.

So, uh, yay for creative misunderstanding?

Anyway, here’s the thing I do now:

  1. Pick a starting word. Usually something short with three or four letters (cat, was, rim, keel, etc).
  2. Repeatedly try to change your current word into another word. I vary what counts as a change but usually go for allowing you to add, delete, or replace one letter, or swap two letters.
  3. When you can’t find any new words starting from the current one, start again from the beginning with a new word (you can repeat words if you want to, you just don’t have to).

I tend to set myself minigoals while playing it – e.g. I normally default to trying to make the word longer, or if there’s some word that looks reachable nearby I try to get to it – e.g. how do you get from child to shield? (this one is actually moderately hard. I don’t currently know the answer and decided not to get distracted from writing this to figure it out. Edit: See end of post). Sometimes these turn out to be harder than expected and I abandon them. If I find I’m getting frustrated with a minigoal I definitely abandon it.

That’s all there is to it really. I just keep playing the word game until I fall asleep.

This ends up working pretty well – it’s mildly engaging, certainly enough that I don’t get bored of it, but it’s also not that interesting, so it doesn’t stop me falling asleep playing it.

The major limitation I run into with this (and all techniques in this space) is that sometimes when my thoughts are very fragmented – the sort of fragmenting that comes from say a headache or a fever, not the sort that comes from sleepiness – my working memory is shot and I can’t actually hold things coherently enough to. I don’t really have a good answer for that sort of scenario other than taking some painkillers and hoping that I’m drained enough already that that’s enough.

Fortunately that’s not the normal case for me (although I’ve got a bit of it at the time of this writing. Fortunately external memory is a good substitute when writing), and this works pretty well for the common case when the problem is just that my won’t shut off properly and it’s stopping me from getting to sleep.

Now if you’ll excuse me, I’m going to go implement A* search and get a computer to figure out that damned child to shield play.

Update: ‘child’, ‘chid’, ‘hid’, ‘hied’, ‘shied’, ‘shield’. I’d probably have given up before I got that (there are other shorter ones but they go via stupid words that I wouldn’t use without sowpod in front of me to check). If you’re suspicious of even that chid (past tense of chide, obviously) then there’s ‘child’, ‘chile’, ‘chide’, ‘hide’, ‘hied’, ‘shied’, ‘shield’.

This entry was posted in The War On Sleep on by .

Dispatches from the War on Sleep

It’s been a while since I’ve updated my notes here on The War On Sleep, largely because the past months have mostly consisted of waiting and/or incremental steps. I thought I’d write up some of what’s been happening recently.

Note: This is probably not that interesting unless you also have sleep issues (or for some reason like hearing details of my medical experiences).


The story so far:

  • After my own experiments with Pulse Oximetry followed by some official ones which confirmed the same results, I’m now certain I don’t have Sleep Apnea. This is a very good thing, although does not help my particular problem.
  • After my nasal experiments, doing some research, and talking to a sleep clinic, I had reasonably high confidence that not being able to breathe through my nose is a significant contributing factor to my sleep quality issues.
  • After a visit to the ENT (Ear, Nose and Throat) clinic at Addenbrookes a couple of months ago where they stuck a bunch of things up my nose, I can confirm that my nose doesn’t work at all properly, and that there’s totally a surgery to fix that (correcting a deviated septum and enlarging my turbinates).
  • I’ll be having said surgery next week.

The link is that poor breathing through your nose means that you’ll sleep breathing through your mouth, which apparently can cause most of the symptoms I report – dry mouth and headaches in the morning and non-restorative sleep being the big ones. So it’s possible that all of my problems with sleep stem from my nose and could have been solved decades ago with an easy surgery.

I’m currently attempting to remain sceptical, and to convince myself to maintain an attitude where I don’t believe this will fix my sleep but that it will be a net good regardless of whether it does. This is mostly to prevent myself from getting excited and believing that this surgery is going to somehow magically fix everything, then being disappointed when all it does is improve my breathing and I still sleep terribly.

It’s somewhat working, but I’m still quite excited.


Another interesting recent development in the war on sleep is that I’ve recently acquired a HealthyPi. So far I wouldn’t particularly recommend rushing out and buying your own. The ECG doesn’t seem to really work for me (hopefully this will be fixed. According to the linked ticket this may be fixable in software and/or with better placement of electrodes), so right now it’s a pulse oximeter (which I already have. Also it doesn’t do heart beat off the pulse oximeter, only off the ECG, and SPO2 readings are basically not useful for anyone without sleep apnea because your SPO2 doesn’t budge unless something is very wrong) and a thermometer.

Still, the thermometer is useful. I’ve had the parts to put hook up an Arduino to a thermometer for about 6 months now and not gotten around to doing the work, so it’s nice to have that shortcut.

Unfortunately I’m also suspicious of the thermometer. As well as the linked issue I have a nagging suspicion that it’s reporting is slightly (maybe 0.25C at most) low, but it turns out that all the thermometers I have access to are slightly differently calibrated so I’m not sure (this has rather disillusioned me about home thermometer readings being a useful diagnostic tool, though they’re probably fine as long as you’ve taken a healthy reading with the same thermometer recently).

Still, I did an overnight temperature reading based on taping it to my armpit with a plaster and got the following graph:

This is interesting because it suggests (subject to concerns about both reliability of both the thermometer and reliability of external readings) that a thing I’ve believed for a while – that my body temperature rises at night when it should be falling – is probably true. The high there is only just over 37, but my body temperature according to other thermometers is typically a bit low (36.5 seems to be normal for me), and the body temperature the thermometer was showing for me after it stabilised in my reading earlier was 36.25, so 37 might actually be quite high.

It’s hard to say for sure though. The sharp drop at around 3:30 followed by the subsequent variability of the temperature is almost certainly not a result in changes of my body temperature (If your body temperature actually drops to 32 degrees then you are suffering from acute hypothermia and require immediate medical attention), but instead a result of the sensor coming partially detached. I’m going to try to get a more accurate reading tonight by, well, doing the obvious thing and sticking the thermometer up my butt (apologies for TMI, but science). Update: This didn’t work well. The HealthyPi thermometer is very poorly shaped for it.

If you have a recent (note: This is from the v3 ones that have just shipped. Older versions appear to use a different protocol) HealthyPi and are interested the code I used to gather the data for the above is based on this code I cobbled together which reads the USB serial port data stream and dumps the raw data as JSON. It’s based on a mix of experimentation and attempting to decipher the processing code for parsing the serial data and the code for writing it. It mostly seems to work (and I’ve checked its results against the GUI) but does very occasionally (I’ve seen it once) find a bad footer. I don’t know what’s up with that. It might be a bug in the healthypi, but it’s probably a bug in my code. Hard to say given the undocumented protocol.

Fortunately the packets are designed such that you can fairly reliably find the beginning of a new one, so it only gets one bad packet and then recovers just fine.

If I can get reliable temperature readings it will be interesting to see before and after results from the surgery. I’d be surprised if body temperature was related to nasal breathing problems, but not extremely surprised as there could be some indirect link.


If you go to a doctor complaining about being tired and sleeping poorly, they will spend a long time trying to convince you that you’re suffering from stress and/or anxiety (my working theory remains that they’re thinking “Well how do you think I feel?!” while doing it).

I’ve become pretty good at loudly repeating “No, these are physical symptoms X, Y and Z” and pushing my way through the system anyway. It’s a skill I recommend acquiring (and if you struggle with it, either personally or because doctors don’t take you seriously due to e.g. gender, note that in the UK at least you can bring someone with you to your GP appointments).

And I still believe the root cause of my sleep problems is physical. Maybe it’s the nose thing, maybe it’s something else, but they’ve presented too reliably regardless of my mental state to not be.

But, well, they’re not wrong about anxiety also causing sleep problems and tiredness, and I do suffer from anxiety, so it’s at least worth trying to deal with.

I tried an SSRI (Citalopram) on my doctor’s recommendation, but I had such a bad reaction to it (including substantially worse sleep!) that I ditched it almost immediately. I should probably consider trying again, but this is my second time on an SSRI and I’ve hated it both times, so I’ve been unable to talk myself into it. Ultimately I think my anxiety and depression are both mild enough that the cost/benefit analysis doesn’t work out.

I’ve also tried theanine for this. It seems to help a bit, but I’m not sure.

A lot of the problem here is I think that my baseline for sleep quality is so bad that it’s very hard to tell the difference. I’m probably going to revisit this question post-surgery.

I have vague intention to try meditating. It’s not something I’ve had a great deal of success at in the past. I’m currently reading The Mind Illuminated, which seems very well put together so far, but I’m currently having two difficulties:

  • It’s very hard to maintain stable attention when you’re spacey from lack of sleep.
  • The central meditation object suggested by the book is breathing through your nose.

So, um, yeah, there are a couple of things on the critical path here. Another thing to revisit post surgery.

The Future

Well, we’ll see. It all depends on what happens with the surgery. I’ll probably have more of an update about that in a month or so.

This entry was posted in The War On Sleep on by .

A reset protocol for my body

Epistemic status: A collection of things that seem to help based on non-calibrated trial and error on a study of N=1. Note also that I am not a doctor and this should not be considered proper medical advice.

This is a combination of things I find useful when I am feeling in a state I would describe as “generally out of sorts”. Possible incomplete symptoms of this are:

  • Headache
  • General soreness/stiffness
  • “Foggy head” – difficulty thinking, focusing, etc
  • Restless energy/jitters making it difficult to focus
  • Mild to moderately bad mental health day (depression, anxiety, high irritability, etc)
  • Fatigue

Or, as I like to call it, “It isn’t 16:00 yet” (I am only being somewhat facetious. the expected number of symptoms from the above list I experience on a given day is > 2, and they tend to be especially severe until about mid afternoon).

This is often triggered by having slept badly, but that’s somewhat definitional for me: If I wake up feeling this way then I consider myself to have slept badly even if I’ve had 8 hours of apparently solid sleep.

(Yes this is probably a sleeping disorder of some sort. No it’s probably not sleep apnea. Yes I do now have a referral to a sleep clinic).

Anyway. Regardless of the cause, with a combination of effort and tactics this is a relatively fixable state. The fix doesn’t take me to “WOO I FEEL GREAT” but it takes me to “WOO I FEEL ACCEPTABLE” more often than not, and significantly more often than regression to the mean seems to.

I cannot guarantee it will work for you, but it seems to work for me.

The Basic Protocol

  • 400mg of ibuprofen
  • 200mg of caffeine
  • 300mg of theanine

I am not certain of these proportions, particularly the suitable amount of theanine (on the one hand it’s a bit low for the amount of caffeine, on the other hand it’s a bit high in absolute terms). You may wish to tinker with the quantities based on your individual sensitivities.

These drugs are both good cures for the symptoms (caffeine + theanine for alertness and fatigue, theanine for reducing jitters both in baseline and from caffeine, ibuprofen for headache and general stiffness, with caffeine having a synergistic effect which makes the ibuprofen work better).

The following are also essential parts of the basic protocol:

  • Drinking a large quantity of water. Somewhere in the 1-2 liters range.
  • Eating food. Something high in both sugar and protein works well here. I like peanut clif bars.

Dehydration and low blood sugar are both contributing factors to feeling out of sorts for me. Waking up very dehydrated is in particular very common for me, and it takes a while to recover from it.

This works relatively well on its own, but is best followed by:

The Advanced Protocol

The most effective thing on top of the above is this:

  • Go for a run.
  • Have a long shower.

“A run” needs to be intensive enough to get up a good sweat. I don’t know what about runs helps here, but I’d expect it to be some combination of endorphins and increased blood flow. I do not find that low cardio strength exercises are an adequate substitute here, but other high cardio things might (people have suggested jumping jacks to me, but I haven’t tried that). A long walk is also an improvement although less so.

The shower is at least partly because if I’ve done running adequate to enact the advanced protocol then I really need one, but I do find they also help.

The normatively correct shower for this is hot then cold then warm enough to recover from the fact that I’m now freezing. I am not good at following this because I hate cold showers and usually my actual shower is warm but not too hot (very hot showers on their own seem to exacerbate things).

After this I will usually feel OK enough that I am able to be productive unless something more serious turns out to be wrong, but there are some fall back plans:

  • If I still have a headache I follow up with a paracetamol + codeine mix. Paracetamol on its own is rubbish and does nothing for me (and is scary), but it has a synergistic effect with codeine that makes it a magic headache-be-gone. Paracetamol + caffeine is supposedly not a great combination for your liver, but it’s sufficiently ubiquitous that it’s probably not that bad. I don’t deliberately delay taking it after caffeine, but usually the “wait and see if the ibuprofen works” period is enough of a delay.
  • If it’s the evening and I haven’t had any paracetamol then sometimes having a drink fixes things.

Other things

I’m considering adding a few things to the basic protocol drug regimen:

  • 3g of glycine. I take this before bed currently on grounds that it’s harmless and there are good studies showing it improves results for people who experience moderate sleep deprivation. There are also studies showing it improves fatigue, but it’s unclear to what degree that improvement is just because it improves sleep. Also it’s cheap and harmless.
  • An antihystamine and a decongestant. Anecdotally this feeling seems to be correlated with being stuffed up, but it’s unclear to what degree that’s just because I’m usually stuffed up (yes this is probably related to my sleep issues, no a steroid spray doesn’t help).
  • Some form of anti-anxiety med. One of the benefits of theanine is that it is a mild anti-anxiety drug, but it’s not a very powerful one. Given that a number of the symptoms of this are mood issues this seems like a thing worth investigating.

Anyway, this is just my protocol, and may not work for you, but it’s been refined enough over the years and continues to be modified over time that I figured there might be some useful knowledge for other people in it. I hope some of it is helpful.

Similarly, I imagine other techniques will work for other people, and maybe there are some that work for me that I don’t know about! Please feel free to use the comments section to share suggestions (or let me know elsewhere and/or privately if you prefer)

This entry was posted in The War On Sleep on by .

Giving up on giving up on caffeine

Yesterday I paid Grayson Morris £75 for the privilege of getting to have caffeine again (when I set up the pre-commitment in May I foolishly specified it would be $90 rather than the equivalent number of pounds, which back then would have been £62. Thanks Brexit).

The context is that I set up a community policing policy for my caffeinefree beeminder goal in which I precommitted to keep it going until May next year and that I would pay this penalty if I didn’t. Yesterday I decided that I wasn’t going to do that and was instead going to pay the penalty, and Grayson was the one to claim it.

This is a post-mortem for that goal, and a discussion of what’s going to happen now.

Why did I decide to archive the goal?

The core reason I decided to archive the goal is that I concluded that I was almost certain to want to archive the goal between now and the deadline, the cost would remain constant, and I didn’t feel I would derive significant benefit from an additional period of the goal being active. Additionally, given my currency is not doing very well and is likely to do worse before it gets better again, the cost of archiving it was only going to go up.

In particular I decided that I would get more than £75 worth of benefit from being able to drink caffeine again regularly. I’ve spent about 5 months without a caffeine addiction, during which the longest period without any caffeine at all was nearly two months. At this point I feel like I have an adequate grasp of what life without a caffeine addiction is like and I don’t enjoy it very much.

What’s wrong with life without caffeine?

A couple of things. First, I can reasonably conclusively say now that caffeine is not the culprit for my bad sleep. I still sleep terribly without caffeine. This isn’t something wrong with life without caffeine per se, but it means that life without caffeine doesn’t have to just be not bad it has be actually good.

And I’ve not really found that to be the case. The only concrete benefit I can point to being without caffeine is that I’m a somewhat calmer person.

Set against that, there are some major downsides to life without a caffeine addiction for me:

  1. I don’t actually like being a calmer person very much, because it tends to just result in me being a more depressed person.
  2. I still have bad days where I haven’t slept properly or am just exhausted for some other reason and there’s nothing I can do about it. This is especially bad as I have been doing a lot of longish distance driving recently, so there’s a real possibility that a lack of caffeine could actually kill me, but even without that this sucks.
  3. Occasional caffeine use is much worse for me than regular caffeine use. It turns out that when I haven’t built up my tolerance I’m just really sensitive to caffeine and then even fairly small quantities do significantly disrupt my sleep.

What went well with this goal?

I’m mostly pretty happy with how this went. It’s been by far my longest period in my adult life without a caffeine addiction, and this goal definitely helped me achieve that. I thought this goal structure was great and I might well use it again in future for other things.

I also found the community policing thread really helpful and will probably use it again for other hard to commit to goals.

What would I do differently in retrospect?

I think I committed to this goal for too long and for too much money. If I were to try something similar in future I would:

  1. Not commit to it for more than 6 months
  2. Commit to it for maybe half the original amount of penalty
  3. Commit in my local currency. But in my defence I didn’t really expect a popular vote and an unelected borderline fascist government to decide to tank said currency.

What are the expected consequences of being back on caffeine?

I expect my energy levels to be higher and more regular.

I also expect to be an angrier person.

I’m not making this up. The two things I forget or underestimate every time are that caffeine withdrawal makes me intensely depressed and going back on caffeine makes me angry. I always get to the end of the day and go “Why am I so depressed/furious? OH RIGHT CAFFEINE”.

I think a large part of this is not caffeine itself but my temperament and how I respond to having insufficient / too much energy (I’m basically always somewhat depressed and always somewhat angry, but how much I am of each depends on how much energy I have to express them), but these are also just physiological consequences of how a body responds to caffeine.

This effect will be more pronounced in the near future as my body acclimatises to caffeine and I adjust to having more energy. I apologise if I am unnecessarily short with you as a result and you should feel to call me on it.

I’m going to be trying to offset this effect by supplementing my caffeine intake with theanine. Anecdotally it seems to be somewhat helpful for this but doesn’t make the effect go away.

Closing remarks

Thanks to everyone who participated in the community policing thread, and thanks to Beeminder for enabling this. Although I’m terminating the experiment early and the result is more negative than I was hoping for, I still consider the experiment to be a success and am glad I did it.

This entry was posted in Beeminder, The War On Sleep on by .

Nasal experiments

First an obvious warning: Despite the domain name, I am not a doctor. None of this post is medical advice. Talk to your GP. etc. etc.

Now, some backstory: This is part of the project I’ve dubbed “The War on Sleep”, which is me finally getting bored of the fact that I’ve spent most of my life waking up feeling terrible every morning.

The latest cause I’m investigating is that this might be a “simple” matter of mouth breathing at night, caused by the fact that it turns out I more or less can’t breathe properly through my nose. Mouth breathing is definitely supposed to affect quality of sleep, so it seemed like a reasonable hypothesis.

But do I actually have trouble breathing through my nose? I mean sure it’s harder to breathe through my nose than my mouth, but that’s normal, right? I compared with my brother and father (both of whom also have sleep issues) and they seemed to have about the same experience, but that could be anywhere between this being normal and us having some genetic nose design flaw (we all have very similar noses).

Turns out, it’s closer to the latter. In order to determine what’s normal I put together a small experiment and asked the internet to participate in it. It’s not very scientific due to sampling bias, small sample size, erratic data collection, etc. but as a starting point to just get a sense of what things look like it worked pretty well.

The experiment is this: Breathe out fully, then breathe in fully as hard as you can. Time how long it takes you to breathe in, breathing in as hard and fast as you can. Repeat this in four different ways: First breathing in with just your mouth, then with just your nose, then with just your left nostril, then with just your right nostril.

The idea is that this time to complete a breathe in is a pretty good proxy for how difficult it is to breathe in in a particular way: You’re using the same lungs to draw air through each time, so the only difference is how much air you can get through that passage way.

For me a full breathe in with my nose takes about 5-10 times as long as a full breathe in with my mouth, and my right nostril takes a bit under twice as long as my left. That doesn’t sound good, certainly, and when comparing with other people on the experiment it does turn out to be atypically bad.

I don’t have a proper statistical analysis of the experiment results (sorry), but here’s what eyeballing the data shows:

  • Some people have the same breathe in times for mouth and nose
  • More normal seems to be taking about twice as long with nose
  • It’s actually pretty unusual to have a significant difference between left and right side – only two other people who took the experiment had more than a 20%ish difference between them (one had 1.5x in one nostril, the other 3x). I don’t know who you are, but you might want to talk to a doctor about that if you don’t currently have a cold or know what’s up with that.

A couple observations of experiment design:

  • I should have checked what time of day it was for participants (or at least how long ago they’d woken up). It turns out that the nasal cycle is a thing. I’ve noticed this myself now that I know to look for it – when I first wake up I can barely breathe through my right nostril (I genuinely can’t get enough air – it feels like I’m suffocating) but later in the day it’s just slow.
  • really should have asked people if they had any known complications that would explain their results. It would have been much more useful data.

Still, the experiment largely served my purpose and I think the results are interesting. Also, the basic structure of it works pretty well, so I’ll be reusing it.

Armed with this data I went to my GP and explained what was up. Off the back of that, I’ve been issued with a steroid nasal spray. It supposedly will take about two weeks to take effect.

And the great thing is that because I have a pretty good objective experiment demonstrating the problem, I can track that effect! I’m going to be running this experiment several times a day for the next month or so to see if the spray is making any difference.

This feels like a big deal to me. I don’t know if this is what’s causing my sleep problem, but it certainly seems like a problem, and having an objective assessment I can just run and see whether it’s helping is going to be great. Doing a subjective “do I feel better today than yesterday?” is almost impossible, but being able to track the improvement (or lack of it) by the numbers is going to be a big help.

This entry was posted in The War On Sleep on by .