Cameras · interactive
How does your phone camera focus?
Rays from one point on the flower bend through the lens and meet near the sensor. Top right: what the camera sees. Drag the flower or the lens on the stage, or tap the viewfinder to autofocus.
1 See
Point your phone at a flower and the picture snaps from soft to sharp in a blink. Nothing in the camera seems to move. So what changed?
2 Change
3 Understand
Model notes and sources
Model. The camera is a single thin lens with focal length f = 6.0 mm, typical of a phone's main camera (they range from about 5 to 7 mm). A point at distance d in front of the lens is imaged at v behind it, from the lens equation 1/f = 1/d + 1/v, so v = f·d/(d − f). The sensor sits f + s behind the lens, where s is how far a voice-coil motor has pushed the lens forward from its rest position, in which a spring holds it focused at infinity. A point is focused when s = v − f = f²/(d − f): 0.073 mm at 50 cm, 0.32 mm at 12 cm and 0.38 mm at 10 cm. The light from the point fills the aperture, of diameter A = f/N (3.3 mm at f/1.8). Where the cone crosses the sensor it is a disc of diameter b = A·|v − (f + s)|/v, the blur disc. We call the picture sharp when b is under 8 µm, about the sensor's diagonal ÷ 1,500.
Fixed values. The motor's stroke is set to 0.383 mm, which makes the minimum focus distance exactly 10 cm (measured from the lens). That is in the range of real modules: voice-coil autofocus actuators typically travel about 0.25 to 0.4 mm, and phone main cameras typically focus no closer than about 10 to 20 cm, which is why phones switch to the ultrawide camera for macro shots. The viewfinder assumes a sensor 7.2 mm across its short side, so its blur is b ÷ 7.2 mm of the picture's width; the flower photo is framed as seen from 12 cm and scaled by 12 cm ÷ d (held at a minimum size beyond 2 m). The film uses f/1.8 and moves the flower from 50 cm to 12 cm, then to 6 cm.
Not to scale. In the diagram, lens and image movements are drawn about 7 times larger, relative to the lens, than the lens-to-sensor distance, and flower distances are compressed. The real camera module is only about 6 mm deep.
Not modeled. Real phone lenses are stacks of 5 to 8 plastic elements, not one thin lens; diffraction, aberrations and sensor pixel size; how the phone decides where to move the lens (phase-detection pixels or contrast hunting); optical image stabilization, which uses similar coils sideways; and the slight change in focal length some lens designs use instead of moving the whole lens. The photos are AI-generated illustrations; the blur in the viewfinder is computed from the model (a disc blur of the photo), and every number comes from the model.
Sources: Analog Devices, “Lens driver focus in camera modules”, Analog Dialogue 40 (2006) (voice-coil motor, spring return to infinity focus, stroke of a few hundred micrometres); Halide / Lux, “iPhone Macro: A Big Day for Small Things” (main camera focuses to about 15 cm, macro needs the ultrawide); Thin lens; Circle of confusion; Voice coil; E. Hecht, Optics, 5th ed., ch. 5 (thin lenses).
An ExplainerTools Original.


