Code readingGuide

Inline traceability validation: connect codes, OCR and rejects

Plan inline traceability validation that compares codes, OCR and production records, tracks each part, confirms rejects and stores useful audit data.

LumaSpec Vision11 min read Share on LinkedIn

On this page 10 sections
  1. 01Define what a valid part must prove
  2. 02Establish an image budget before an algorithm budget
  3. 03Choose the architecture by verified functions
  4. 04Calculate both throughput and the decision deadline
  5. 05Keep one transaction attached to each physical part
  6. 06Distinguish reading failures from validation failures
  7. 07Log evidence without blocking the inspection path
  8. 08Challenge the full chain before acceptance
  9. 09Check the exceptions before ordering
  10. 10Questions

A readable barcode does not prove that the correct label reached the correct product. The printed serial number may disagree with the encoded value, the production record may belong to another order, or the reject command may reach the wrong part. For an inline inspection station, these are separate failure modes. Start by defining the validation contract and part identity, then choose the processing architecture. You can then size the timing budget, handle uncertain readings and verify the physical response.

Define what a valid part must prove

Inline traceability validation should answer three questions: what was read, whether it was expected, and what happened to the part. Keep those answers separate so a successful decode cannot hide an incomplete production transaction.

Define the required fields before selecting hardware. A label might contain an encoded serial number, human-readable serial text, a lot identifier and a date. State which fields must match exactly and which must follow a documented transformation.

For example, a barcode may encode a complete identifier while the printed text contains only its serial component. Parse the barcode into named fields before comparison. Do not compare an arbitrary substring simply because it matches the current sample.

A useful decision contract requires all of the following:

  • The expected number of codes and text regions is present.
  • Barcode and OCR fields satisfy their required formats.
  • Corresponding fields agree under approved comparison rules.
  • The production record authorizes that identity for the active order.
  • The decision belongs to the correct physical part and recipe revision.
  • The commanded disposition receives the required confirmation.

Define whitespace, letter case, leading zeros and date interpretation explicitly. Never automatically substitute similar-looking characters to make a serial number pass.

This extends matching codes to similar assemblies by adding text agreement, record authorization and disposition confirmation. For the earlier image-to-data stages, use the decoding and data-validation workflow.

Establish an image budget before an algorithm budget

Barcode decoding and OCR do not necessarily need the same image conditions. A code can remain readable while small printed characters lose critical strokes. Capture both regions with adequate sampling, contrast and focus across the permitted part positions.

For an initial sizing estimate, relate the inspection width to the smallest barcode module:

Required horizontal pixels = inspection width / module width × target pixels per module

Suppose the inspection width is 120 mm and the smallest module is 0.25 mm. An initial target of 4 pixels per module gives:

Required horizontal pixels = 120 / 0.25 × 4 = 1920 pixels Object sampling = 120 / 1920 = 0.0625 mm/pixel

This is a starting estimate, not a decoding guarantee. Symbol type, damage, blur and the selected decoder affect the practical requirement. Validate OCR separately using the smallest characters and thinnest strokes in representative production samples.

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

The inspection field must include the complete code, its quiet zones, the required text and their allowed placement variation. Increasing coverage without increasing pixel count reduces sampling everywhere.

How sensor width, working distance and field of view set the focal length Rays from the edges of the sensor pass through the lens and spread to the edges of the field of view. The ratio of sensor width to field of view is the magnification m.CameraField of view (FOV)Working distance (WD)≈ fsensor width slensm = s / FOVf = WD × m / (1 + m)
How sensor width, working distance and field of view set the focal length. Rays from the edges of the sensor pass through the lens and spread to the edges of the field of view. The ratio of sensor width to field of view is the magnification m.

Motion adds another limit. At 500 mm/s, the example sampling permits an exposure of approximately 125 microseconds for one pixel of object travel:

Exposure limit = allowable object travel / object speed Exposure limit = 0.0625 mm / 500 mm/s Exposure limit = 0.000125 s = 125 microseconds

This calculation covers motion blur only; available light and sensor response still determine usable contrast. Check real moving samples rather than relying on stationary commissioning images. If readability changes with presentation, the rotation, blur and glare preprocessing guide helps separate image problems from validation logic.

Choose the architecture by verified functions

Choose an architecture only after listing the required decoding, OCR, comparison, communication and logging functions. On-device processing can remove image-transfer stages, but it does not automatically provide the required OCR tools, database access or result-association behavior.

Architecture Choose it when Confirm before ordering
Smart camera with validated inspection tools Acquisition, reading and local decisions fit within the device's supported workflow Required OCR and decoding tools, software licenses, record interface, timing and logging behavior
Fixed code reader with a separate OCR path Barcode capture benefits from a dedicated device, while text needs another image or processor Shared part identity, trigger association, supported data output and combined decision ownership
Camera or reader system with a vision controller Multiple acquisitions, record handling or coordinated decisions require separate processing Camera compatibility, licensed tools, processing capacity, communication behavior and recovery procedures

Browse smart cameras and vision sensors when local processing is a candidate. The LS-SMC-0063 is a GigE smart camera. Its listing alone does not establish support for your complete validation workflow; confirm the required tools and interfaces before selection.

Smart cameras & vision sensors1.6 MP smart camera, 60 fps, 16 mm lens, white light (polarized, transparent light) (LS-SMC-0063)LS-SMC-0063
Interface
GigE
Resolution
Up to 3 MP
$1,110.00View part

Consider fixed code readers when a dedicated barcode acquisition path fits the task. The LS-CRD-0028 has a Global shutter and Fast Ethernet interface. Confirm how decoded data, no-read status and trigger identity can be delivered to the decision owner.

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

For a separate processing architecture, review vision controllers. The MV-VC2140-128G40-1T is a vision controller with 8 GB memory. Confirm camera support, software licensing and application performance rather than inferring them from memory capacity.

Vision controllersHikrobot MV-VC2140-128G40-1T VC2100 Vision Controller, N97, 8GB+128G SSD+ 1THDDMV-VC2140-128G40-1T
LAN ports
3-4 LAN ports
USB 3 ports
2 USB 3 ports
Light outputs
4 built-in channels
Memory
8 GB
$1,679.00View partBuild a system with it

Use the camera finder to narrow acquisition candidates. The standalone controller selection guide explains the separate processing decision in more detail.

Calculate both throughput and the decision deadline

Throughput asks how often a new part arrives. The decision deadline asks how long the station has to act on a particular part. A system can satisfy one requirement and fail the other.

Consider a hypothetical line running at 500 mm/s with 100 mm between part triggers:

Part interval = pitch / speed = 100 / 500 = 0.2 s Arrival rate = 1 / 0.2 = 5 parts/s

If the reject point is 600 mm downstream, nominal travel time is:

Travel time = distance / speed = 600 / 500 = 1.2 s

Reserve time for the actuator, communication uncertainty and an engineering margin. Illustrative allowances of 80 ms, 40 ms and 100 ms leave:

Decision deadline = 1200 - 80 - 40 - 100 = 980 ms

The deadline does not mean processing can consume that entire period for every arriving part. In a simple serial processing path, a measured 160 ms service time would occupy 80% of the 200 ms arrival interval. That leaves only 40 ms for additional work before the next arrival.

Measure end-to-end behavior with OCR, record lookup and logging enabled. Include difficult images, communication retries and startup conditions. If a remote lookup cannot finish within a bounded interval, define a deadline response rather than allowing indefinite waiting.

At the example rate, nominal occupancy between acquisition and rejection is 5 × 1.2 = 6 parts. Tracking capacity must accommodate that occupancy plus applicable buffering, position variation and recovery needs.

Keep one transaction attached to each physical part

Create a station transaction identifier when the part is detected, before its barcode is known. The barcode cannot be the only tracking key because unreadable and duplicate codes must also remain traceable.

A practical transaction contains the trigger identifier, acquisition time, conveyor position where available, recipe revision and expected record reference. Attach barcode and OCR outputs to that transaction, not to a global variable holding the latest reading.

Use explicit states such as acquired, read complete, validated, disposition pending and disposition confirmed. Store a reason code alongside the state. For example, a transaction can be complete as an inspection while still awaiting physical rejection.

When barcode and OCR processing finish independently, join their outputs by the transaction identifier. Do not assume the next returned message belongs to the next physical part. The timestamp and frame-matching guide addresses this association problem.

Variable-speed conveyors generally need position-based tracking or another validated part-association method. A fixed delay derived from nominal speed is not sufficient when the conveyor stops, accelerates or permits part slip.

After a restart, do not reuse uncertain tracking entries. Define how parts already between acquisition and rejection are held, removed or reinspected. Resume automatic acceptance only after the physical population and logical records agree.

Distinguish reading failures from validation failures

A single pass/fail bit can drive a simple interface, but it should not be the only stored explanation. Different failure classes need different corrective actions.

Condition Meaning Defined response
Barcode no-read No acceptable decoded value was obtained Hold or reject according to the approved production rule
OCR unreadable Required text could not be read reliably Treat the missing evidence as unresolved, not as agreement
Barcode–text mismatch Both values exist but disagree Reject or hold and preserve both values
Unexpected production identity The observed value is not authorized for the active record Hold or reject without replacing the observed identity
Duplicate serial An identity already exists within the defined uniqueness scope Apply the documented duplicate and rework policy
Record service unavailable Authorization could not be established Use the approved offline policy or hold production
Reject unconfirmed A command was issued without required physical confirmation Escalate the quality-control fault and reconcile affected parts

A retry is acceptable only when its result remains associated with the same part and arrives before the deadline. Retrying until something passes can conceal intermittent printing defects or select another visible label.

Define duplicate scope carefully. A retry of the same transaction is not automatically a second manufactured item. Conversely, two physical parts carrying the same serial must not collapse into one record because their identifiers match.

Reject confirmation must verify the intended physical event, not merely acknowledge receipt of the output command. Define how missing confirmation, an unexpected reject event and loss of tracking affect subsequent production. The inspection-routing workflow provides related routing considerations.

Quality rejection is not a substitute for a machine's personnel-safety functions. Keep the quality response and the machine's safety design distinct.

Log evidence without blocking the inspection path

Store the observed values, expected values, comparison outcome and final disposition as distinct fields. Preserve raw OCR text and decoded data alongside any approved normalized versions. Otherwise, later investigation may show only the transformed value that made the comparison pass.

A useful audit record includes:

  • Station transaction identifier and acquisition timestamp.
  • Barcode payload, OCR text and explicit read statuses.
  • Expected record identifier and active recipe revision.
  • Validation outcome, reason code and decision timestamp.
  • Disposition command, confirmation and associated timestamps.
  • References to retained images and any authorized reinspection record.

Use bounded logging queues and define what happens when storage is unavailable. Moving logging into another task prevents direct blocking only while that task and its queue can keep up.

For a storage estimate, suppose two retained images total 800 kB per part. At 5 parts/s, using decimal units:

Image data rate = 800 kB × 5 = 4000 kB/s = 4 MB/s Hourly image volume = 4 MB/s × 3600 s = 14.4 GB

Actual encoded image sizes vary with content and compression settings. Measure representative files before setting retention periods. Include transfer backlog and recovery time in the capacity plan.

The inspection image archiving workflow covers the separation between inspection decisions and archive transfers. Keep local transaction identifiers in the archive index so delayed uploads cannot associate an image with a later part.

Challenge the full chain before acceptance

Test from physical arrival through recorded disposition, not just from an image file through a decoder. Establish acceptance criteria for false acceptance, false rejection, no-reads, deadline misses and missing records before the trial.

Use deliberately constructed challenge cases alongside representative production samples:

  1. Present an authorized barcode with matching text and confirm acceptance against the correct record.
  2. Change the text while preserving a readable barcode and confirm a mismatch decision.
  3. Present matching barcode and text from the wrong order and confirm record-based rejection.
  4. Remove either reading region and verify that missing evidence cannot become a pass.
  5. Repeat a serial on another physical part and check the duplicate policy.
  6. Delay a lookup beyond its deadline and verify the defined hold or reject response.
  7. Interrupt logging and confirm the bounded-queue and storage-fault behavior.
  8. Stop and restart the conveyor with parts in flight, then reconcile tracking before resuming.
  9. Prevent reject confirmation during a controlled commissioning test and verify the approved quality-fault response.

Perform physical response tests under the machine's approved commissioning procedures. Do not defeat safety functions to create a test condition.

For each challenge, retain the transaction record and evidence showing the actual response. Zero observed errors in a limited trial do not prove a zero-error process; document the sample population and its limits.

Check the exceptions before ordering

The compact on-device approach is not always the right answer. Separate views may be necessary when the barcode and text face different directions. A controller may be appropriate when record handling or multi-camera association exceeds the verified capabilities of the inspection device.

Conversely, a separate controller adds little value if an existing validated device already provides every required function with adequate timing margin. Choose from the demonstrated workflow, not from the presence of an AI label or a higher pixel count.

Before ordering, close this checklist:

  • Confirm reading performance on the smallest code and text under permitted motion and presentation changes.
  • Verify every required inspection tool, software license and communication interface.
  • Assign one owner for part identity, validation decisions and disposition tracking.
  • Document record-service timeouts, duplicate handling and restart recovery.
  • Establish reject confirmation and affected-part reconciliation rules.
  • Measure processing, storage and queue behavior under the complete workload.
  • Agree on the acceptance dataset and evidence required for handover.

Start the camera configuration workflow once the acquisition requirements are defined. If architecture remains uncertain, send representative images, line timing and the validation contract through application support so the hardware shortlist follows the production task.

Questions

Should barcode data and OCR text always match exactly?

Compare corresponding fields only after defining their formats and permitted transformations. Preserve the original readings, parse structured barcode payloads, and compare the intended fields explicitly. Matching barcode and OCR values still require checking against the authorized production record; agreement alone does not prove the label belongs to the product.

Can a smart camera perform the complete validation workflow?

A smart camera can be suitable when its verified tools cover acquisition, decoding, OCR, comparison, communication and the required evidence handling. Confirm those functions and their licenses for the selected configuration. Test timing with the complete workflow, including record access and error handling, rather than assuming local processing guarantees adequate performance.

How do you prevent rejection of the wrong part?

Assign a transaction identifier at the part trigger and carry it through every reading, decision and disposition message. Track physical position using a method appropriate to conveyor behavior. Acknowledging a reject command confirms communication, while a separate, validated confirmation method establishes whether the intended physical event occurred.

What should happen when the production record service is unavailable?

Use a documented production policy that distinguishes missing authorization from a genuine data mismatch. Possible responses include holding the part, rejecting it, or using an approved local record cache with defined validity limits. Never convert a timed-out lookup into an automatic acceptance merely because barcode and text agree.

What evidence should an inline traceability station retain?

Retain enough evidence to reconstruct the observed identity, expected identity, decision and physical response. Include raw readings, reason codes, recipe revision, transaction identity and disposition confirmation. Image retention can vary by outcome and quality requirements, but storage capacity and logging failures need explicit operating rules.