How to focus your camera - markmac99/ukmon-pitools GitHub Wiki
You can usually do an initial focus with the camera assembled on a desk. Point it out a window during the hours of darkness and focus on a building at least 50m away. You can use ShowLiveStream to monitor the view.
Final focusing must be done at night: some cameras have a small filter that slips in place during daytime so the focus is different.
you will also need an assistant to monitor the live view.
Initially aim the camera at a terrestrial object at least 50 metres away.
Start ShowLiveStream on the Pi desktop and get your assistant to watch it.
Turn the lens a little and ask your assistant to tell you if focus is better or worse.
Remember that it takes a few seconds for the liveview to 'catch up'.
Contine adjusting till the nearby object is in focus.
Now return the camera to point at the stars.
Check focus on the live view. it should be pretty good, but make fine adjustments if necessary.