ApplicationsApplication note

Verify the correct part when sorting mixed batches

Build a three-gate check that verifies each part in a mixed batch: edge-based measurement, laser-mark OCR and a surface gray test, with worked pixel budgets.

LumaSpec Vision10 min read Share on LinkedIn

On this page 10 sections
  1. 01Three gates, one accept bin
  2. 02Gate 1: dimensions from calibrated edges
  3. 03Gate 2: the laser mark must read
  4. 04Gate 3: surface finish from mean gray level
  5. 05The station: cameras, strobes and controller
  6. 06Train on good parts, then hold the calibration
  7. 07When the usual answer is wrong
  8. 08Checks before you order
  9. 09Parts list and next step
  10. 10Questions

Every order that mixes look-alike families carries one expensive risk: a wrong part inside a shipped batch. Your customer builds it into an assembly and scraps everything made that day, so the cost lands back on you. The reliable fix is not one clever algorithm. It is three independent checks on every part — calibrated dimensions, the laser mark, and surface finish — wired so a part reaches the accept bin only when all three pass. This guide sets the pixel budget for each gate, works the numbers for a steel bushing family, and finishes with the reject logic and the hardware that runs it.

Three gates, one accept bin

Set the logic before touching a camera: a part is accepted only when the dimension gate, the mark gate and the surface gate all pass. Every other outcome — a fail on any gate, or no result inside the cycle window — goes to the reject bin. A timeout must never default to accept.

Independence is what makes the scheme strong. A wrong part that measures correctly still has to read as the right part number and match the right coating. Suppose the dimension gate passes 1 in 10 wrong parts, the mark gate 1 in 20, and the surface gate 1 in 5. The escape rate is 0.1 × 0.05 × 0.2 = 0.001, so one wrong part in 1,000 gets through, against 1 in 5 for the single best gate. Keep the checks on different image features, not three scores from one picture, or they fail together.

Gate 1: dimensions from calibrated edges

Measure the critical diameter and length with subpixel edge detection. Calibrate the scale from a certified reference part sitting in the real fixture, not from the nominal focal length: the fixture geometry, not the lens box, decides what one pixel is worth. The dimension-first part identification guide covers matching a part to its family; this section sets the tolerance you reject on.

The whole budget is four lines:

scale (mm/px) = FOV width (mm) / horizontal pixels tolerance (px) = tolerance (mm) / scale m = sensor width / FOV f = WD × m / (1 + m)

Worked example: a hardened steel bushing, Ø 30.00 mm with a ±0.10 mm tolerance; the neighbouring family is Ø 28 mm and must never mix in. Assume a 20 MP, 1-inch mono camera: 13.2 mm sensor width, 5472 pixels across.

  • Field of view: 110 mm, enough for the Ø 30 mm part plus ±40 mm of presentation wander (15 + 40 = 55 mm radius). Scale = 110 / 5472 = 0.0201 mm/px.
  • Tolerance in pixels: 0.10 / 0.0201 = ±5 px of edge error allowed before rejection.
  • Edge repeatability: subpixel detection holds 0.1–0.3 px on a clean, high-contrast edge; 0.3 px ≈ 0.007 mm. Keep the tolerance at least 10× the repeatability — here 5 / 0.3 ≈ 17×.
  • Lens: m = 13.2 / 110 = 0.12. At a 250 mm working distance, f = 250 × 0.12 / 1.12 = 26.8 mm, so use a 25 mm lens.
  • Check: m = 25 / (250 − 25) = 0.111; FOV = 13.2 / 0.111 = 118.8 mm; scale = 118.8 / 5472 = 0.0217 mm/px; tolerance = 0.10 / 0.0217 = ±4.6 px. The margin holds.
  • The Ø 28 mm neighbour is 2 mm smaller: 2 / 0.0217 = 92 px of separation against a ±4.6 px decision band. The tolerance gate binds, and it holds.

The same arithmetic applies to every camera in the station; the lens focal length calculator runs it for your own sensor and working distance.

Lens focal length, field of view and working distance
Units
Solve for
Focal length
– mm
Field of view
– mm
Working distance
– mm
Magnification
– x
Angle of view
– °
Pixel on the part
– mm

Thin-lens model: m = sensor width / field of view, f = WD × m / (1 + m). Accurate to a few percent above about 150 mm; check the lens's minimum object distance.

Find lenses with this focal length Open the full calculator

The side view wants pixels more than speed:

Area scan camerasHikrobot MV-CS200-10UM 20 MP Area Scan Camera, USB3.0, IMX183, 2nd Gen., MonoMV-CS200-10UM
Sensor format
1"
Lens mount
C-mount
Interface
USB3
Resolution
16-25 MP
$759.00View partBuild a system with it

For the single-camera version of this measurement, the cylinder diameter measurement guide works the same edge math on a live part.

Gate 2: the laser mark must read

The mark is the only feature that encodes the type directly, so read it with OCR and compare it against the string the order expects — not merely against "some string exists". Budget pixels per character: 20 px of character height is the working minimum, 30 px or more to read worn or partially filled marks. At the 0.0217 mm/px scale above, a 2 mm character is 2 / 0.0217 = 92 px tall, deep inside the comfortable zone.

Illumination decides whether an engraved mark reads at all. Laser etching on machined steel is a dark-field target: low-angle light throws the mark's micro-roughness into contrast against the polished face, while straight-on bright field washes it out. Bright field suits ink marks and annealed marks that darken the surface instead.

Bright-field and dark-field lighting geometry High-angle light reflects off the flat surface straight into the lens, so the surface looks bright. Low-angle light reflects away from the lens, so the surface looks dark and only edges or scratches scatter light upward.flat part with a scratchCamerabright field(high angle)dark field (low angle)flat areas reflect away;only the scratch sends light up
Bright-field and dark-field lighting geometry. High-angle light reflects off the flat surface straight into the lens, so the surface looks bright. Low-angle light reflects away from the lens, so the surface looks dark and only edges or scratches scatter light upward.

Lock exposure and gain. Auto modes re-brighten a weak or missing mark and hide exactly what this gate exists to catch. If your parts carry an unusual typeface, choose it deliberately — the OCR font selection guide lists the faces machines read reliably.

For a single-gate station, a smart camera with integrated light runs the whole mark check on the device:

Smart cameras & vision sensors1.6 MP smart camera, 60 fps, 16 mm lens, white light (polarized, transparent light) (LS-SMC-0063)LS-SMC-0063
Interface
GigE
Resolution
Up to 3 MP
$1,110.00View part

Gate 3: surface finish from mean gray level

The coating is a type feature no caliper can see. Place a fixed ROI on a flat machined face, lock exposure and gain, strobe the LED, and compare the ROI's mean gray level with a trained reference.

Train on 20 or more known-good parts spanning at least three production lots. Record the mean and the standard deviation, and set the reject band at ±3σ. Example: 20 good zinc-plated parts give a mean of 148 gray levels with σ = 6, so the band is 148 ± 18, that is 130 to 166. A black-oxide part of the same family measures near 65 and a stripped, uncoated part near 172 — both outside the band, both rejected. Local variation separates texture too: a bead-blasted face raises the standard deviation across the ROI even when its mean lands in band.

Two things quietly break this gate. Auto gain compensates for a different coating and the mean never moves — keep it locked, and see the auto-exposure ROI instability guide for how feedback loops drift. And LED aging plus window soilage shift every part's mean together, so track a reference patch each shift with the ROI and reference measurement method.

The station: cameras, strobes and controller

Three views cover the gates: a face view for mark and gray ROI, a side view for the diameter, and a second face view when parts arrive in two orientations. Any view that sees a moving part needs a global shutter; rolling shutter smears a moving part into a trapezoid and the ±5 px budget disappears.

Freeze motion with light rather than a slow shutter. Blur in pixels = part speed × exposure / scale. At 100 mm/s with a 50 µs strobe: 100 × 0.00005 = 0.005 mm, and 0.005 / 0.0217 = 0.23 px — invisible. With a 2 ms shutter the same part smears 0.2 mm ≈ 9 px, larger than the entire tolerance band. Trigger from a present sensor, strobe the LEDs, and read the verdict between parts.

The face view needs global shutter more than resolution:

Area scan camerasHikrobot MV-CU020-90GC 2.5 MP Area Scan Camera, GigE, GMAX4002, ColorMV-CU020-90GC
Sensor format
1/1.7"
Lens mount
C-mount
Interface
GigE
Resolution
Up to 3 MP
$309.00View partBuild a system with it

A three-camera station wants LAN ports for the cameras, strobe channels for the light heads, and verdict logic running beside the inspection. Browse area scan cameras for the side views, vision controllers for the box, or the camera finder to filter by shutter, resolution and interface. A controller sized for this station looks like this:

Vision controllersHikrobot MV-VC3301H-128G66 I3-8100, 8GB+128G SSD, No PoE, PCIe expansion supported, Incl. VM6200Pro licenseMV-VC3301H-128G66
LAN ports
5+ LAN ports
USB 3 ports
3-4 USB 3 ports
Light outputs
4 built-in channels
Memory
8 GB
$2,419.00View partBuild a system with it

Train on good parts, then hold the calibration

Train each gate on good parts from several lots, not on one golden sample. The golden part sets the target; the spread across lots sets the band. Store the reference images with the recipe so the next operator re-trains without re-deriving thresholds.

Calibration drifts when someone bumps a bracket. Re-check the dimension gate against the reference part at shift start; the one-target routine in the robot-cell recalibration guide restores the scale in minutes.

When the usual answer is wrong

Pattern matching alone is not verification. A Ø 28 mm bushing of the same style scores nearly as high as the Ø 30 mm template, because correlation normalizes away the size difference your customer cares about. Use pattern match for pose and ROI placement; use calibrated edges for size. Symmetric families add a rotation trap on top — the symmetric part orientation guide shows how much rotation tolerance a look-alike family hides.

Do not verify only at final pack-out, 5,000 pieces deep into a sealed batch. Catch the mix at the machine output, where the wrong part is one bin away from its own family.

And do not commission against good parts only. Run every known wrong family through the station deliberately and log which gate catches it. A gate that catches nothing is miscalibrated or redundant — either way you want to know before shipment, not after.

Checks before you order

  • Field of view covers the widest family plus presentation wander with 10% margin at the chosen working distance.
  • Tolerance in pixels is at least 10× your measured edge repeatability on a machined test part.
  • Global shutter on every view that sees a moving part, and a strobe short enough to hold blur under 0.3 px.
  • Character height at the mark ROI is 20 px minimum for the smallest font you ship.
  • Exposure and gain locked on the gray gate, with a reference patch checked every shift.
  • One trigger in, one pass/fail out, a code saying which gate failed, and no-result routed to reject.
  • LAN ports for every camera plus one spare, and one strobe channel per light head.

Parts list and next step

Gate View Hardware
Dimension Side MV-CS200-10UM — 20 MP, 1" mono, USB3, C-mount
Mark + finish Face MV-CU020-90GC — 2.5 MP, 1/1.7", global shutter, GigE
Mark only, on device Face LS-SMC-0063 — 1.6 MP, 60 fps, integrated white light, 16 mm lens
Logic, I/O and strobes — MV-VC3301H-128G66 — 5+ LAN ports, 3-4 USB 3 ports, 4 built-in light channels, 8 GB

Pick the cameras from the finder above, add the strobes and I/O, then start the build at the camera step of the configurator below. If two of your families differ by less than the worked example, send the drawings through the quote desk and we will help you set the bands. More line-side builds sit in the applications topic hub.

Build the whole station

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.

Start with the camera

Questions

How do I prove the dimension gate measures honestly?

Run a gage study on the station itself. Measure one certified reference part 25 times without touching the fixture, compute the standard deviation, and require the part tolerance to be at least 10 times that σ. For a ±0.10 mm tolerance you want σ ≤ 0.01 mm; at the 0.0217 mm/px scale in the worked example that is about half a pixel of variation, which a subpixel edge holds comfortably.

Can one camera run all three gates?

Sometimes two of them. If the mark and the surface ROI sit on the same face, one view carries both gates. The critical diameter usually appears on a different silhouette, so a second view is the practical minimum. A single view works only when the dimension shows as an edge in the face image; a bushing photographed down its axis shows no diameter edge at all.

What happens if a camera fails mid-batch?

The verdict logic must treat missing evidence as a fail. Give each gate a timeout: if the PLC sees no result inside the cycle window, or the image arrives saturated, black, or fails its check, route the part to the reject bin and raise an alarm. A fail-safe default to reject is what keeps a blocked lens from shipping a batch.

How fast does a three-gate station sort?

At one part per second the station clears 3,600 parts per hour, so a 5,000-piece order takes about 83 minutes of sorting plus handling. Exposures under 1 ms and processing overlapped with conveyor motion keep 1 part per second realistic on a vision controller; the usual bottleneck is part presentation, not computing power.

Do I need color cameras to check coatings?

Usually not. Under a fixed white strobe, a mono sensor separates zinc, black oxide and phosphate by mean gray level alone. Color earns its place only when hue itself is the spec, such as colored anodize families, or when two coatings reflect differently across wavelength but look equal in broadband gray.