Tools / Depth of field
Working backwards? Switch to f/stop & focus, enter the nearest and farthest distances that must be sharp, and the calculator returns the f-number and focus distance that just cover them.
A 2.8 mm f/2.0 lens on a sensor with 2.9 µm pixels, with a CoC of two pixels (5.8 µm). Hyperfocal distance is 0.68 m. Focused there, everything from 0.34 m to infinity is acceptably sharp, which is why many such cameras need no focus mechanism at all. Focused at 1 m instead, the sharp zone runs from 0.40 m to infinity.
A 16 mm f/4 lens on 3.45 µm pixels at a working distance of 0.5 m, with a one-pixel CoC for measurement. The sharp zone is only 487–514 mm, about 27 mm deep. Stopping down to f/8 doubles it to about 54 mm, but at f/8 the Airy disk is about 10.7 µm across, three pixels wide, so the extra depth costs sharpness everywhere. Check the trade-off with the diffraction calculator.
Almost always because they assume a different circle of confusion. Photography calculators default to about 0.025–0.030 mm for full frame, which is far too large for a small sensor. Some also define hyperfocal distance as f² / (N·c) + f instead of f² / (N·c); the difference is one focal length, negligible in practice.
For camera modules, base it on the pixel pitch: about one pixel for measurement and monochrome machine vision, and about two pixels for color sensors in general imaging. The article Choosing a circle of confusion explains why the photography defaults overstate depth of field.
At the same focal length, f-number and CoC, no: the optics are identical. In practice a smaller sensor uses a shorter focal length for the same field of view, and depth of field rises steeply as focal length falls, so small-sensor cameras usually have much deeper focus.
Depth of field is measured in the scene. Its counterpart behind the lens, depth of focus, sets how accurately the sensor must be positioned during assembly. See the depth-of-focus calculator.
Hyperfocal H = f² / (N·c). Near limit s·H / (H + s), far limit s·H / (H − s), infinite when the focus distance reaches H. Magnification f / (s − f).
Reverse mode: s = 2·Dn·Df / (Dn + Df), H = 2·Dn·Df / (Df − Dn), N = f² / (H·c). Focal length and CoC are in mm. The diagram uses a compressed scale so infinity fits on the right.
Background reading: Choosing a circle of confusion for small sensors