Learn / Module assembly
How fixed-focus camera modules stay sharp
Depth of focus, image shift and the micron budget behind lenses with no focus motor.
Most security cameras, dashcams, doorbells and many machine-vision modules have no focus motor. The lens is glued in place at the factory and has to stay acceptably sharp from some near distance out to infinity for the life of the product. Whether that works comes down to a few microns on the sensor side of the lens. This article walks through the numbers.
Two views of the same question
On the object side, the question is depth of field: which distances look sharp? Focus a lens at its hyperfocal distance H = f² / (N · c) and everything from about H/2 to infinity is within the circle of confusion c.
On the image side, the question is depth of focus: how far can the sensor sit from perfect focus? A cone of light from an f/N lens widens by 1/N of the distance it travels, so the blur stays under c while the sensor is within ±N · c of best focus. Total depth of focus is 2 · N · c.
These are the same physics seen from opposite ends of the lens, and they give the same answer. Module engineers usually work on the image side, because that is where the tolerances live.
Objects move the image
A lens focused at infinity forms its sharpest image one focal length behind the lens. Bring the object closer, to distance s, and the image moves back by
Δ = f² / (s − f)
Short focal lengths make this shift tiny, which is exactly why small camera modules can get away without focusing. For a 2.8 mm lens, an object at 0.5 m moves the image only 15.8 µm, about the thickness of kitchen foil.
The fixed-focus condition
The module covers infinity to s when the whole image shift fits inside the depth of focus:
f² / (s − f) ≤ 2 · N · c
The sensor is then set halfway, Δ/2 behind infinity focus, so both ends land inside the ±N·c window.
A worked example
Take a 2.8 mm f/2.0 lens on 2.9 µm pixels, with a CoC of two pixels, 5.8 µm:
- Depth of focus:
2 × 2.0 × 5.8 = 23.2 µm, or ±11.6 µm. - Infinity to 0.5 m:
Δ = 15.8 µm. It fits, leaving (23.2 − 15.8) / 2 ≈ 3.7 µm of margin at each end. - Infinity to 0.3 m:
Δ = 26.4 µm. It does not fit; the closest distance this lens can cover is about 0.34 m, which isH/2, the same answer the depth-of-field calculation gives.
Check any lens, aperture and near distance, and get the sensor offset and margin.
Depth-of-focus calculator →Where the microns go
That 3.7 µm of margin is all that is left for everything that moves the sensor relative to focus after design:
- Focus setting. How accurately the factory places the lens before the adhesive cures.
- Tilt. A tilted sensor is out of focus at its corners. Tilt alone uses the whole window at an angle of
atan(N·c / half-diagonal), about 0.2° here, so real tilt allowances are a fraction of that. - Field curvature. The lens's best focus is not perfectly flat across the image, so corners and center want slightly different positions.
- Temperature and aging. Lens barrels and holders expand, and adhesives shrink and creep, shifting focus by microns over the product's life.
Independent error sources are usually combined as a root-sum-square, but even so, a few microns disappear fast. This is why fast lenses (f/1.4 to f/1.8) and high-resolution sensors with small pixels push manufacturers to active alignment, where the lens is moved in five or six axes while the camera watches a test chart, and fixed only at the sharpest position.
Levers when it does not fit
- Stop down. Depth of focus grows with N. Going from f/2.0 to f/2.8 adds 40%, but check diffraction and low-light sensitivity.
- Relax the near distance. The image shift grows quickly at short range; moving the near limit from 0.3 m to 0.4 m cuts it by about a quarter.
- Use a shorter focal length. Shift scales with
f², so a wider lens is much more forgiving, at the cost of pixels on target. - Accept a larger CoC. Only when the image is downscaled or the near range is used for detection rather than detail.
- Add autofocus. When none of the above is acceptable.
Key points
- Depth of focus is ±N·c on the sensor side; for small modules it is often only ±10 µm or so.
- Moving the object from infinity to s shifts the image by f² / (s − f).
- Fixed focus works when that shift fits in 2·N·c, with the sensor set halfway.
- Focus accuracy, tilt, field curvature and thermal drift all share the remaining margin.