I took some more pinhole photographs around work at lunchtime. None of them are at all sharp.
Reading up on this on the internet, the beauty of pinhole photography is that you get equally sharp pictures from close up all the way to infinity, but depth of field does not equal depth of focus (as you can see).
Somebody suggested using extension tubes to move the pinhole further from the sensor (as the ratio of pinhole size to distance to sensor is important for sharpness). I tried all combinations of my extension tubes when I got home and none of them made any difference (and to be honest the article I read said the same thing).
I suspect that the problem is that it is a digital sensor. The camera has a filter in front of the sensor so light needs to enter the filter (nearly) perpendicular, which is what you get from a conventional lens. But the light from the pinhole is coming from a single point and only the pixels near the centre of the frame will get light coming in perpendicular.
I might get the pinhole optic for my lensbaby and see if that is any better, but I suspect not.
Alternatively, I could get some film for my film SLR and use the pinhole on that. No working out the exposure by trial and error like I’ve been doing on the DSLR 😉