Code readingGuide

Part position and barcode reading in one image

Read part position and barcode data in one image: the pixel rule, a worked 12 MP example, trigger and strobe timing, and when to add a second station.

LumaSpec Vision10 min read Share on LinkedIn

On this page 10 sections
  1. 01Yes: one trigger, one image, both results
  2. 02What one result telegram carries
  3. 03The pixel rule that decides whether one image is enough
  4. 04Worked example: four PCB boards on a 360 × 260 mm pallet
  5. 05Reader, smart camera, or two devices
  6. 06Trigger, strobe and motion
  7. 07From pixels to robot coordinates
  8. 08When one image is the wrong answer
  9. 09Checks before you order
    1. Optics
    2. Timing
    3. Data
  10. 10Questions

A robot cell often needs two answers from one overhead camera: where each PCB board sits, and what its barcode says about whether that board may move on. One reader per board doubles the hardware, the wiring and the cycle time, and a separate camera for position doubles it again. One trigger and one image can carry both results when you run the locate tool and the decode tool on the same frame. This guide is for anyone wiring that station: it gives the pixel rule that decides whether a single image is enough, a worked example for a four-board pallet, the trigger and strobe wiring, and the cases where a second station is still the right call.

Yes: one trigger, one image, both results

Both fixed code readers and smart cameras run a tool chain on a single captured frame: capture, locate, decode, report. The locate tool finds each board by its outline, a fiducial or a printed mark and returns center X, center Y and angle. For every board it found, the decode tool opens a region of interest around that label and decodes the 1D or 2D symbol inside. The chain ends with one telegram that lists every board: position, angle, code string, symbology and trigger counter. The position never re-triggers the camera and the decode never takes a second frame, so both results describe the same exposure and the same part.

When boards sit close together, decoding per located ROI beats one full-frame pass. Read multiple barcodes in one image with iterative decoding shows the pattern, and setting an ROI for inline code reading measures the speed it buys.

What one result telegram carries

Design the result before the optics. For each board, send five fields: center X and Y in the robot frame, rotation angle, the decoded string with its symbology, and a trigger counter that ties the set together. The PLC matches the set to the pallet and routes the code to job selection, as in route a barcode reader result to robot job selection. Attach a grade or confidence value to each string so a marginal read cannot pass silently; barcode read confidence shows how to set that floor.

The timing budget is friendly because an integrated reader processes on the device and sends a few dozen bytes, not the image. The LS-CRD-0028 is specified at 30 fps and 60 codes per second. At 60 codes/s one decode takes 16.7 ms, so four codes cost about 67 ms; add a 33 ms frame and a locate budget near 10 ms and a pallet consumes roughly 110 ms of image work. A line that dwells one second per pallet runs with nine times margin.

Fixed code readers2560 x 2048 fixed code reader, 30 fps, 60 codes/s, 8 mm lens (LS-CRD-0028)LS-CRD-0028
Interface
Fast Ethernet
Resolution
5 MP
Sensor format
1/1.7"
Shutter
Global
$920.00View part

The pixel rule that decides whether one image is enough

Tools are not the constraint; pixels are. A decoder needs a minimum number of pixels across the narrowest bar or module. Decoder vendors commonly quote 2 to 5 pixels per module as the working range, so plan on 3 per module for 1D codes and 4 for QR and DataMatrix. Below about 2 the bar and space pattern aliases and reads become random. Overshooting helps little and can fail outright: very large modules overflow the decoder window, which is why downscaling before barcode decoding rescues reads of chunky codes.

pixels per module = module width / (field of view width / sensor width in pixels) sensor pixels needed = field of view width / (module width / 3)

Run the second line backwards from your field width and you have the sensor class. The camera resolution calculator performs the same arithmetic:

Camera resolution for the smallest feature
Units
Pixels needed
–
Sensor size
– MP
Smallest sensor that fits
–
Pixel on the part
– mm
Pixels across the feature, that sensor
–

Pixels needed = field / feature × pixels per feature on each axis (field incl. margin). The lens must resolve the pixels too: Nyquist = 1000 / (2 × pixel µm) lp/mm.

Find cameras with enough pixels Open the full calculator

Worked example: four PCB boards on a 360 × 260 mm pallet

Assumed inputs, typical for a test-panel pallet: four boards of 150 × 100 mm in a 2 × 2 grid with 20 mm gaps, giving 320 × 220 mm of board area; 20 mm of locating margin on every side; a 0.33 mm Code 128 module on the worst label; and the 3 px per module rule.

The rule gives the allowed pixel pitch: 0.33 / 3 = 0.11 mm/px. Pixels needed: 360 / 0.11 = 3,273 horizontally and 260 / 0.11 = 2,364 vertically.

A 12 MP, 4:3 sensor of 4,096 × 3,000 px: pitch = 360 / 4096 = 0.088 mm/px, coverage about 360 × 264 mm, so both axes fit. Pixels per module = 0.33 / 0.088 = 3.75, a quarter above the floor. A 5 MP sensor of 2,448 × 2,048 px: pitch = 360 / 2448 = 0.147 mm/px, coverage about 360 × 301 mm still fits, but 0.33 / 0.147 = 2.2 px per module, below 3, so reads come and go.

Decision: one 12 MP image carries all four boards with 25 percent margin and stays valid down to a module of 3 × 0.088 = 0.26 mm. If a label revision drops the module to 0.25 mm, move to a 25 MP class sensor of about 5,300 × 4,000 px, which gives 360 / 5300 = 0.068 mm/px and 0.25 / 0.068 = 3.7 px per module, or split the field across two stations. For this field, a 12 MP fixed code reader closes the budget:

Fixed code readersHikrobot MV-ID5120RM-08M-RBN Industrial Code ReaderMV-ID5120RM-08M-RBN
Interface
GigE
Resolution
12 MP
Shutter
Rolling
Lens mount
M12
$1,969.00View part

Reader, smart camera, or two devices

Three architectures cover every variant of this job.

Approach Runs Result path Choose it when
One fixed code reader locate and decode on the device one telegram from one device board outlines and labels tolerate the same optics
One smart camera locate, decode and inspection on the device one telegram, inspection results included you also check polarity or component presence in the same shot
Reader plus camera, shared trigger each device runs one job two telegrams merged in the PLC position wants a wide field while the code wants a narrow, magnified one

The smart camera route adds the inspection pass to the same frame and keeps the wiring at one device; multiple inspection models in the same scene: first result wins covers result priority when several models share one image. The MV-SC5060XM-08M-WBN pairs a 6 MP sensor with an 8 mm lens on an M12 mount, the class that suits mid-size pallet fields.

Smart cameras & vision sensorsHikrobot MV-SC5060XM-08M-WBN SC5000X series Smart Camera, 6 MP, Mono, 8 mm focal length, M12-mountMV-SC5060XM-08M-WBN
Interface
GigE
Resolution
6-10 MP
Sensor format
1/2.4"
Shutter
Rolling
$1,629.00View part

Bare FR-4 and solder mask reflect the light straight back at the lens and starve the decoder. The MV-IDB005EXI-05NRP ships polarized, which cuts the sheen on exactly this kind of shiny board.

Fixed code readersHikrobot MV-IDB005EXI-05NRP Fully isolated version, 1.3 MP resolution, 4.63 mm focal length, 70 mm focus distance, Polarized industrial code readerMV-IDB005EXI-05NRP
Interface
Fast Ethernet
Resolution
Up to 3 MP
Shutter
Global
Lens mount
M5.8
$719.00 · quotedView and quote

Trigger, strobe and motion

Free-running readers capture on their own rhythm, so a pallet arriving mid-frame is half exposed. Trigger every device from the same event, a photoelectric sensor at the fixture or a PLC output. The reader side is covered in fixed barcode reader trigger modes: sensor, serial or free-run, the wiring in trigger a fixed code reader from a GPIO pin, and the camera-side settings in hardware trigger configuration per camera.

Strobe the light inside the exposure. The trigger reaches the light controllers first, and the controller delays the pulse by the camera's trigger-to-exposure time so the LEDs burn only during the frame; that is the sequencing the camera strobe output timing article measures. Strobing also lets the light run at rated current for a fraction of the duty cycle, brighter and cooler than continuous operation. You can compare units in the light controller finder.

maximum exposure = allowed blur / belt speed 0.1 mm / 300 mm/s = 0.00033 s = 0.33 ms

On a 300 mm/s conveyor with 0.1 mm of acceptable blur, the exposure and the strobe pulse must stay within 0.33 ms. Continuous light cannot hold that brightness; a strobe pulse can. The LS-CTL-0070 is a 4-channel, 200 W digital controller with RS232 and a strobe feature.

Light controllersDigital control box, 4 ch, 200 W, RS232 (LS-CTL-0070)LS-CTL-0070
Output
Constant voltage 24 V
Channels
4 channels
Control
Digital
Feature
Strobe
$549.00View partBuild a system with it

From pixels to robot coordinates

Locate reports pixels; the robot wants millimetres in its own frame. A one-time calibration with a grid plate or a known board fixes scale and rotation, and a hand-eye calibration sits on top when the camera is off-axis or robot-mounted. The workflow in locate image defects with pixel coordinates and calibration applies unchanged, since you are locating board centers instead of defects, and the payload leaves exactly as send camera part coordinates to a robot controller over TCP shows.

Repeatability is a fraction of a pixel: at the worked example's pitch, a fifth of a pixel is under 0.02 mm. Calibration, fixture repeatability and gripper compliance dominate long before the sensor does, so budget the tolerance across the whole chain, camera to gripper.

When one image is the wrong answer

Split the job when any of these hold:

  • Boards sit at different heights. Depth of field, not pixels, now decides; size it with the depth of field calculator, and when the height spread exceeds it, take two exposures per trigger with a multi-image capture sequence per shot (multi image capture per trigger).
  • Codes live on two faces of the board. No single field sees both, so use two stations sharing one trigger.
  • The pixel budget fails. The worked example's floor is hard: below 3 px per module no setting recovers the read.
  • Codes and fiducials need different optics. Polarized light for a reflective board plus a plain bright field for a label means two optical paths, and one trigger can still drive both.

Checks before you order

Optics

  • Measure the narrowest bar on your worst label, not the nominal one, then run the pixel rule at that width: 3 px per module for 1D, 4 for 2D.
  • Add at least 20 mm of locating margin per side, then check both axes against the sensor aspect: on a 4:3 sensor the height must stay under 0.73 times the width.
  • Check depth of field against the highest and lowest board surface the field must hold.

Timing

  • Wire one hardware trigger to the reader and the controller, hold the strobe pulse inside the exposure, and keep exposure under allowed blur divided by belt speed.
  • Add frame, locate and decode budgets and compare the sum against the line's pallet pitch.

Data

  • Specify the telegram fields: X, Y, angle, code string, grade and trigger counter, merged per trigger in the PLC.
  • Set the grade floor before go-live and grade the printed labels themselves, as in barcode reader verification for label inspection.

Bring the field size, module width and cycle time to the system configurator, compare reader classes in the code reader finder, and the team answers specification questions through the contact page.

Questions

Can a fixed code reader return position and barcode in one result telegram?

Yes, when the reader runs a separate locate tool and a decode tool on the same frame. Check the model's tool list for a position or pattern-matching tool alongside 1D and 2D decode, and check that the result message carries one position and one code string per found object. Keep a trigger counter in the telegram so the PLC can pair every position with its code even when two pallets pass in quick succession.

How many pixels per module does a barcode need to decode reliably?

Count pixels at the narrowest element your labels actually print, not the nominal width: a 0.33 mm code can etch at 0.30 mm and the rule must hold at the real value. Plan on 3 px for 1D and 4 px for 2D symbols. Both under 2 px and far above the minimum cost reliability: the first aliases the bars, the second can overflow the decoder window.

Do I still need a separate camera for position when the reader finds the codes?

Usually not. A reader's locate tool reports center and angle to a fraction of a pixel, and after a hand-eye calibration that is accurate enough for pickup, because the limit is fixture repeatability rather than the sensor. Add a second camera when position and code need different optics, such as a wide field for boards plus a magnified view for a tiny DataMatrix.

What exposure time can I use on a moving conveyor?

Limit exposure to allowed blur divided by belt speed. For 0.1 mm of acceptable blur at 300 mm/s the limit is 0.1 / 300 = 0.00033 s, about 0.33 ms, and the strobe pulse must fit inside it. Continuous light cannot hold that brightness; a constant-voltage light controller with a strobe feature pulses the LEDs at rated current for exactly that window.

How do I judge whether a borderline read is trustworthy?

Look at the decode grade, not just the string. Readers report quality parameters such as symbol contrast and decode effort; set a floor so a marginal symbol cannot release a board, and grade the printed labels themselves before go-live with a label verification routine. For long payloads, also check Code 128 codeset limits, because a length failure can masquerade as a marginal grade.