Depending on the focal ratio of the telescope you are using the critical focus zone will vary in size, ie the faster the f ratio the smaller the critical focus zone. There are various aids to help with focusing including using difraction spikes (with some reflectors), Bahtinov masks and analytical software. For the purpose of this guide I am going to use the analytical software that is an integral part of Maxim DL which is the software I use for my camera control, image acquisition and initial processing. If you are using two cameras, one for imaging and one for guiding then you will have to focus both and this is one area where Maxim DL is useful as both cameras can be controlled at the same time.
The first thing to do is to set up both cameras within Maxim DL (one as imaging camera and one as guider), how this is done will vary from camera to camera but it is just a matter of clicking a couple of icons and buttons. The images shown will be using a simulator camera from within Maxim DL. Once the cameras are connected to Maxim DL then I click on the focus tab as shown below
It is essential to make sure you focus through a filter that you will be imaging through or at least one that is parfocal, in my case my filters are all parfocal and I focus through the luminance filter in order to speed things up as it requires shorter exposure times. I set the exposures time to 1 second and run a single exposure, then I select one medium sized star and draw a square around it, then I click on continuous and click start focus. The camera will now take continuous exposures of that star only, I can now monitor the numbers and graph as shown above. As the focus becomes sharper the graph will become thinner and in particular the FWHM (full width half maximum) number will be become smaller. It is important to allow several exposures to be taken and accept the smallest number before making and adjustments to focus to allow for seeing and everything to settle down. I initially focus using the manual focuser on the telescope if it is grossly out of focus until I am close to focus, then I lock this off and use my FLI PDF electronic focuser via the laptop to continue, this focuser has only 0.5 inches of focus range but it can do this in 7,000 steps in its finest mode which means each step is as small as 1/14,000th of an inch.
Once I have got perfect focus I am ready to select my subject. I generally don't bother checking the focus again during the evening but just rely on my eyes to see what is coming out on the screen, some people recheck the focus every hour or even every frame. If there are temeperature changes during the night then it will be more important to recheck the focus.