You need a serial number or a MAC address off a controller module — for a warranty claim, a spare-part order or a network record — and the module sits on the bench unpowered, with a small Data Matrix printed or etched on its label. The label, not the program, is the data source. This guide gives the decision order — printed text first, program query second, imaging third — then the numbers for the imaging route: the pixels-per-module floor, the light angle, and a worked lens example that ends in millimetres of working distance. It finishes with parsing the decoded string into serial and MAC fields.
What is encoded in the Data Matrix on a controller module label?
A manufacturer Data Matrix on a controller module label packs the order code, hardware version, serial number and often the MAC address into one symbol that holds from a few bytes up to 1556 bytes.
The symbology is public; the contents are not. ISO/IEC 16022 defines the symbol, and current labels use its ECC 200 variant, whose Reed-Solomon correction decodes a scratched or partly obscured mark. The byte layout inside is each manufacturer's own: an order-code field, a serial field, a MAC field, separated by control characters or fixed lengths. A plain-language Data Matrix symbology overview covers the capacity and variants.
Nothing in the standard tells you which field is which, so the plan never changes: decode the bytes, then match them once against the label's printed text. That one match gives the field positions for every module of the same type.
Can you read the serial number without decoding the Data Matrix?
Yes: in almost every case the serial number and MAC address are also printed as human-readable text on the same label or on the module's front plate, so read them by eye before you set up any camera.
For a warranty check that is the whole job: the printed serial against the purchase or delivery record. The MAC address usually appears a second time on the front plate beside its port, so a network record needs no decode either.
When the serial must reach a database automatically, aim the reader at the print instead of the symbol: reading several text strings in one image with a fixed code reader shows the OCR set-up. OCR on plain print is more forgiving than decoding a small etched 2D code, so try it before buying anything for the symbol alone.
Can the controller report its own serial and MAC?
Often yes — many controllers and communication modules expose their serial number and MAC address to the program or the engineering tool, which is faster than imaging a label, but it needs the rack powered and a live connection.
One pattern reads both values inside the controller program. A second queries the CPU over the backplane and reads the serial number and MAC with the RDREC record-read instruction. A third calls a factory tool, such as reading the MAC and serial with piSerial on a Linux controller.
When the module itself is the fault you are chasing, none of those work: the rack is down or the card will not answer, and the label becomes the only source that never needs a working module. That is the case the rest of this guide serves.
How many pixels per module does the reader need?
Decode needs at least 3 pixels across every module, and 4 to 5 pixels per module is the working target for small, etched or low-contrast codes on module labels.
Measure the module size first: divide the code width by the modules per side. A 12 mm symbol with 48 modules per side has 12 / 48 = 0.25 mm modules. The 3-pixel floor then asks for 0.25 / 3 = 0.083 mm per pixel on the part, and the 5-pixel target 0.25 / 5 = 0.05 mm. Keep a one-module clear margin around the symbol in the frame; the finder pattern locks on it.
Etched codes have ragged module edges, and that is where pixels 4 and 5 earn their place. The same module-size discipline sets reader distance in every symbology — the worked numbers in Code 128 module size, reading angle and reader distance translate directly to a 2D symbol.
Which light gives contrast on an etched or glossy module label?
A bar light at 30 to 45 degrees — dark field for etched codes, diffuse low angle for print under a glossy overlaminate — is the technique that turns a faint module label into a decodable image.
In dark field the light grazes the surface and the camera sees only what scatters: the etched module edges light up and the flat background stays dark. Bright field, with the light near the camera axis, is the choice for crisp print on a matte label.
One bar light on a bracket covers both jobs, and strobing it from a light controller freezes the scene against plant ambient light. The LS-BAR-1047 is a 290 x 30 mm, 24 V bar light that spans a module front panel in one pass.
- Size
- 200-400 mm
- Type
- Standard
- Voltage
- 24 V
Glossy overlaminates flip the problem — the specular highlight blinds the sensor. A polarized reader such as the MV-IDB005EXI-05NRP (1.3 MP, 4.63 mm focal length, 70 mm focus distance) carries crossed polarizers, so the print reads through the glare. Etched metal is a dark-field problem end to end: DPM Data Matrix lighting for readable marks on metal and dot-peen dark-field contrast on shiny metal give the geometry for that case.
Three readers from the fixed code readers category cover the common mounting cases:
- Interface
- Fast Ethernet
- Resolution
- Up to 3 MP
- Resolution
- Up to 3 MP
- Shutter
- Global
- Interface
- Fast Ethernet
- Resolution
- Up to 3 MP
A smart camera decodes on the device when you want a presence check with every read; the LS-SMC-0063 (1.6 MP, 60 fps, 16 mm lens, polarized white light) is one example. The choice between an IP camera and a self-contained reader is laid out in DMC code readers for workpiece tracking.
What lens and working distance decode a 12 mm Data Matrix?
At 3 pixels per module, a 2560-pixel-wide reader covers a field of view about 213 mm wide, which puts an 8 mm focal length lens at a working distance near 232 mm — workable behind a rack door.
Run the chain for the 0.25 mm modules measured above:
- The reader: the LS-CRD-0028. Its data prints 2560 x 2048 pixels, an 8 mm lens and a 1/1.7-inch sensor format.
- The sensor width: a 1/1.7-inch optical format is about 7.6 mm wide, an estimate from the format convention. Pixel pitch: 7.6 / 2560 = 0.003 mm, about 3 µm.
- Field of view at 0.083 mm per pixel: 2560 x 0.083 = 213 mm wide, 2048 x 0.083 = 170 mm high — a full module front panel in one image.
- Magnification m = 7.6 / 213 = 0.036.
- Working distance WD = 8 x (1 + 1/0.036) = 8 x (1 + 28) = 232 mm.
- The 5-pixel target: 2560 x 0.05 = 128 mm field of view, m = 7.6 / 128 = 0.059, WD = 8 x (1 + 17) = 144 mm.
- Interface
- Fast Ethernet
- Resolution
- 5 MP
- Sensor format
- 1/1.7"
- Shutter
- Global
The lens focal length calculator runs the same chain in both directions.
Focal length scales the distance: 12 mm instead of 8 mm at the same magnification moves the example to 232 x 12 / 8 = 348 mm. The MV-ID3013PM-12M-WBN is a compact reader with a 12 mm focal length and 1.3 MP. For labels you can approach closely, the LS-CRD-0047 (1.2 MP, USB 2.0) is specified for a 60-120 mm reading distance — inside most rack doors.
Exposure: with the module stationary and the light strobed, set 2 ms and low gain. If the part rides past at 300 mm/s, blur is 300 x t, and keeping it under one pixel (0.083 mm) caps exposure at 0.083 / 300 = 0.00028 s, about 0.3 ms — that is a strobe job, not a shutter job.
Depth of field is generous at this magnification. With a 2-pixel blur circle (about 6 µm) and m = 0.036: DOF ≈ 2 x f-number x c x (1 + m) / m² = 2 x 4 x 0.006 x 1.04 / 0.0013 ≈ 38 mm at f/4, and about 77 mm at f/8. Fixed-lens readers have no aperture ring, so hold the mounting distance inside the f/4 band instead.
How do you decode the label step by step?
Work the decision order as a fixed sequence — printed text, program query, then imaging — and the imaging part is eight steps from mounting the reader to a 20-read acceptance test that you run before trusting the string.
- Read the printed text. Copy the serial and MAC off the label and front plate; they anchor the parse later.
- Try the program route. If the rack powers and the module answers, the query methods above are the fast path; stop there.
- Fix the geometry. Mount the reader at the computed working distance, square to the label within about 10 degrees — more tilt shrinks module pitch along one axis.
- Place the light. Grazing bar light for etched marks, near-axis light for clean print, polarization for glossy laminate.
- Set the exposure from the worked example, gain low, strobe on.
- Enable the Data Matrix (ECC 200) symbology and pick the trigger from trigger modes: sensor, serial or free-run; choose decode mode or snapshot mode to match your cycle.
- Wire the interface. USB readers follow the first-connection and readback checks; Ethernet and serial readers land the same string.
- Run the acceptance test: 20 reads of the same label must give 20 identical strings. Then route the output — reading a barcode reader into a PLC CPU module over serial is the pattern.
How do you split the decoded string into serial and MAC?
Split the decoded ASCII string on its field separators — GS (0x1D) and RS (0x1E) are the usual ones in manufacturer formats — then match each field by its identifier or fixed position to pull out the serial number and MAC address.
A decode often comes back looking like SN 784213056<GS>MAC 001B44113AB7: split on the separators and the fields fall out. When the MAC is stored as six raw binary bytes, the reader may transmit it in hexadecimal and the line shows unprintable characters — the fix is the word-to-ASCII conversion in converting hex barcode data to ASCII text.
Match each field once against the printed label, then fix the positions for that module type. Decoding is deterministic — ECC 200 returns the same bytes every time — so a parse proven on one label holds for every module of that type.
What should you check before ordering the reader?
Check six things before you order: the module size in millimetres, the pixels the reader resolves across it, the working distance your mounting allows, the label finish, the trigger source, and the interface your controller speaks.
- Module size: code width divided by modules per side. It drives every number above.
- Pixels across the code: at least 3 per module, 5 for etched marks.
- Working distance: 232 mm needs a bracket; 60-120 mm needs close access.
- Label finish: matte print, glossy laminate (polarize), or etched metal (dark field).
- Light and reader as one bill: pair the reader with bar lights; the light finder filters by size and colour.
- Interface and trigger: USB, Fast Ethernet or serial, and what starts the read.
Start the system configurator at the light step to pair a reader, lens and light, or request a volume quote when every station needs the same read. More set-ups are indexed under code reading, and free expert support comes with every order — send the label photo and mounting distance and the answer comes back with a part choice.
Questions
Can a phone app decode the Data Matrix on a module label?
A phone decodes a flat, printed label in even light, and the 3-pixels-per-module rule applies to any decoder. Phones struggle below about 100 mm focus distance and usually fail on laser-etched or glossy labels, and the read stays manual. Use one to confirm the code is readable before you commit to a fixed reader, not as the production method.
How small a module can a 1.3 MP reader still decode?
Take 1280 pixels across the sensor and the 3-pixel floor: at a 100 mm field of view one pixel is 0.078 mm, so the smallest decodable module is about 0.23 mm. Halve the field of view to 50 mm and 0.12 mm modules decode. The limit is field of view and close focus, not the decoder.
Do all fixed readers decode every Data Matrix variant?
Any reader that lists ISO/IEC 16022 or Data Matrix ECC 200 covers the variant on module labels, which have used ECC 200 since the symbology settled. The pre-ECC variants (ECC 000 to 140) survive only on very old marks; if a 1990s module will not decode, check the reader's symbology list for them before blaming the lighting.
Will two different readers return a different serial number string?
No. ECC 200 decoding returns the same stored bytes on every reader; the differences you see are transmission framing — a prefix or suffix, a line break, or raw bytes sent in hexadecimal when the MAC is stored as six binary bytes. Normalize the frame in the PLC or DA software and the strings match byte for byte.
Is the MAC in the code the same as the one on the network port?
On single-port modules, yes. On multi-port modules the symbol usually carries the base MAC and the port MACs follow it in ascending order, port 2 one address above port 1. Check the field count in the code against the port count once; after that, the base MAC plus offsets predicts every port.




