
Focusing on stars with a phone: why autofocus gets it wrong
Four hundred frames, three hours in the cold, a power bank drained by midnight. Then you get home, open the file on a proper screen, and every star is a little cotton ball: round, soft, all identical. They are not streaks, so nothing moved. The focus was off by a fraction of a millimetre, and the night is gone. It happens to everyone who points a phone at the sky, and it comes with exactly one consolation: it is the easiest mistake to eliminate permanently, provided you stop leaving it to the camera.
After dark, autofocus has nothing to grab
Phones focus in two ways, and under the stars both of them fail. Contrast detection walks the lens back and forth looking for the position where edges look crispest, and a black sky offers pitifully few edges to compare. Phase detection uses dedicated photosites that compare two slightly offset views of the same scene, and to do that it wants light. A star, on a sensor the size of a fingernail, is a handful of photons on a background of nothing. You know how the show ends: the lens hunts for two seconds, gives up, and parks wherever. Sometimes it parks beautifully. Relying on that is a different matter.
Night mode has opinions of its own too. It is tuned for dim urban scenes, where something is always lit, and put in front of a deep sky it starts making decisions nobody asked for, focus among them. Plenty of apps switch it back on by themselves once the light drops below a threshold. If yours does, kill it manually before you start.
Infinity is not a mark on a slider
On paper the problem should not exist. A phone’s wide camera has an actual focal length of a few millimetres and a lavish depth of field: past the hyperfocal distance, which on such optics falls close by, everything beyond counts as sharp. The catch is what «sharp» means. For a landscape it means you can tell the leaves apart on that ridgeline tree. For a star it means something far crueller, because a point source is the harshest test an optic can face: it has no detail to lose, only a diameter, and that diameter swells the moment you drift off exact focus. On the telephoto, with its longer focal length and much more distant hyperfocal, the margin narrows again.
There is also a detail the Android documentation is unusually blunt about. Every camera declares a focus distance calibration level. On devices flagged as uncalibrated, the value an app sends to the lens corresponds to no physical unit at all: zero still means «as far as this thing goes», but asking twice for the same position can land on two different real focus points, because device temperature, orientation and the ageing of the focus mechanism all get a vote. On calibrated devices the scale is in dioptres and zero is genuine infinity. Working out which world your particular handset lives in is awkward. Behaving as though it were the first costs nothing.
The method: one bright star, magnified to the point of embarrassment
You need an app with manual focus, and there are plenty, free ones included. Then it goes like this. Find the brightest thing available: a first magnitude star, a planet, and if the Moon is up stop looking, it is the perfect target because it is large, contrasty and effectively at infinity. Put it as close to the centre of the frame as you can. Pinch the preview to maximum magnification, keeping in mind that you are enlarging the image on screen rather than switching optics (on many apps, pushing past certain zoom levels hands you over to the next physical camera, and the focus you just found is worthless).
Now move the focus slider slowly, starting at the far end and coming back in. The star contracts, becomes a hard point, then starts spreading again. Overshoot the best position deliberately, come back, tighten the interval: bracketing like this takes thirty seconds and lands you closer to real focus than any infinity mark ever will. If your app offers focus peaking, the highlighted edges give you a rough confirmation, handy for orientation and far too coarse to trust on its own.
No manual focus at all? The terrestrial workaround survives: a streetlight, an antenna, a lit window at least a few hundred metres away, better still a kilometre. Tap the screen on it, hold until the focus and exposure lock appears, then swing the phone up to the sky without touching anything else. It works decently on the wide camera. On the telephoto pick something much further off, or the residual error shows up in every frame.
Lock it, then touch nothing
Once found, focus needs freezing. The AE/AF lock exists for exactly this and deserves using every single time, because most cameras rerun autofocus when you press the shutter or when the scene changes, and across a night sequence the scene changes constantly. From then on the list of forbidden moves is short and strict: no changing zoom level, no switching between lenses, no leaving the app and coming back, no stray finger on the screen.
It gets serious once you start stacking. A sequence of hundreds of frames lives on perfect overlap, and if focus drifts halfway through, the average blends crisp stars with swollen ones and hands you a mushy sky that no amount of processing will rescue: live stacking adds up whatever you feed it, with the same brutal honesty it applies to noise. AstroStackerPro shows the image building frame by frame for precisely this reason, and soft focus announces itself on screen after a handful of shots, while there is still time to fix it.
Focus drifts even when you do not
The same variables that make the focus scale untrustworthy keep working all night. The temperature falls ten degrees between nine and two, materials contract, and the motor holding the lens in place fights gravity differently depending on how the phone is tilted. Going from a target low on the horizon to one near the zenith turns the whole optical assembly on its side. Recheck focus after the first hour, and every time you repoint to a very different patch of sky. Thirty seconds of checking against the risk of binning an hour of frames.
One suspect always deserves ruling out first: dew. When the lens fogs, stars bloat and fade exactly as they do when focus slips, but the cure is elsewhere. Rake the lens with your phone torch at a shallow angle, and if you see the film, wipe it and shield it, ideally with a cheap heater strip. Refocusing on a wet lens wastes your time twice over.
Spotting bad focus before you go home
The preview display lies. It is small, it has already been through noise reduction, and in the dark it always looks better resolved than it is. Real checking means opening the frame you just shot and zooming to one hundred per cent, in the centre. Look at the centre and forget the corners: phone optics smear peripheral stars into commas and dashes by design, and chasing corner sharpness will pull the middle of the frame out of focus.
Defects have distinct signatures, and learning to tell them apart pays for itself. A defocused star is a uniform little disc, often with a harder rim. A trailed star is an oriented segment, and every trail in the frame points the same way. Vibration smears everything, including the village lights down in the valley. Noise dances from frame to frame and vanishes when you stack. Four different diagnoses with four different cures, and the mistakes of the first few nights multiply mostly when you mix them up.
Noise, colour, contrast, even a crooked composition: nearly all of it can be dealt with afterwards, given enough frames and enough patience. Focus cannot. It is the one decision of the night you make exactly once, in the dark, with cold fingers, and it is worth every one of the thirty seconds you give it.
Transparency: This article was written by the automated newsroom of 3SIGNUM (claude-opus-5). It's in the manifesto, not a secret.