Focus is one of the most frustrating problems when shooting in the dark. The number of astrophotos ruined by poor focus is legion. Worse, the problem is often not found until afterwards, when hours of effort have been wasted. Very slight errors in focus can spoil an otherwise great photo.
Taking photos in the dark creates a situation where the normal solutions do not work… Autofocus simply will not operate without enough light. Taking the lens off and attaching the camera to a telescope results in a completely manual focus. Simply focusing through the viewfinder is not accurate enough.
The simplest method of focusing in the dark is to use the live view feature of the camera. By placing a bright star or distant streetlight in the view and magnifying you can achieve a reasonably good focus much of the time. This is not perfect, even the magnified image is a little mushy near ideal focus, making perfect focus difficult to judge. If you find yourself in an after-dark situation, without any special equipment along, this is the method to use.
Do remember to switch off the autofocus feature of your lens. Once you get focus set correctly you do not want to lose it the moment you touch the shutter button. Not that I have ever done that… Never? Well, perhaps maybe.
The live view focusing method can be significantly improved by using some form of focusing mask. Masks create a pattern of shadows and diffraction spikes that can aid in seeing the moment of critical focus. The mask is simply placed over the front of the telescope or lens. As you rock the telescope or lens through focus the pattern will change allowing the photographer to correctly judge the moment of best focus. The pattern is determined by the configuration of the mask.
A correctly sized mask can be used on both telephoto lenses and small telescopes. A Hartmann mask is easy to make from whatever material is lying around. One mask I use was cut from the lid of a can of peanuts. I took about ten minutes with a sharp pen knife to create a very serviceable mask. I prefer a pattern of three triangles as this not only creates a pattern of shadows, but nice diffraction spikes that appear at critical focus.
A more sophisticated mask is the Bahnitov mask. This mask relies primarily on diffraction, creating a star-like pattern that is easily monitored as you pass through focus. The center bar will line up with the X pattern at focus. In practice this is easily seen in a magnified live view.
A Bahtinov mask can be made by hand, but is substantially more difficult. I have done it, it was a lot of work. Much easier to simply buy one of the inexpensive masks that are widely available. These commercial masks are laser cut from thick plastic, creating a simple and durable mask. The only issue is in sizing the mask correctly for your telescope.
Some astrophoto DSLR control software, like APT, provide automated tools to evaluate the Bahtinov pattern. The tool allows a score to be assigned while slowly adjusting the focus. This helps remove the subjective evaluation of the photographer and allows a more precise focus.
The ultimate focus method is to use a powered focuser and a focus utility like FocusMax. This setup allows the software to step slowly through focus with a set of exposures. The position of best focus can then be calculated. While very precise, the method does require a motorized focuser and a computer, suitable for a full astrophoto setup, but not for a light setup or a simple night photo walkabout.
Once you have focus it is a good idea to lock it in place. Many camera lenses will easily drift or be jostled as you move the camera about in the dark. A small piece of tape laid along the focus ring will prevent this. Use gaffers tape or a good electrical tape, something that peels off cleanly with no residue left behind. Many small telescopes have a locking knob to set the focus. Check the focus again with the mask after securing it.
With some simple tricks and a bit of practice you can easily achieve very good focus in the dark. Just another little detail that makes all the difference.