MVisionPro Engineering Library · guide
Choosing machine vision lighting for DataMatrix codes marked on metal
In short
Start with low-angle dark field on recessed dot-peen marks, a diffuse dome on curved or mirror-like metal, and coaxial light on a flat reflective face. Where glare remains, try crossed polarizers on the light and the lens. Shoot your worst parts under each light with camera, pose and exposure held, and keep the setup that reads them all across their poses. A clean decode is not a grade: if your application specification requires one, a verifier grades the mark to the edition it names.
Why a light that reads labels struggles on metal
A direct part mark, or DPM, is a code put directly on the part. It can be ink-jetted, but this article deals with dot-peen and laser marks on metal (ISO/IEC 29158:2025 introduction).
Two properties of such a mark vary independently. One is whether neighboring cells touch: dot-peen cells may stand apart as recessed dots, while laser cells may join up. The other, which the light has to bring out, is where the contrast comes from: relief such as a recess and its edges, a change in how the surface reflects, absorbs or scatters light, or both (GS1 DataMatrix guideline).
Polished or machined metal acts as a mirror. In this specular reflection, light leaves at the same angle it arrived, so a lamp shows up as a bright hotspot or not at all. Where that reflection reaches the lens, it can overwhelm the light scattered by the mark, and the pixels saturate: they hit full brightness and lose detail. Tilt the part or move the lamp, and the same mark can flip from dark on light to light on dark, a change of polarity (ISO/IEC 29158:2025 introduction).
First capture your parts under the light the reader or camera already has. If it reads your worst parts across their poses, keep it; otherwise those frames are the baseline for the trials below.
What each lighting option does to the mark
Low-angle dark field. The light arrives almost parallel to the surface. A flat background reflects it away from the camera and stays dark, while the edges of a recessed mark scatter some of it into the lens. Cognex lists dot-peen and laser-etched codes as first tests for this light (Cognex lighting guide). Scratches and machining marks light up too.
Diffuse dome. The metal still reflects like a mirror, but now it mirrors an evenly lit dome instead of a single lamp, so hard hotspots fade. That makes the dome a first test on curved, mirror-like or unevenly finished metal (Cognex and KEYENCE lighting guides). Check that it has not washed out the mark along with the glare.
Coaxial light. The light travels along the camera axis, usually through a beam splitter, a partly transparent mirror angled in front of the lens. This is bright field: a flat reflective face looks bright, while a recess or a laser-altered cell scatters or absorbs the light and shows dark (KEYENCE coaxial lighting example). On a curved part the mirror angle changes across the code, and the bright background breaks up.
Crossed polarizers. A polarizer passes light that vibrates in one direction. Put one on the light and a second one, the analyzer, in front of the lens, with their axes crossed at 90° as the starting position. The pair then aims to block the mirror reflection while passing part of the light the mark scatters. Rotate the analyzer and watch both contrast and brightness, because the result depends on the finish (Edmund Optics illumination guide). Cognex's handheld DPM setup also offers polarized and diffuse modes as trials (Cognex handheld manual). With a reader's polarized lens cap, log the cap, the active light and their orientation, since the cap alone does not show whether light and lens are crossed.
Choosing a starting setup by marking type and surface finish
This order of trials is our engineering reading of the Cognex and KEYENCE guides, not a sequence set by a standard.
| Mark and surface | Try first | Try next | Watch for |
|---|---|---|---|
| Recessed dot-peen or etched mark on a flat machined face | Low-angle dark field | Dome | Machining marks lighting up with the code |
| Laser mark that differs mainly in reflectivity, on a flat reflective face | Coaxial | Dark field if the mark has relief, then dome | Mark polarity changing with tilt |
| Any mark on a curved, mirror-like or unevenly finished part | Dome or another diffuse off-axis source | Crossed polarizers | Glare gone, but the mark washed out too |
Reading light and grading light answer different questions
Decoding recovers the data from an image. Verification grades the symbol by a defined method under defined lighting, and a successful decode is not a grade (GS1 verification guidance).
For direct part marks, ISO/IEC 29158:2025 sets that method. It modifies ISO/IEC 15415:2024, the print quality method for 2D symbols, and defines alternative illumination conditions, grading changes and reporting. Those conditions apply to the verifier, the instrument that grades to the standard. Your reading station can use whichever light decodes reliably.
Your application specification decides whether you need a grade at all, to which edition and at what minimum. If it cites ISO/IEC TR 29158:2011, which is withdrawn, or ISO/IEC 29158:2020, which has been replaced, ask which edition applies. Where no grade is required, a verifier check can still serve as a diagnostic.
Worked example
Take a Data Matrix whose encoded area is 10 × 10 mm, not counting the quiet zone, the blank margin the code needs around it. It has 22 modules across, is dot-peened into a flat machined steel flange and is read by a fixed camera (assumptions of this example).
Settle the geometry first. The module, one cell of the code, is 10 ÷ 22 ≈ 0.45 mm (calculated). Here that is the cell pitch, the distance from one cell center to the next, not the diameter of a peened dot. For the arithmetic only, take the MV-CA050-12UM camera with 2448 × 2048 pixels (datasheet), an assumed 100 × 83.7 mm field and an assumed 300 mm working distance. Sampling, the number of image pixels per millimeter on the part, comes out at 24.48 px/mm in our calculators, or 40.85 µm per pixel (calculated). A module then spans about 11.1 px (calculated). An assumed target of 6 px per module needs 1320 px across the field (calculated), and the camera has 2448.
These numbers stay the same whichever light you mount, so with pose, focus, exposure and gain also held, differences between frames of the same part come from the light.
Run the matrix. A lighting matrix is the same set of parts captured under each light in turn. Use your worst marks: the shallowest dots, an oily part, heavy machining marks. Fix distance, angle and orientation, shield the station from room light or record it, and hold exposure and gain with automatic adjustment off. Start with dark field, because the dots are recessed in a flat face, then try a dome, coaxial light and crossed polarizers where the mechanics allow. If one light needs a longer exposure, tune each light separately and compare the complete setups; on a moving part, every exposure must stay within the same motion-blur limit.
Compare part by part. For each frame, record exposure and gain, the contrast between dots and face, where saturated pixels fall on the code, focus, the decoded string against the expected one, and every no-read or wrong read. Saturation, or glare over some cells or the edge of the code, is a sign to investigate, not an automatic reject. Keep the setups that return the expected string on every worst-case part, frame after frame, across your line's range of poses. Where your specification also sets a read margin or a grade, check that too.
Calculate for your case
Open the sampling example in our field-of-view calculator. The link carries all of this example's inputs: the camera, the 100 × 83.7 mm field, the 300 mm working distance, the 0.45 mm module as the feature size, 6 px per feature and zero speed for a still part. Replace them with your own values.
After loading, the page picks a standard lens for that distance and shows the field that pair actually covers. On 25 September 2026 it chose a 20 mm lens and showed about 118.2 × 98.9 mm and 20.7 px/mm (calculated by the page). That is about 9.4 px per module (calculated) instead of the example's 11.1, still above the assumed 6 px target. The page's verdict says this pair does not meet the entered parameters, so treat it as a lens suggestion only. The lens changes the geometry on screen, not the choice of light.
To reproduce the example's own numbers at the requested 100 mm field, use the optics route of our tools API (application programming interface). This request returns values.pxPerMm of 24.48, values.objectPixelUm of about 40.85 and values.requiredResolutionPx of 1320 (calculated).
Neither the page nor the API models light, marking method, finish, glare or grade. Their minimum feature is the smallest module that still meets your pixel target, not a decoder limit. For your decoder's pixels-per-module range and the recheck with the installed lens, see code size, camera resolution and pixels per module.
Equipment that fits this example
Handheld reference. The MV-IDH9000B handheld reader, in its MV-IDH9000B/13DP/04RP/LS variant, states DPM codes, 1280 × 1024 pixels and four built-in lighting modes: red diffuse, red bidirectional, white direct and white polarized (datasheet). It connects through a smart base with Ethernet and serial ports, and the US variant, also marked for DPM, uses a USB base. Use it to try modes on real marks or as a manual station, not as a drop-in fixed reader.
Fixed trial candidates. The MV-ID3016XM lists Data Matrix and has a red point light with a white diffuse light, optional point colors and transparent, polarized or diffused lens caps (datasheet). The MV-ID5050XM lists Data Matrix and comes with a half-polarized cap, with transparent and full-polarized caps as options (datasheet). Put both through the matrix on your own marks before choosing, and confirm the exact variant with us.
For external lights, see our dome lights, coaxial lights and ring lights. Line lights are made for line-scan cameras and are not a default choice for a compact DPM station.
Common mistakes
- One light looks best on screen because its frames were shot at a longer exposure or higher gain, which can hide lower contrast between dots and face. Hold both for the whole matrix, or compare complete tuned setups within one motion-blur limit.
- Dark field was picked because the mark is dot peen, and it fails once the code sits on a shaft. Curvature changes where the light reflects across the code, so put finish and curvature into the matrix.
- Polarizers are fitted, yet the glare looks the same. Rotate the analyzer at the lens toward the crossed position while watching the hotspot, and log the angle that works.
- Reads fail only at some tilts of the part. Check the failed frames for a mark that flipped polarity, then fix the presentation angle or set the decoder's polarity option as the checklist for codes that do not read describes.
When this rule breaks
A setup chosen at one pose can fail when position, angle or orientation vary on the line, so capture the full spread of poses in the matrix. When the marking settings, the metal or its finish change, rerun the matrix on the new parts, because the source of contrast can change with them. If the part moves during capture, check motion blur too, using the same checklist.
Next step
Send us photos of your worst marks beside a ruler, with the marking method, the metal and its finish, any curvature, the reading distance, and whether the station is fixed or handheld. If your specification requires a grade, add the edition and the minimum grade. We check reader variants and lights against their datasheets, suggest setups for your matrix and say what still needs a sample test. If fixed versus handheld is still open, start with choosing an industrial code reader.
Sources
- Hikrobot datasheets for MV-IDH9000B/13DP/04RP/LS, MV-ID3016XM, MV-ID5050XM and MV-CA050-12UM, as listed in the MVisionPro catalog (checked 2026-09-25)
- MVisionPro engineering calculator: optics API at the requested field (camera geometry and pixel sampling only, not DPM contrast, glare, read rate or ISO grade) and the field-of-view page, which selects a standard lens and shows the field of that pair; checked 2026-09-25
- ISO/IEC 29158:2025 introduction (direct part marking methods, including ink jetting; specular reflection can overwhelm the diffuse signal and change apparent polarity): https://www.iso.org/obp/ui?_escaped_fragment_=iso%3Astd%3Aiso-iec%3A29158%3Aed-2%3Av1%3Aen (checked 2026-09-25)
- ISO/IEC 29158:2025 status and abstract (DPM symbol quality test specification; modifies ISO/IEC 15415; alternative illumination conditions, grading changes and reporting): https://www.iso.org/standard/87123.html (checked 2026-09-25)
- ISO/IEC 15415:2024 (2D symbol print quality): https://www.iso.org/standard/76876.html (checked 2026-09-25)
- ISO SC31 catalogue (ISO/IEC TR 29158:2011 withdrawn; ISO/IEC 29158:2020 replaced): https://www.iso.org/es/contents/data/committee/04/53/45332/x/catalogue/ (checked 2026-09-25)
- GS1 DataMatrix Guideline (ink-based and non-ink direct part marks; cell connection and contrast mechanism as separate properties; symbol specification table and notes, pp. 41–42): https://ref.gs1.org/guidelines/datamatrix/ (checked 2026-09-25)
- GS1 support, how to verify a GS1 DataMatrix (a verifier grade is separate from a successful decode): https://support.gs1.org/support/solutions/articles/43000734334-how-can-i-verify-my-gs1-datamatrix-to-understand-if-it-is-correctly-printed-or-not- (checked 2026-09-25)
- Cognex In-Sight Lighting Guide, table B-1 (laser-etched and dot-peen codes with low-angle dark field; curved metal with a dome): https://www.cognex.com/support/downloads/ns/1/11/89/1010.pdf (checked 2026-09-25)
- Cognex UltraLight explanation: https://docs.cognex.com/dmst_2510/web/EN/DMST_QANDA/Content/Topics/idp10153749248.htm (checked 2026-09-25)
- KEYENCE machine-vision lighting selection guide: https://www.keyence.com/products/vision/resources/vision-resources/basics-of-lighting-selection.jsp (checked 2026-09-25)
- KEYENCE coaxial lighting, including a processed metal mark example: https://www.keyence.com/ss/products/vision/peripheral/ca-d/ca_dx.jsp (checked 2026-09-25)
- Cognex DataMan handheld WebUI reference manual, DPM Reading Setup (polarized and diffuse modes): https://support.cognex.com/docs/dmst_2532/EN/Handheld_WebUI_Reference_Manual.pdf (checked 2026-09-25)
- Edmund Optics, Common Illumination Types (polarizer at the source, analyzer at the lens, crossed axes as the starting position): https://www.edmundoptics.com/knowledge-center/application-notes/illumination/choose-the-correct-illumination/ (checked 2026-09-25)
Related
How this material was prepared
Prepared by MVisionPro from the stated sources and the MVisionPro calculation engine. A physical test is claimed only when the material says so explicitly. Read the editorial method.
Editorial status: verified. Content updated 2026-09-25.