Code readingGuide

Inline barcode reader trigger timing: pacing the serial link

Trigger an inline barcode reader once per part: size the read window from pitch and speed, budget serial timing, latch one complete string per code.

LumaSpec Vision11 min read Share on LinkedIn

On this page 8 sections
  1. 01The read window: pitch divided by line speed
  2. 02Worked example: 100 mm pitch at 0.5 m/s on a 9600 baud serial link
  3. 03Trigger sources compared
  4. 04Pacing the serial link: one complete string per part
  5. 05Choosing the reader and trigger hardware
  6. 06Checks before you order
  7. 07When the usual answer is wrong
  8. 08Questions

An inline barcode reader has one job per part: fire once, decode once, and hand the controller exactly one complete ASCII string before the next part arrives. Run it free and you collect duplicates, half strings and no reliable way to say which code belongs to which part. This guide gives you the numbers that prevent that: the read window your pitch and line speed allow, a worked timing budget for trigger, exposure, decode and serial transmission, and the trigger-source decision behind them. It is written for whoever wires a fixed reader to a PLC or robot controller over serial or Ethernet on a moving line. Put your own pitch and speed into the worked example; the thresholds move with them, and the last section shows when the sensor-trigger answer is the wrong one.

The read window: pitch divided by line speed

Trigger the reader once per part and the time available for the whole chain — sensor switch, exposure, decode, serial transmit, controller latch — is the distance from one part's leading edge to the next, divided by line speed.

read window T = pitch / line speed motion blur b = line speed × exposure time serial time t = characters × 10 bits ÷ baud rate, for 8 data bits, no parity, 1 stop bit

Pitch means leading edge to leading edge. Triggering on the trailing edge, once the part has fully passed the sensor, forfeits the part length: a 70 mm part on a 100 mm pitch at 0.5 m/s leaves only 30 mm ÷ 500 mm/s = 60 ms, under a third of the leading-edge window. Fire on the leading edge and keep the whole pitch as your budget.

Size every delay against that window and keep at least a third of it as margin: trigger latency and decode time jitter from part to part, and a budget without margin fails on the first rushed cycle.

Worked example: 100 mm pitch at 0.5 m/s on a 9600 baud serial link

The inputs, with units and where each comes from:

  • Part pitch 100 mm and line speed 0.5 m/s (500 mm/s): the layout data of the example line; substitute your own.
  • Worst-case string 20 characters: a 16-character payload plus start and terminator characters; take yours from the longest code the line carries.
  • Serial link at 9600 bit/s, 8 data bits, no parity, 1 stop bit: the usual default pairing of industrial readers and PLC serial ports.
  • Decode rate 60 codes/s at 30 fps: the printed rating of the LS-CRD-0028.
  • Exposure 50 µs, chosen for blur and checked below.
  • Allowances of 20 ms for sensor switching plus reader trigger latency, and 10 ms for one controller scan plus the latch.

The rule: those stages must sum to less than the window, with margin to spare.

The arithmetic:

  • Window: 100 mm ÷ 500 mm/s = 0.2 s = 200 ms between triggers.
  • Exposure and decode: 1000 ms ÷ 60 codes/s ≈ 17 ms.
  • Serial transmit: 20 characters × 10 bits = 200 bits, and 200 bits ÷ 9600 bit/s ≈ 21 ms.
  • Motion blur: 500 mm/s × 50 µs = 0.025 mm, a tenth of a 0.25 mm narrow module, the smallest Code 128 width commonly specified.
  • Budget: 20 + 17 + 21 + 10 = 68 ms, leaving 200 − 68 = 132 ms of margin.
Stage Time Basis
Sensor switch + trigger latency 20 ms allowance
Exposure + decode 17 ms 1000 ms ÷ 60 codes/s
Serial transmit 21 ms 20 chars × 10 bits ÷ 9600 bit/s
Controller scan + latch 10 ms allowance
Total 68 ms against a 200 ms window

The decision: at 0.5 m/s the design passes with 132 ms to spare, two thirds of the window. Window and speed scale together: at 1 m/s the window is 100 ms and the margin thins to 32 ms, still workable. The budget stops fitting when the window reaches 68 ms, which happens at 100 mm ÷ 0.068 s ≈ 1.5 m/s. Past about 1.4 m/s on this pitch, move the string to 19200 bit/s — 200 bits ÷ 19200 bit/s ≈ 10 ms, saving 11 ms — or trim the payload, before suspecting the reader. Decode speed is not the constraint at these speeds; the pacing of trigger and latch is.

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

Trigger sources compared

Four ways to fire an inline reader, and when each is right:

Trigger source Fires One string per part Use when Watch out for
Photoelectric presence sensor Each part's edge Yes, by construction Fixed pitch with gaps between parts Tilted or low parts that duck the beam
Continuous (free-run) read Whenever a code is in view No, dedupe needed Irregular pitch, several codes per carrier Repeat reports of the same code
Host or robot command When the controller asks Yes Robot cells, keyed read requests Command round-trip adds latency
Encoder-gated At fixed distance intervals Close to yes Varying speed, fixed spacing Counts drift without a home position

A presence sensor is the default on a pitched conveyor: it costs little, fires on the part itself, and makes the one-string-per-part mapping physical rather than logical. The reader-side mode that consumes the pulse lives in its trigger configuration; the guide to fixed barcode reader trigger modes compares sensor, serial and free-run modes and how each reports a result.

Wiring decides whether the pulse arrives at all. Sensors come with PNP or NPN output stages that connect differently to reader inputs; the photoelectric sensor to camera trigger wiring guide shows both, and why trigger pulse width sets your camera exposure time explains what a too-short or too-long pulse does. Sequence sensor, reader and any reject gate as the machine vision trigger timing guide lays out, before you bolt anything down.

For a close trigger point at the belt edge, a diffuse-reflective sensor such as the MV-PE5502 (10–350 mm, settable distance, Red LED, NPN output) watches the part itself, with no reflector to keep aligned.

Photoelectric sensorsHikrobot MV-PE5502 Diffuse-reflective sensor(10-350mm, Red LED, settable distance, NPN)MV-PE5502
Output
NPN
Light source
Red LED
Sensing range
100 mm - 1 m
Type
Diffuse-reflective
$49.00 · quotedView and quoteBuild a system with it

Sort the trigger side by sensing range and output type in the trigger sensor finder.

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 trigger sensor

Serial settings are a contract between reader and controller: baud rate, data bits, parity, stop bits and the end-of-string character must match at both ends or the payload arrives garbled or truncated. Start from 9600 bit/s, 8N1 and a CR terminator, and write the agreed set into the I/O list so a later module swap cannot drift it. RS232 carries a single reader comfortably at these rates up to roughly 15 m; longer runs, or several readers on one pair, belong on RS485.

Then run the same routine for every part: the reader decodes, asserts its read-complete output and transmits the string; the controller latches the buffer on the terminator or that output; then it clears the receive buffer and re-arms before the next trigger. The failure everyone meets is the string that arrives and vanishes before the next scan reads it — why the string disappears after one PLC scan shows how to hold it, and storing ASCII barcode strings in PLC memory covers how the bytes sit in memory afterwards.

Insist on a discrete read-complete output wired to a controller input: it separates the claim that data is valid from the data itself, and gives the latch a clean edge instead of a guess. The RS232 ASCII string wiring guide and the barcode reader PLC communication plan cover the two halves of that connection, and reading barcode reader data into PLC string tags shows how received bytes become typed string data on the controller side.

If the port stays silent, work the faults in order: wiring and shield grounds first, then framing, then handshake. The barcode reader data not reading: PLC-side fixes page lists the usual culprits exactly that way.

Run trigger and serial wiring in shielded, drag-chain-rated cable on anything that moves; the cables range splits by type, length and connector. The LS-CBL-0300 is an M8 8-pin male-to-open, 8-core power and I/O cable, 7 m, built for drag-chain duty.

CablesCamera Power and I/O Cable, M8 8-pin connector, Male to Open end (8-core), 7 m, drag-chain use (LS-CBL-0300)LS-CBL-0300
Type
Power and I/O cables
Length
6-8 m
$79.00View partBuild a system with it

Choosing the reader and trigger hardware

Start from reading distance. For short, fixed distances the LS-CRD-0047 reads at 60–120 mm, with a 1.2 MP sensor over USB 2.0 — the compact choice for bench cells and tight enclosures.

Fixed code readersCompact fixed industrial barcode reader, 1.2 MP, USB 2.0, 60-120 mm reading distance (LS-CRD-0047)LS-CRD-0047
Resolution
Up to 3 MP
Shutter
Global
Interface
USB
$559.00View part

Further out, let the lens set the field: cover roughly twice the code length at the code plane and no more. The MV-ID3013PM-12M-WBN pairs a 12 mm focal length with a 1.3 MP sensor on Fast Ethernet and an M12 mount, in a compact housing that bolts into tight frames.

Fixed code readersHikrobot MV-ID3013PM-12M-WBN 12mm focal length 1.3 MP Compact Industrial Code ReaderMV-ID3013PM-12M-WBN
Interface
Fast Ethernet
Resolution
Up to 3 MP
Shutter
Global
Lens mount
M12
$1,979.00View part

Then shrink the decode region to the strip where codes actually pass; the ROI guide for inline code reading shows the speed and stability that buys. Check read-rate headroom too: the line asks for speed ÷ pitch reads per second — 500 mm/s ÷ 100 mm = 5 parts/s on the example line — and a reader rated in tens of codes per second clears that with an order of magnitude to spare. When the line runs ten times faster, the high speed conveyor barcode reading guide covers what changes. The fixed code readers range sorts by interface, resolution and mount, and the Code 128 module size guide ties code width to reading distance.

Checks before you order

  • Compute your own window, pitch ÷ speed, and write it on the drawing; every other number hangs off it.
  • Rebuild the budget with your string length and baud rate, and keep at least a third of the window as margin.
  • Multiply line speed by your chosen exposure to get blur, and keep it under a quarter of the narrow module width.
  • Rate the reader at twice your parts-per-second so decode time never becomes the constraint.
  • Agree serial settings and terminator at both ends, and put them in the I/O list.
  • Plan the latch: read-complete input clocks the string into a holding tag, then the buffer clears before re-arm.
  • Choose shielded, drag-chain-rated cable for any run that moves, with the shield grounded at one end.

When the usual answer is wrong

  • Parts butt together with no gaps: a presence sensor sees one endless part and fires once per batch. Switch to encoder-gated reads at fixed distance intervals — the encoder trigger distance guide sets the spacing without faults — or run continuous with the dedupe window from the first FAQ.
  • Clear, mirrored or black packaging defeats a diffuse sensor: move to a through-beam pair across the belt, or trigger from a machine event such as a filler valve or pusher stroke.
  • The code itself is the problem, not the timing: on shiny or curved packaging, fix the lighting before touching trigger logic — the QR codes on reflective and curved surfaces guide explains what changes.
  • Several codes ride one carrier: free-run the reader and map each string by its position in the field; part position and barcode reading in one image shows the mapping.

The one-line decision: sensor-trigger when pitch is honest, continuous when presentation is not, and let the window calculation say how fast the serial side must be. Size your window, budget the chain, then choose the parts — and if you send pitch, speed and code size through the contact page, we will check the budget against your line before you order. More trigger and timing pieces sit on the code-reading topic page.

Questions

Do I need a trigger sensor if the reader reads continuously anyway?

Not strictly, but continuous reading reports the same code again for as long as it stays in the field. Dedupe instead: ignore repeats of an identical string for one field-transit time, field length divided by speed — a 200 mm field at 500 mm/s means 400 ms of silence per code. On a pitched line a presence sensor is simpler: one trigger, one string, no dedupe logic. Reserve continuous reading for irregular pitch or several codes per part.

Which serial settings must match between reader and PLC port?

Baud rate, data bits, parity, stop bits and the end-of-string character, set identically at both ends. Start from 9600 bit/s, 8 data bits, no parity, one stop bit, with a CR terminator. A mismatch rarely fails silently: you get truncated or garbled payloads that look like plausible junk, so write the agreed set into the I/O list and re-check it after any module or firmware change.

How much motion blur can a barcode tolerate at line speed?

Keep blur under roughly a quarter of the narrow module width; beyond that, first-read rate drops quickly. Exposure limit = 0.25 × module width ÷ speed. For 0.25 mm modules at 500 mm/s: 0.0625 mm ÷ 500 mm/s = 125 µs. The worked example's 50 µs sits well inside it. Shorter exposures need more light, so check the illumination budget before shaving the exposure further.

Should the trigger fire on the part's leading or trailing edge?

Leading edge, so the read window runs a full pitch. Trailing-edge triggering gives up the part length: a 70 mm part on a 100 mm pitch at 0.5 m/s drops the window from 200 ms to 30 mm ÷ 500 mm/s = 60 ms. Leading-edge triggering also starts the attempt as early as possible, which matters when the code sits near the back of the part.

Is RS232 or RS485 the better link for an inline reader?

RS232 for a single reader within about 15 m of the controller port: it is the default interface on industrial code readers and needs no termination or addressing. Choose RS485 when the run is longer or several readers share one port in multidrop. Either way, keep trigger wiring physically separate from the serial pair, run both in shielded cable, and ground the shield at one end only.