The focal length decides how much of the part the camera sees from a given distance. Get it wrong and the part is either cropped or tiny in the image, and no amount of software fixes that. The good news is that three numbers you already know (or can measure in a minute) give you the answer, and a short check list catches the lenses that would fail on the line.
The three numbers you need
Before you look at any lens, write down:
- Sensor width. Multiply the camera's horizontal pixel count by its pixel size. A sensor with 2,448 pixels at 3.45 µm is 8.45 mm wide. The nominal format ("2/3 inch") is only a rough guide, because two cameras of the same format can differ by a millimetre.
- Field of view (FOV). The width of the area you need to see, plus a margin for part position. If parts arrive within ±5 mm, add 10 mm.
- Working distance (WD). The distance from the front of the lens to the part. It is usually set by the machine: room for the light, the robot, the guarding and the operator.
If you only know the distance roughly, take the shortest practical one. A shorter distance gives a shorter, cheaper lens and a smaller light, and you can always add a spacer later.
The formula
The thin-lens equation gives a close estimate of the focal length:
Here m is the magnification (how much smaller the image is than the part) and f is the focal length in millimetres. For most inspection set-ups m is small (0.05 to 0.3), so f ends up just below WD × m.
The result is rarely a standard value. Choose the nearest standard focal length (8, 12, 16, 25, 35 or 50 mm are the common C-mount steps) and then move the camera to get the exact field. The calculator above shows the field you would get with the two nearest standard lenses at your distance.
A worked example
You inspect labels on a box face that is 90 mm wide, with 5 mm of position play each side, so the field of view is 100 mm. The camera sits 300 mm from the box. The camera in this example is a 5 MP model:
- Sensor format
- 2/3"
- Interface
- GigE
- Resolution
- 5 MP
- Shutter
- Global
Its sensor is 8.45 mm wide, so:
- Magnification: 8.45 / 100 = 0.0845.
- Focal length: 300 × 0.0845 / 1.0845 = 23.4 mm.
- The nearest standard lens is 25 mm. At 300 mm it gives a magnification of 25 / 275 = 0.091, a field of about 93 mm: slightly too narrow.
- Move the camera back. For exactly 100 mm the distance becomes 25 × 1.0845 / 0.0845 = 321 mm, so about 21 mm further away.
With 2,448 pixels across 100 mm, each pixel covers 0.041 mm of the label. If a defect must span at least three pixels to be found reliably, the smallest defect you can detect is about 0.12 mm. If that is not small enough, you need more pixels or a smaller field, not a different focal length.
Standard focal lengths side by side
Here is one family of 2/3-inch, 6 MP C-mount lenses, so the only thing that changes is the focal length:
| Specification | LS-SMV1228P-6M | LS-SMV1628P-6M | LS-SMV2528P-6M | LS-SMV3528P-6M |
|---|---|---|---|---|
| Focal length | 12 mm | 16 mm | 25 mm | 35 mm |
| Angle of view (2/3", DxHxV) | 48 x 39 x 30 deg | 37.2 x 30.4 x 23 deg | 25.5 x 20.5 x 22 deg | 18.3 x 15 x 11.1 deg |
| M.O.D. | 0.1 m | 0.1 m | 0.2 m | 0.2 m |
| Distortion (optical) | 1.2% | 0.1% | 0.4% | 1% |
| Filter thread | M27 x P0.5 | M27 x P0.5 | M27 x P0.5 | – |
| Relative illumination | 68% | 64% | 55% | 55% |
| Total track length (TTL) | 58.78 mm | 50.44 mm | 48.75 mm | 48.12 mm |
| Back focal length | 14.13 mm | 12.58 mm | 14.2 mm | 17.33 mm |
| CRA | 6° | 11.2° | 15° | 10.1° |
| Size | dia. 33 x 41.2 mm | dia. 33 x 32.9 mm | dia. 33 x 31.2 mm | dia. 33 x 30.6 mm |
| Weight | 60 g | 55 g | 55 g | 50 g |
| Notes | 8G Element | 8G Element | 6G Element | 7G Element |
| Price | $109.00 | $109.00 | $129.00 | $139.00 |
All 4 share: Mount C; Format 2/3"; Resolution 6.0 Megapixel (2.4μm pixel size); Aperture F2.8 Manual iris; Transmission AT486~656nm T≥85%. Values as printed in each product's data sheet; open a part for its drawing and full specifications.
Read the table from left to right and three trends appear. The angle of view shrinks as the focal length grows, so the same field needs more distance. The minimum object distance (M.O.D.) grows too, which matters on compact machines. And the shortest lenses show more distortion, because they bend the light through wider angles.
As a rule of thumb for a 2/3-inch camera:
| Focal length | Field of view at 300 mm (approx.) | Typical use |
|---|---|---|
| 8 mm | 310 mm | Trays, cartons, robot pick areas |
| 12 mm | 205 mm | Large parts, packaging lines |
| 16 mm | 150 mm | Boxes, labels, assemblies |
| 25 mm | 93 mm | Labels, connectors, medium parts |
| 35 mm | 64 mm | Small parts, print quality |
| 50 mm | 42 mm | Fine features, electronics |
The fields are thin-lens estimates for an 8.45 mm sensor width. Browse the full range of machine vision lenses or filter them by mount, format and focal length in the lens finder.
When the lens will not focus close enough
Every lens has a minimum object distance. Closer than that, the image cannot be brought into focus, however far you turn the ring. This catches many designs where a longer lens was chosen for a small field.
The fix is an extension tube: a ring that sits between the lens and the camera and moves the lens further from the sensor. It lets the lens focus closer and increases magnification. With the lens focused at infinity, the magnification a tube adds is roughly its length divided by the focal length, so a 5 mm tube on a 25 mm lens gives about 0.2x. C-mount tubes come in lengths from half a millimetre upward, for example the 5 mm C-mount extension tube, and stack for larger steps.
Three checks before you order
The focal length is only the first filter. Before you buy, check these on the product page:
- Image circle. The lens must cover the sensor diagonal, or the corners go dark. A 2/3-inch sensor needs an image circle of about 11 mm; a lens rated for a larger format is fine.
- Resolution rating. Lenses are rated in megapixels or in the pixel size they resolve. Choose a lens rated for pixels as small as, or smaller than, the camera's. A lens rated for 2.4 µm pixels resolves a camera with 3.45 µm pixels; the reverse gives a soft image.
- Distortion. Below about 8 mm, check the distortion figure. For measurement, keep it under 1 % or calibrate it out in software.
Aperture matters as well. Closing the iris to F4 to F8 increases the depth of field, which helps when part height varies. Beyond about F11, diffraction starts to blur fine detail on small pixels.
When a standard lens is the wrong tool
A fixed focal length (entocentric) lens sees the world in perspective: objects closer to the lens look bigger. That is fine for presence checks, reading codes and most defect detection. It is a problem in two cases:
- Gauging parts that vary in height. A part 1 mm closer to the lens appears larger and measures wrong. A telecentric lens keeps the magnification constant through its depth of field; the guide on when you need a telecentric lens for gauging shows how to choose one.
- Fields that change between products. If the distance is fixed and the field changes, a zoom lens or a motorised focus lens avoids a mechanical change-over.
Lighting is the other half of the image. Once the field of view and distance are known, the lighting selection guide helps you pick a light that fits between the lens and the part.
The configurator matches a camera, lens, light, light controller and cables to each other, step by step, and lists only parts that fit what you already picked.
Quick checklist
- Sensor width from pixel count × pixel size, not from the format name.
- Field of view with a margin for part position.
- Focal length from the formula, rounded to a standard value.
- Minimum object distance shorter than your working distance, or an extension tube planned.
- Image circle at least the sensor diagonal; resolution rating at least the camera's pixel size.
- A telecentric lens if you measure parts that vary in height.
If you want a second opinion on a set-up, send us the part and the distances and our machine-vision engineers will check the lens choice with you. Support is free with every order.
Questions
Is working distance measured from the front of the lens?
In a data sheet, usually yes: from the front of the lens barrel to the part. The focal-length formula measures from a point inside the lens, so the two differ by a few millimetres. That is why the formula gives an estimate, and why you fine-tune by moving the camera.
What happens if I use a longer focal length than calculated?
The field of view gets narrower at the same distance, so the part fills more of the image and each pixel covers less of it. You can move the camera back to see the full field again, as long as the mount has the room.
Can one lens cover several field-of-view sizes?
A fixed focal length lens covers different fields only by changing the working distance. If the distance is fixed and the field changes between products, a zoom lens or a second camera position is the practical answer.
Does the camera's pixel count change the focal length?
No. The focal length depends on sensor width, not pixel count. Pixel count decides how small a detail you can see in that field, and the pixel size decides which lens resolution rating you need.
