Skip to main content
In PCB Inspection, the Lens Comes Before the AI
Optics

In PCB Inspection, the Lens Comes Before the AI

OPTICS

Through a conventional lens, a 2 mm tall part at the edge of the view shows its side wall 0.28 mm beyond its footprint, and no model can find a bridge across a 0.2 mm pad gap hidden in that shadow.

Taking a 25 μm PCB solder bridge as the reference, I calculated pixel resolution, viewing angle and lighting angle, and followed the order for tracing an AOI's missed bridges back to the lens and the lighting.

About 9 min read

One PCB carries three surfaces that handle light in completely different ways. Copper pads and solder throw light back in one direction like a mirror, green solder mask scatters it back, and white silkscreen scatters it even more evenly. Under the same lighting the three surfaces record at different brightness, so the lighting and the lens change depending on which defect you want to see. The defect here is a solder bridge1 at least 25 μm wide joining a 0.2 mm pad gap (assumed) on a 0.4 mm pitch part.

When an AOI2 that passes thousands of boards a day reports one day that it missed a bridge, the detection model is the first suspect. While training pictures are added, thresholds tuned and new architectures tried, the missed bridges come back from electrical test after reflow or as field failures after shipping. Tighten the judgment to avoid misses and overdetection rises, and re-inspection staff end up stationed beside the line.

In that situation I plot the positions of the missed bridges on the board drawing before opening the model weights. If they cluster beside tall parts at the edge of the view, I suspect the lens; if they cluster in particular lots, I suspect the lighting and the surface. In both cases the bridge was never properly recorded in the image, so retraining the model does not change the result.

A view size that puts a 25 μm bridge into three pixels

The starting point is the size of one pixel. My rule is that the finest defect spans at least three pixels, so for a 25 μm bridge one pixel on the board must be 8.3 μm or less. Assuming a camera 5,120 px wide with 2.5 μm pixels, the sensor is 12.8 mm wide and the field of view3 tops out at 42.7 mm. That is a magnification4 of 0.30. Which lens creates that magnification is the next question.

With a conventional lens placed 150 mm from the board measured from the lens center, a 35 mm lens fits. The view is then 42.1 mm with 8.2 μm per pixel, and a 25 μm bridge spans 3.04 pixels. On numbers alone, that is enough. The problem is that at the edge of the frame the lens looks down on the board at a slant.

At the edge of the view a tall part shows its side wall

A conventional lens looks down on the board in a fan from one point at the lens. Viewing the point 21 mm out at the edge of the view from 150 mm above tilts the line of sight 8.0° from vertical, and the top of a 2.0 mm tall part records 0.28 mm further out than its base. That is 34 pixels. The board surface within 0.28 mm outside the part is hidden behind the part body and does not appear on screen. This offset, caused by viewing at a slant, is called parallax5.

If a part with a 0.2 mm pad gap sits inside that hidden zone, a bridge across the gap is hidden with it. A model has no way to find a bridge that is not on screen. When the same part comes to the center of the view, the viewing angle approaches 0° and the hiding disappears, so the missed positions cluster toward the edges of the view on the board drawing. For a 0.5 mm tall part the hidden zone shrinks to 0.07 mm, smaller than the 0.2 mm gap.

Common belief

If a bridge was missed, the model did not learn that shape well enough.

Calculate the edge of the view

Beside a 2.0 mm tall part, 0.28 mm of board surface (34 pixels) is hidden behind the part body, so the bridge is not in the image at all.

A telecentric lens6 removes this tilt by making the chief rays on the object side parallel to the optical axis. It looks at the board vertically even at the edge of the frame, so the side walls of tall parts do not show, and the magnification barely changes with height. The price is clear too. The view of a telecentric lens is set by the diameter of its front optic, so seeing 42.7 mm needs a larger front lens, and the lens gets bigger and heavier. Its working distance WD7 is also fixed by design for each model, so I first check that the value fits the machine height.

The lighting angle sets how bright a bridge looks

Even when the lens puts the bridge on screen, judgment works only if the bridge records at a brightness different from the background. Coaxial8 lighting sends light down along the lens axis, so flat pads record bright while the rounded solder surface spills light sideways and records dark. Dark-field9 lighting from a low angle does the opposite, leaving flat surfaces dark and lighting up only the rim of rounded solder as a bright outline. A bridge joining two pads is a rounded lump of solder, so if it were my setup I would test a low-angle ring light first.

Diagram comparing contrast formation between coaxial epi-illumination and low-angle dark-field illumination
Coaxial light brightens flat pads, while low-angle dark-field lights up the rim of rounded solder as a bright outline.

The figure shows side by side how the two lights form contrast on the same surface. When the oxidation of the solder surface and the flux residue change from lot to lot, the gloss changes, and the bridge brightness wavers even at the same lighting angle. The moment the image leaves the brightness distribution the model learned, the judgment wavers too, so misses clustered in particular lots are grounds to suspect the lighting and the surface together. If the same lens and the same model miss only certain incoming batches, the part that changed is most likely the solder surface. Which angle works best for a given oxide film and flux condition cannot be guaranteed before a sample test.

Judgment conditions set after the lens and lighting are fixed

Once the lens and lighting are fixed, the inspection parameters10 are set on that image. The three rows of the table are the result.

Setup① Minimum defect size② Optical setup · WD③ Algorithm parameters · in plain words
Conventional 35 mm lens25 μm bridge = 3.04 px (8.2 μm/px)5,120 px with 2.5 μm pixels, 150 mm from lens center to board, 42.1 mm view, 8.0° edge viewing angle, low-angle ring lightTreat 0.28 mm (34 px) outside 2.0 mm tall parts as a hidden zone excluded from judgment. Bridges inside it are missed
Telecentric 0.30×25 μm bridge = 3.0 px (8.3 μm/px)Same camera, 42.7 mm view, front lens larger than the view, WD fixed by the model, low-angle ring lightNo hidden zone. A bright connected region at least 3 px wide in the region of interest between pads is a bridge candidate
Silkscreen smear (lighting swapped)60 μm smear = 7.2 pxTelecentric setup as is, one more frame under a diffuse dome lightA difference region of 7 × 7 px or more against the reference image is a smear candidate

Comparing the three rows shows that the variables deciding the bridge detection rate gather around the lens structure and the lighting angle. On the other hand, for a board where every part is 0.5 mm tall or lower, or where fine-pitch parts sit only at the center of the view, the hidden zone is smaller than the gap, and a conventional lens that is cheaper and easier to fit to a WD is the better choice. Whether these numbers hold for the real part layout and solder gloss is something to confirm on sample boards.

AI reads the contrast the lens creates

An AI-based AOI cuts recipe writing time and uses data to find judgment boundaries that are hard for people to set. If replacing the lens on an installed line is difficult, compensating part of the gap with processing such as multi-exposure fusion is also a realistic choice. Information that is simply absent from the image, like the hidden zone, does not come back with any processing, though. What is not there is not there. I create the contrast with the lens and lighting first, then leave the job of reading that contrast precisely to the model.

Calculating viewing angles and hidden zones at the design stage is the optics person’s job, and that calculation can save the weeks spent on retraining. For the person approving the purchase, a telecentric lens and ring light cost more than a conventional lens, but the decision should be weighed against what one missed bridge costs when it comes back from the field. This article explains technology and is not investment advice. See our Disclaimer.

Field Note

Starting a setup on this board, I collect ten boards where bridges were missed and plot all the miss positions on one drawing. If the points cluster near 21 mm out at the edge of the view, outside 2 mm tall parts, I move toward changing the lens structure; if they spread evenly over the whole view, I look at solder gloss by lot and at the lighting angle. Before changing the lens, I move the same part to the center of the view and shoot it once more to check whether the bridge shows.

Field Checkpoints

Once plotting the miss positions on the drawing has narrowed the cause to either the lens or the lighting, the remaining checks are below.

  • Is the design WD of the telecentric lens, or the 150 mm of the conventional lens, secured even after adding the ring light and the top structure? (whether the light housing and lens collide)
  • Does a 25 μm bridge span three pixels or more? (8.3 μm per pixel or less; with 5,120 px, a view of 42.7 mm or less)
  • If you use a conventional lens, did you calculate the hidden zone outside tall parts at the edge of the view and exclude it from judgment? (0.28 mm for a 2.0 mm part)
  • Did you plot the missed bridges on the drawing to see whether they cluster at the edge of the view or in particular lots? (which of the lens or lighting to look at)
  • Did you confirm with samples that the bridge brightness holds under the low-angle ring light as solder gloss changes from lot to lot? (by oxide film and flux condition)

Frequently Asked Questions

Does a telecentric lens also give a deeper depth of field?

A telecentric lens only keeps the size from changing with height; the depth that stays in focus is set by the f-number and magnification, just as with a conventional lens. In a high-magnification setup like 0.30×, the depth of field easily narrows to under 1 mm, so board warpage and part heights have to be weighed together. If the depth falls short, taking two frames at different focus is also worth considering.

Can I replace only the lens on an existing AOI?

If the camera mount and installation height fit, you can swap just the lens, but a telecentric lens has a fixed design WD and size, so mechanical changes often follow. Moving the same part to the center of the view and shooting it before the swap, to confirm that hiding is the cause, avoids the case where misses remain even after the lens changes.

Glossary

  • [1] Solder bridge solder bridge
    A defect where solder joins two neighboring pads or leads so that they become electrically connected. ↩
  • [2] AOI automated optical inspection
    An inspection machine that photographs boards with cameras and lighting and judges defects automatically. ↩
  • [3] Field of view field of view, FOV
    The area on the board that one camera frame covers. ↩
  • [4] Magnification magnification
    The size of the image on the sensor divided by the size of the object. Seeing 42.7 mm with a 12.8 mm wide sensor is 0.30×. ↩
  • [5] Parallax parallax
    Points at different heights landing in shifted positions on screen because they are viewed at a slant. ↩
  • [6] Telecentric lens telecentric lens
    A lens whose chief rays on the object side run parallel to the optical axis, so it views the object vertically even at the edge of the frame. Size barely changes with height. ↩
  • [7] WD working distance
    The distance from the lens to the surface being inspected. A telecentric lens uses a fixed value for each model. ↩
  • [8] Coaxial illumination coaxial illumination
    Lighting that sends light down along the lens axis through a half mirror. Flat glossy surfaces record bright. ↩
  • [9] Dark-field illumination dark-field illumination
    Lighting from a low angle that leaves flat surfaces dark and lights up bumps and edges. ↩
  • [10] Inspection parameters inspection parameters
    Settings such as thresholds, minimum sizes and regions of interest used to pick defect candidates from an image. ↩

References

  • Edmund Optics, Telecentric Lens Size Control (the field of view of a telecentric lens is limited by the front optic diameter), accessed October 24, 2026
  • Formulas: pixel size = view ÷ horizontal pixel count; magnification m = sensor width ÷ view; conventional lens view = sensor width × (u − f) ÷ f; edge viewing angle θ = atan(half view ÷ u); hidden width = part height × tan θ
  • Assumed values: a 5,120 px camera with 2.5 μm pixels, a 0.2 mm pad gap, a 2.0 mm part height and 150 mm from the lens center to the board are assumptions for the worked example

Related reading — In the Age of 8K Line-Scan Cameras, the Lens Still Sets the Ceiling on Inspection Resolution · When You Add Cameras to a Semiconductor or PCB Line, the Interface Rewrites the Optics · In Machine-Vision Inspection, Physics Comes Before Software

An engineer who has handled mechanical design and project management for production equipment since 2005. Here I work through the cameras, lenses and lighting that go into equipment with formulas and public data, and record the assumptions and sources alongside the numbers.

Leave a Reply

Your email address will not be published. Required fields are marked *