How Liquid Lens Autofocus Solves Focus on High-Mix, Low-Volume Lines
OPTICS
On a line with 0.9 mm of mixed heights, a liquid lens needs less than 0.1 D of change, but it must repeat that small change within ±0.023 D.
Taking an assembly line with chip heights mixed from 0.3 to 1.2 mm, I calculated the limit of fixed focus, the optical power needed, the magnification shift, and the takt time and lifetime.
About 12 min read
On a PCB assembly line, chip heights mix from 0.3 mm to 1.2 mm, and the surfaces sharing a field of view behave differently. The top of a ceramic chip is matte and scatters light evenly, while the solder fillets on either side are mirror-like surfaces with strong specular reflection1. The target is a 30 μm wide crack on the chip top, but heights vary from part to part, so the plane in focus keeps moving. A crack outside the depth of field2 blurs, loses contrast and passes.
A lens whose focus ring is turned by a motor has moving parts, so it is slow and it wears. Basler’s autofocus use-case page says a motor-driven lens takes around 5 seconds each time it moves and adjusts, and presents a liquid lens3 as refocusing within milliseconds. I turn that comparison into three calculations: what holding on with fixed focus costs, how much optical power a liquid lens actually has to change, and whether takt time and lifetime hold up when focus changes for every part.
What fixed focus gives up to cover 0.9 mm
Taking 10 μm per pixel so a 30 μm crack spans 3 px, with a sensor of 3.45 μm pixels, gives a magnification of 0.345×. With the permissible blur4 on the sensor set at 2 px, 6.9 μm, depth of field is roughly 2 × f-number × permissible blur × (1 + magnification) ÷ magnification², which here comes to 0.156 mm per unit of f-number5. Holding a 0.9 mm height spread within one focus setting requires an f-number of 5.8 or more.
Stop the aperture down, and diffraction makes the blur instead. The diameter of the Airy disk6, the light spread caused by diffraction, is 2.44 × wavelength × f-number × (1 + magnification), so at 0.55 μm and F5.6 it is 10.1 μm on the sensor, about 2.9 px. That already exceeds the 2 px permissible blur, so the 30 μm crack blurs even where focus is right. Stopping down further to F8 grows it to 14.4 μm, or 4.2 px. Covering 0.9 mm with fixed focus trades away the resolution that draws the crack.
Open the aperture and follow height with focus
The answer is to open up. Opening the aperture to F2.8 shrinks the Airy disk to 5.1 μm, 1.5 px, inside the permissible blur, and quadruples the light at the same exposure. The depth of field narrows to 0.44 mm in return and can no longer hold the 0.9 mm height spread at once. Filling that gap means moving focus for each part, and a liquid lens does that without moving mechanical parts.
A liquid lens is a device that changes curvature by applying voltage across the interface where two liquids of different refractive index meet. The effect is called electrowetting7, and a Cognex article dated June 26, 2025 says such lenses change focus in milliseconds and last up to 50 million cycles, where mechanical focusing systems wear out after about 100,000. Combining a liquid lens with a fixed-focus lens is also the approach Basler’s use-case page presents.

As the figure shows, the curvature of the interface changes with voltage and the focus position moves with it. No mechanical part is involved in reshaping the interface, so focus moves quickly, but the liquids change with temperature and age, so focus can drift even at the same voltage. That drift is the task that follows liquid lens design the longest.
Small power, strict repeatability
The focus range of a liquid lens is given in diopters8. A 25 mm lens at 0.345× puts the object about 97.5 mm away by the thin-lens approximation, and refocusing on an object 0.9 mm closer at that distance takes a power change of 1 ÷ 0.0966 m − 1 ÷ 0.0975 m ≈ 0.096 D. It is an estimate that treats the liquid lens as a thin lens close to the main lens, yet it makes clear that the range needed is under 0.1 D.
The stricter condition is repeatability, more than range. Keeping the crack within the 0.44 mm depth of field at F2.8 requires focus to land within ±0.22 mm of the target, which in optical power is ±0.023 D. So the numbers I look for first on a liquid lens datasheet are repeat precision and focus shift with temperature, ahead of the maximum power range.
0.096D
Power change needed to follow a 0.9 mm height spread (object distance 97.5 mm)
±0.023D
Repeatability that keeps focus inside the 0.44 mm depth of field at F2.8
29days
Time to reach 50 million cycles at 20 refocus events per second (24-hour operation)
Set the three numbers side by side and the question to ask of the lens changes. How precisely it returns to the same place decides the outcome more than how far it can move.
Cognex’s US patent US8487228B2 (priority date March 31, 2009; granted July 16, 2013) aims squarely at this drift. Claim 1 places a calibration target at a set spot in the field of view, compares images of the target taken at several focus positions of the liquid lens with a stored reference image, and from that determines the lens’s temperature and aging effects. The premise that the same voltage does not always give the same focus is where the patent starts.
Focus follows, magnification stays behind
Moving focus with a liquid lens leaves the distance between sensor and lens unchanged, so magnification shifts with object distance. When the object moves 0.9 mm closer from 97.5 mm, magnification grows about 0.92 %, and a chip body 4 mm long looks 37 μm longer in the image. At 10 μm per pixel, that is 3.7 px. For an inspection that only asks whether a crack is there, this matters little, but for one that measures chip length or electrode width it becomes measurement error as is.
Measuring inspections therefore split two ways: a telecentric lens9, whose magnification does not change with height, used at fixed focus, or a liquid lens paired with a table of magnification corrections for each focus position. I would shoot a scale target once in each height band, re-measure the length per pixel and use that value at decision time.
Counting refocus events against takt and lifetime
On a line that inspects one part every 50 ms, assuming 10 ms of liquid lens settling and a 2 ms exposure, changing focus once per part uses 24 % of the takt time10. Sweeping five steps with contrast-detection autofocus11, which searches for the focus with the highest contrast, takes 60 ms and overruns the takt. Part heights are already in the placement program, so my default is to take that height and send focus there in one step, keeping the contrast search for calibration only. Wrong height data means wrong focus, so the part height in the recipe gets checked once on a real part whenever a new part is registered.
Lifetime has to be counted in cycles too. Even taking the 50 million cycles from the Cognex article at face value, changing focus 20 times a second reaches that count in 2.5 million seconds, about 29 days of 24-hour operation. Using the 0.44 mm depth of field as a height band, splitting the 0.9 mm into three bands and ordering the inspection so parts in the same band share a focus setting cuts the refocus count sharply. The lifetime figure is one to recheck against the lens maker’s datasheet.
Keeping a 30 μm crack without refocusing
Before choosing the lens, check three things: how many pixels the crack occupies, whether aperture and focus preserve resolution, and whether refocusing fits within takt and lifetime. Taking 10 μm per pixel with a 2,448 × 2,048 px sensor of 3.45 μm pixels gives a field of view of 24.5 × 20.5 mm. A 25 mm lens puts the chip about 97.5 mm from the principal plane of the lens by the thin-lens approximation and needs about 8.6 mm of extension beyond infinity focus, so an extension tube covers whatever the lens’s own focus range cannot. Mounting the liquid lens module in front of the lens shortens the actual WD12 by its thickness, which has to be checked on the datasheet together with the room for the dome light.
| Item | ① Minimum defect size | ② Optical setup · lighting · WD | ③ Algorithm parameters |
|---|---|---|---|
| Resolving the crack | 30 μm wide = 3 px (10 μm/px) | 2,448 × 2,048 px, 3.45 μm pixels, 0.345× magnification, field of view 24.5 × 20.5 mm. 25 mm lens at F2.8 + liquid lens, object distance about 97.5 mm (thin-lens approximation; check the WD left after the module thickness on the datasheet) | Airy disk 1.5 px and depth of field 0.44 mm at F2.8. Covering 0.9 mm with fixed focus takes F5.8 or more (diffraction of 2.9 px or more) |
| Focus · reflection | 0.9 mm height spread = about 0.096 D | Dome light on the matte ceramic tops; check solder-fillet highlights separately in each focus band | Focus repeatability within ±0.023 D; check thermal drift with a calibration target in a corner of the field |
| Takt · lifetime | Three height bands (0.44 mm each) | Take part heights from the placement program and move focus in one step (10 ms settling assumed) | Refocus takes 24 % of a 50 ms takt. Group inspection order by band to cut refocus count; correct magnification per band (0.92 % over 0.9 mm) |
Only with all three rows right does a liquid lens actually ease the focus problem of a high-mix line. Resolution is kept by opening the aperture, height is followed with a small change in power, and repeatability, magnification correction and the refocus count hold that change up.
There are also places where fixed focus fits. On a single-product line whose height spread fits inside the depth of field, or in metrology that must measure dimensions at the sub-μm level, a telecentric fixed-focus lens is simpler and its magnification holds steady. How much the decision wavers on shiny surfaces as solder-fillet highlights change shape with focus, and which of the two approaches wins on a real line, cannot be guaranteed before a sample test.
Turning focus into numbers for power, takt and lifetime is the first calculation an engineer choosing optics for a high-mix line needs, and production engineering runs the same arithmetic when it weighs changeover time. When quoting a liquid lens, get repeat precision, thermal drift and lifetime cycles as well, or the lenses cannot be compared. This article explains technology and is not investment advice. See our Disclaimer.
Field Note
On a line where focus gets reset by hand at every lot change, my first step would be timing that adjustment and writing it next to the inspection time. With a liquid lens fitted, the relation between drive signal and focus position would get measured directly at the three height bands to build a calibration table, with the datasheet curve as a starting point only. Focus scores on the corner target would then be reshot at the hottest and coolest lens temperatures of the day to see whether the table holds within ±0.023 D.
Field Checkpoints
Once the calibration table and focus scores by temperature are in, answer the questions below to decide on a liquid lens.
- WD: does the dome light fit in the actual WD left after the liquid lens module thickness? (thin-lens object distance about 97.5 mm)
- Has the height spread (0.9 mm) been converted into power (about 0.096 D) and compared with the lens range?
- Do focus repeatability and thermal drift stay within ±0.023 D?
- Does focus go out in one step from the part height in the placement program, without contrast searches that overrun the takt?
- Has the inspection order been grouped by height band to cut refocus count? (at 20 per second, 50 million cycles take about 29 days)
- Do measuring items apply a magnification correction per band? (0.92 % over 0.9 mm)
- Is focus drift checked periodically with a calibration target in a corner of the field?
Frequently Asked Questions
Isn’t a liquid lens sensitive to vibration?
The Cognex article says that, with no moving parts, liquid lenses resist shock and vibration better than mechanical systems. How the liquid interface responds to machine vibration and leaves wobble in the image depends on the frequency and size of that vibration, so the sure way is to shoot the same target repeatedly under real vibration and watch how the focus score wavers.
When is contrast-detection autofocus used?
It is for when part height information is missing or untrustworthy, and for checking the calibration table. A five-step sweep takes 60 ms by the calculation above, too long for every part on a 50 ms takt line, so it fits best run once on the target at shift start or at set intervals to catch drift in the table.
Wouldn’t opening the aperture further be better?
At F2 the Airy disk gets smaller, but depth of field shrinks in proportion to the f-number to 0.31 mm, more parts land on band edges, and the repeatability requirement tightens to ±0.016 D. Lens aberrations also grow at wide apertures, so I start near F2.8, where diffraction and depth of field fit together.
Glossary
- [1] Specular reflection specular reflection
Reflection that leaves a smooth surface in one direction at the same angle the light came in. It is strong on solder fillets. ↩ - [2] Depth of field DOF
The object-side range of distance that still looks in focus. It deepens with a larger f-number and lower magnification. ↩ - [3] Liquid lens liquid lens
A lens that adjusts focal length by changing the curvature of a liquid interface electrically. It has no moving mechanical parts. ↩ - [4] Permissible blur circle of confusion
The largest blur diameter on the sensor still accepted as in focus. The text uses 2 px. ↩ - [5] F-number f-number
The focal length divided by the aperture diameter. The larger it is, the narrower the aperture and the less light. ↩ - [6] Airy disk Airy disk
The disk-shaped image a point spreads into because of diffraction. Its diameter is proportional to f-number and wavelength. ↩ - [7] Electrowetting electrowetting
Changing the angle at which a liquid wets a surface by applying voltage. A liquid lens uses it to reshape its interface. ↩ - [8] Diopter diopter
The unit of optical power, the reciprocal of focal length in meters. 1 D means a focal length of 1 m. ↩ - [9] Telecentric lens telecentric lens
A lens whose object-side chief rays run parallel to the axis, so magnification barely changes with object height. ↩ - [10] Takt time takt time
The time a line allows for handling one product. The text uses 50 ms. ↩ - [11] Contrast-detection autofocus contrast-detection AF
Moving focus through several positions to find the one with the highest image contrast. It needs several shots, so it is slow. ↩ - [12] WD working distance
The distance from the front of the lens to the inspected part. The liquid lens module and the lighting share the room in between. ↩
References
- Basler AG, “Fast Autofocus with Liquid Lens for Vision Inspection” use-case page (motor-driven lens around 5 seconds, liquid lens refocusing within milliseconds). baslerweb.com
- Cognex, Mary Romano, “Liquid Lenses Are Changing Barcode Reading”, 2025-06-26 (electrowetting, focus change in milliseconds, about 100,000 cycles for mechanical versus up to 50 million for liquid lenses). cognex.com
- Cognex Corp., US8487228B2 “System for adjusting focus of a liquid lens in a machine vision system”, priority date 2009-03-31, granted 2013-07-16. Google Patents
Related reading — Can One Focus Plane Keep Parts of Every Height Sharp? · How to Calculate Machine-Vision Lens Focal Length · The Error Frame Temperature Leaves in Two-Sided Chromatic Confocal Thickness Measurement


