Skip to main content
A Mono Camera Catches PCB Color Differences When You Choose the Wavelength
Lighting Design,  Optics

A Mono Camera Catches PCB Color Differences When You Choose the Wavelength

LIGHTING

A mono camera can catch color differences too. Choose the lighting wavelength and copper exposed through a green mask stands out most at 625 nm, sampled twice as finely as by the color version of the same sensor.

With a 40 mm field and a 2,448 px sensor, I calculated band assignment by defect type, the channel spacing of a Bayer color sensor, and the normalization that puts three images on one scale.

About 12 min read

Put a PCB under white light and the green solder mask, white silkscreen and reddish-brown copper pads look clearly different in color to the eye. So a color camera seems bound to separate them easily, yet a thin silk smear on a pad or copper showing through where the mask has lifted sometimes does not split off as sharply as expected. The three materials differ in reflectance too: the mask is a translucent resin layer that can carry a gloss, the silk scatters light evenly, and copper, being a metal, returns very different amounts of light depending on wavelength. Lower the threshold with too little contrast and mask gloss blotches and print-density differences flood in as over-detections; raise it and an 80 μm mask peel passes. Add the resolution loss of a color camera, and the smallest defects scatter over a few pixels from the start, so the judgment wavers. At the end of it, a re-inspection step where workers look again by eye remains.

The fix is to pick the wavelength and build contrast at the lighting stage instead of capturing color. Give a monochrome camera1 narrow-band LED2 lighting, and only the wavelength where the reflectance difference between two materials is largest gets lit. With a setup viewing 40 mm across on a 2,448 × 2,048 px sensor, I calculated which band to assign to each defect type and how much resolution a color camera gives up.

Color is the shape of reflectance across wavelength

The color of an object is the shape of its spectral reflectance3 curve, which plots how much light it returns at each wavelength. A solder mask that looks green returns relatively more of the green band and absorbs the red and blue bands. So under red light the mask images dark, and under green light, bright. It is the same mask. It is the rule that light of the opposite color, the complementary color4, darkens a target, while light of the same color brightens it.

It is like holding red cellophane up to your eyes as a child: red writing sank into the white paper and vanished, while green writing rose up black. A mono sensor records only the amount of light coming in, so changing the lighting wavelength amounts to changing the order of brightness among materials. Copper has low reflectance at short wavelengths and higher reflectance toward long ones, which makes it look reddish-brown, and white silk returns the whole visible band evenly.

The machine vision filter note from Edmund Optics explains the same principle with the color wheel. Colored glass filters work best when blocking colors on the opposite side of the wheel, and in an example imaging red and green capsules with a mono camera, a single green filter raised the contrast from 8.7% to 86.5%. Whether a filter sits in front of the lens or the light itself has that color, the point is the same: choosing the wavelength that reaches the sensor. To my eye, this calculation comes before choosing a color camera.

Each defect has its own band of greatest contrast

In PCB inspection, assigning each defect type its own band of greatest contrast is more accurate than trying to catch every defect with one band. Finding copper exposed by mask peeling is a contrast problem between copper and mask, and finding silk smeared onto a pad is a contrast problem between silk and copper. Each pair peaks at a different wavelength. Try to solve both problems with one band and one contrast is sacrificed, and the threshold ends up covering for it.

The red 625 nm frame goes to exposed copper and missing pad areas, because copper is bright and the green mask dark, giving a sharp border. The blue 470 nm frame goes to silk smears on pads, since silk stays bright while copper turns relatively dark. The green 525 nm frame uses the same-color rule to brighten the mask background, lifting dark foreign matter or scratches on the mask. The figure below overlays the reflectance curves of the three materials and the contrast in each band as a concept.

Relative reflectance curves of copper, solder mask and silkscreen over wavelength, with the brightness contrast a mono camera obtains in the 470, 525 and 625 nm bands
See that a mono frame gains contrast in the band where the curves of the three materials spread farthest apart (curves are conceptual).

The curves in the figure are a conceptual drawing that shows shape, so real values change with the mask formulation and the copper surface finish. So I would settle the band assignment table by measurement and only then write the algorithm band by band. Contrast the lighting failed to create cannot be fully recovered by image processing alone. A glossy mask can mix in specular reflection depending on lighting angle and even swap the brightness order between bands, so whether this assignment holds as is cannot be guaranteed before a sample test.

A color sensor puts a red pixel in one of four

A typical color sensor uses a Bayer pattern5, placing only one of red, green and blue filters on each pixel. Half the pixels are green and a quarter each red and blue, so a red pixel appears only every second position across and down. Demosaicing6, which fills the gaps, interpolates from neighboring values and does not bring back real resolution. The passbands of color filters are broad and overlap each other, so channel separation is also blunter than the reflectance difference a narrow-band LED creates.

Viewing 40 mm across with 2,448 px, a mono sensor has a pixel resolution of 16.3 μm/px and an 80 μm mask peel covers 4.9 px. On the color version of the same sensor the red channel spacing is 32.7 μm, so the same defect shrinks to 2.45 samples, below my rule of three. The detection premise collapses in the very channel that shows exposed copper best. Resolution runs out before color does.

4.9px

Width of an 80 μm mask peel at 16.3 μm/px mono

32.7μm

Red channel spacing on the color version of the same sensor; the defect spans 2.45 samples

1.51×

Extra images needed to meet the same condition with a color camera

To meet the same condition with a color camera, the field must shrink to 32.6 mm so that 80 μm spans three samples even in the red channel. The number of images needed to cover the same board grows by (40 ÷ 32.6)² = 1.51 times. The price of mono sequential capture is one image per band, three in all. Which costs less depends on board size and tact time, but I would calculate how many samples the smallest defect spans at the color channel spacing and then choose.

Normalizing three images to one scale

The quantum efficiency7 of a mono sensor differs with wavelength. Even at the same exposure, the signal collected at 470 nm and at 625 nm differs, so comparing the brightness of the three images as is mixes material differences with sensor sensitivity differences. So a white reference card is imaged in each band and the exposure or light output is set so the card reads the same. Only after that do brightness comparisons between bands speak about materials.

Contrast is measured for each material pair as Michelson contrast8, (bright − dark) ÷ (bright + dark). My rule is 0.3 or more, which is a brightness ratio of 1.86 to 1. The minimum advisable contrast of 20% in the Edmund Optics note works out to 1.5 to 1 under the same definition, so 0.3 leaves one more step of margin. Below 0.3, the band changes.

Separating copper with a band ratio image9, the 625 nm image divided by the 470 nm image, keeps it steadier even when lighting brightness wobbles slightly. When both images brighten or darken by the same ratio, the division cancels it. But if the board moves while the three images are taken in turn, the images misalign and false patterns appear at the edges of the ratio image, so capture at standstill is a premise. Transport and stop control is a separate review.

From an 80 μm mask peel to 0.3 contrast, three spec lines

Moved into a spec, the calculation becomes three lines: defect size, lighting with band assignment, and normalization with judgment. The WD (working distance)10, the distance from the front of the lens to the board, has to hold the ring light height and the height of components mounted on the board.

ItemReference valueCondition and basisIn plain words
① Minimum defect size · mask peelExposed copper 80 μm or more4.9 px at 16.3 μm/px. Design assumptionCopper showing about five pixels wide
① Minimum defect size · silk smear on pad100 μm or more6.1 px. Design assumptionWhite print on a pad
① Minimum defect size · pad discoloration and soiling150 μm or more9.2 px. Design assumptionA wider patch of changed color
② Optical setup · lightingMultichannel ring light (470, 525, 625 nm), diffuser, sequential lightingContrast per band settled by measurementThree images, changing color each time
② Optical setup · band assignment625 nm for exposed copper and missing pad, 470 nm for silk smear, 525 nm for foreign matter on maskFirst assignment by the complementary and same-color rulesA best color for each defect
② Optical setup · lens and sensor25 mm F/5.6, mono 2,448 × 2,048 px, 16.3 μm/pxMagnification 0.211, thin-lens object distance 143.4 mm. Red channel of the color version at 32.7 μm spacing40 mm across in one image
② Optical setup · WDWD of 120 mm or more secured (design assumption)From the lens front. Measure including ring light height and component heightLight and tall parts have to fit under the lens
③ Algorithm parameters · normalizationExposure correction per band with a white reference cardCorrects quantum efficiency that differs by wavelengthPut three images on one scale
③ Algorithm parameters · contrast ruleMichelson contrast 0.3 or more per material pair (brightness ratio 1.86 to 1)Design target. Reassign the band if it falls shortThe bright side must be nearly twice as bright
③ Algorithm parameters · separation and judgmentCopper separated by the 625 nm ÷ 470 nm ratio image, per-band area difference over 3σ with area 12 px or moreAn 80 μm defect covers about 24 pxSplit off copper first, then look for flaws

The first thing to read from the table is that the case for mono with band selection rests on resolution more than on color separation. At 16.3 μm/px mono, an 80 μm peel is 4.9 px, comfortably past the 3 px premise, while the color version of the same sensor would give only 2.45 samples in the red channel, breaking the premise in the channel that should show exposed copper best. The tact cost of three exposures is the price paid for this difference in resolution.

There are clear cases where mono with band selection does not fit. When color itself is the criterion, as with discoloration grades or contamination of unknown kind, white light with a color camera that gets three channels at once wins. When the board is moving and changing bands for three exposures is hard, a color camera that captures in one shot does better on both tact and registration. On a high-mix line where blue, black and red masks change from model to model, the complementary band changes with them, so if managing a band assignment table per model is a heavy burden, a color camera is simpler to run. The reflectance difference by band changes widely with solder mask gloss and copper surface finish, so which approach comes out ahead also cannot be guaranteed before a sample test.

Picking a band for each material pair and weighing resolution by channel spacing is a calculation you redo every time the product changes in PCB appearance inspection, and anyone who wants to try it on real boards needs only one reflectance chart and one division. From the procurement desk, asking how many samples the smallest defect spans in the channel actually used, and whether there is a measured table of contrast per material pair, tells more about real detection power than whether the camera is color or mono. This article explains technology and is not investment advice. See our Disclaimer.

Field Note

If a small solder mask peel on a PCB is being inspected with a color camera, I would calculate how many samples the smallest defect spans in the red channel before changing cameras. In this setup 80 μm is 2.45 samples, short of the three-sample rule in a single channel. Next, for each candidate band of 470, 525 and 625 nm, the exposure is matched with a white reference card, and the bands whose Michelson contrast per material pair exceeds 0.3 go into the assignment table. When the mask supplier or the copper surface finish changes, this table gets measured again.

Field Checkpoints

Once channel spacing and per-band contrast are confirmed, I check the rest with the questions below.

  • Is a WD of 120 mm or more secured by measurement, including ring light height and mounted component height? (whether the light and tall parts fit under the lens)
  • Have the color and gloss of the solder mask and the copper surface finish been confirmed first? (a changed reflectance curve changes the band assignment)
  • Has a band assignment table been built from measured Michelson contrast per band for each material pair to detect? (bands of 0.3 or more only)
  • If a color camera is under review, does the smallest defect span three samples or more at the channel spacing? (the red channel in this setup is spaced 32.7 μm)
  • Has the exposure per band been matched with a white reference card? (sensor sensitivity differs by wavelength)
  • Does the board hold still for all three exposures, and does that time fit within the tact? (whether the images stay registered)

Glossary

  • [1] Monochrome camera monochrome camera
    A camera with no color filters, in which every pixel records only the amount of light. With the same sensor it uses every pixel and samples more finely than the color version. ↩
  • [2] Narrow-band LED narrow-band LED
    An LED that emits only a narrow range of wavelengths around one color. Lighting only the chosen wavelength lets the light itself build material contrast. ↩
  • [3] Spectral reflectance spectral reflectance
    How much light a surface returns at each wavelength. The shape of this curve is what the human eye sees as color. ↩
  • [4] Complementary color complementary color
    Colors facing each other on the color wheel. Light in the complementary color of a target images it dark. ↩
  • [5] Bayer pattern Bayer filter mosaic
    An arrangement placing one red, green or blue filter on each pixel in a checkerboard. Half are green and a quarter each red and blue. ↩
  • [6] Demosaicing demosaicing
    Interpolation that fills the missing color information of a Bayer pattern from neighboring pixel values. It fills gaps without creating new information. ↩
  • [7] Quantum efficiency quantum efficiency
    The share of incoming light particles that a sensor turns into electrical signal. It varies with wavelength, so exposure has to be matched per band. ↩
  • [8] Michelson contrast Michelson contrast
    Contrast computed as (bright − dark) ÷ (bright + dark). At 0.3 the brightness ratio is 1.86 to 1. ↩
  • [9] Band ratio image band ratio image
    An image made by dividing one band image by another, pixel by pixel. Brightness changes carried equally by both images cancel out. ↩
  • [10] WD working distance
    The distance from the front of the lens to the surface being inspected. The ring light and tall components on the board have to fit in between. ↩

References

  • Edmund Optics Knowledge Center, Machine Vision Filter Technology (colored glass filters that block colors on the opposite side of the color wheel, a capsule example with a mono camera where contrast rose from 8.7% to 86.5%, and a minimum advisable contrast of 20%)
  • Wikipedia, Bayer filter (a pattern of half green and a quarter each red and blue, and demosaicing interpolation)
  • Formulas: pixel resolution = field of view ÷ pixel count, Bayer red channel spacing = pixel resolution × 2, samples per defect = defect size ÷ spacing, field that keeps three samples = defect size ÷ 3 ÷ 2 × pixel count, image count ratio = (field1 ÷ field2)², Michelson contrast C = (Imax − Imin) ÷ (Imax + Imin), brightness ratio = (1 + C) ÷ (1 − C), magnification m = sensor width ÷ field of view, u = f × (1 + 1/m)

Related reading — An 850 nm Band-Pass Filter Erases Factory Lights but Leaves Sunlight · Gaps in a Clear Conformal Coating Show Up Under UV Fluorescence · Vision Types Split First by Wavelength and Pixel Size

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 *