A practical guide to designing the signal handshake between a line PLC and an end-of-line test station, with Modbus TCP and OPC UA examples, common pitfalls and best practices.
Introduction
An end-of-line (EOL) test station rarely works alone. A PLC moves the part in, clamps the fixture, and waits for a verdict before it releases, reworks or scraps the unit. The link between the PLC and the test PC is often treated as an afterthought: a Start bit, a Pass bit, a Fail bit. That is where many unexplained stoppages, mismatched results and lost traceability begin.
This article explains how to design that interface as a robust handshake, how it maps onto Modbus TCP and OPC UA, and which mistakes to avoid.
Why a few bits are not enough
A minimal interface assumes both sides see every change. In practice, they do not. Modbus TCP is a polled protocol: the client reads registers at its own rate, so a pulse shorter than the poll interval can be missed entirely. OPC UA subscriptions report changes at the sampling interval of each monitored item, so a value that toggles twice between samples can also be lost.
A level-based handshake removes this risk. Each signal stays set until the other side acknowledges it. No information depends on catching an edge.
A typical handshake sequence
A proven pattern uses request/acknowledge pairs in both directions:
- The PLC confirms the part is in position and writes the serial number (and product variant) to the station.
- The PLC sets Start and holds it.
- The test station reads the serial number, sets Busy (acknowledging Start) and begins the sequence.
- The PLC sees Busy and clears Start.
- When the test ends, the station writes the result code and echoes the serial number, then sets Done and clears Busy.
- The PLC checks the echoed serial number against the part in the station, latches the result, and sets Result Ack.
- The station sees Result Ack and clears Done; the PLC clears Result Ack and releases the part.
Alongside the sequence, each side increments a heartbeat counter, typically every 0.5–1 s, and the other side raises an alarm if it stops changing for a defined timeout. That is how a frozen test application is told apart from a long test.

Caption: The seven-step level-based handshake between the line PLC and the EOL test station, with heartbeat, timeouts and traceability. Alt text: Swimlane diagram with a Line PLC lane and a Test station lane; numbered steps 1 to 7 (write serial, set Start, set Busy, clear Start, result with serial echo and Done, check serial and Result Ack, clear Done) connected by arrows along a time axis.
| Signal | Direction | Type | Meaning |
|---|---|---|---|
| Serial number / variant | PLC → Station | String or registers | Identity of the part in the fixture |
| Start | PLC → Station | Bool | Request to test; held until Busy |
| Busy | Station → PLC | Bool | Request accepted, test running |
| Done | Station → PLC | Bool | Result is valid and stable |
| Result code + echoed serial | Station → PLC | Int + string | Pass, fail, or abort reason, tied to the unit |
| Result Ack | PLC → Station | Bool | PLC has latched the result |
| Heartbeat (both ways) | Both | Counter | Liveness check with timeout |
Mapping the handshake to Modbus TCP and OPC UA
Modbus TCP (default port 502) exposes coils and 16-bit registers. Handshake bits are often packed into one holding register as a status word. Strings and 32-bit values span several registers, and the Modbus specification does not define the word order for 32-bit values, so the order must be agreed and tested explicitly. Modbus TCP has no built-in security, so the station should sit on a segmented machine network.
OPC UA (default port 4840 for opc.tcp) exposes typed, named variables in an address space. The PLC or test station can expose a structured interface, and clients subscribe to changes instead of polling. OPC UA also supports methods, so a test can be triggered with a single call that returns an acknowledgement, and it offers signed and encrypted connections with certificate-based authentication. The sampling and publishing intervals still need to be set to match the cycle time.
Whichever protocol you use, the handshake logic stays the same. Only the transport changes.
Common pitfalls
- Edge-only signals. A Start pulse that is shorter than the poll or sampling interval is missed.
- Results without identity. A pass/fail bit without an echoed serial number can be applied to the wrong unit after a manual removal.
- No defined abort path. E-stop, door open or a part removed mid-test must clear the handshake to a known state on both sides.
- Undocumented data layouts. Word order, string encoding and register offsets decided “by trial” break at the next PLC or software update.
- No timeouts. Every waiting state needs a maximum duration and an alarm, or a single missed signal stops the line.
Best practices
- Write one signal table and one state diagram, agreed by both the PLC and test-software teams before coding.
- Use level-based request/acknowledge pairs and a heartbeat in each direction.
- Echo the serial number with every result and store both in the test database.
- Log every handshake transition with a timestamp; it turns “random” stoppages into diagnosable events.
- Simulate the PLC side (for example with a soft PLC or a Python Modbus/OPC UA server) to test aborts and timeouts before commissioning.
How SPEX Technology can help
SPEX Technology builds EOL and functional test systems in LabVIEW and Python and integrates them with line PLCs over Modbus TCP and OPC UA. We define the signal interface, implement the station-side state machine, and connect results to databases and web-based dashboards for traceability and yield analysis. Our services cover Automated Test System Development, System Integration & Industrial Communication, Database and Cloud Data Integration, and Training for engineering teams.
Let’s talk
Building, refining, or integrating test systems and industrial data & AI — Let’s talk.
SPEX Technology, Bangkok, Thailand | Email: suparat@spexth.com | Phone: +66-917265566
