Test engineeringTest engineering
Integrating visual inspection into the line: PLC connection, ejection and traceability
A visual inspection in the line is only as good as its integration. The PLC must assign the correct result to every part, the result must be available before the ejector, and every NOK part must verifiably leave the line. If a result is missing, the part counts as NOK. Inspection image and result are stored with the part number.
Selected customers
What matters when a visual inspection is added to the line?
Camera, lighting and evaluation decide whether a defect is detected. The integration decides whether the detected part is actually rejected. Four points carry this:
- Unique signals: the PLC assigns every result to exactly one part.
- Time budget: the result is available before the part reaches the ejector.
- Safe ejection: no result counts as NOK, and a check confirms that the part has left the line.
- Traceability: inspection image, result and recipe are stored with the part number.
These points apply to new lines just as much as to retrofitting an inspection into an existing plant.

Which signals do the inspection system and the PLC exchange?
A handshake runs between inspection system and PLC: each side reports what it has done before the other continues. These signals are common:
| Signal | Direction | Meaning |
|---|---|---|
| Ready | inspection system to PLC | inspection system is switched on, recipe loaded, no fault |
| Recipe number | PLC to inspection system | which type comes next |
| Recipe acknowledged | inspection system to PLC | loaded recipe, for comparison with the target |
| Trigger | PLC or sensor to inspection system | part is in position, start image capture |
| Part number | PLC to inspection system | code or serial number to which the result is linked |
| Image captured | inspection system to PLC | image is captured, part may move on |
| Result valid | inspection system to PLC | result for exactly this part is available |
| OK / NOK | inspection system to PLC | inspection decision, evaluate only together with result valid |
| Error code | inspection system to PLC | which characteristic is NOK, for display and statistics |
Trigger and result often run over digital inputs and outputs because this is fast and simple. Recipe number, part number and error code go to the PLC over a fieldbus or a network connection. Inspection data for MES or ERP usually runs separately over a database or OPC UA connection.
Three rules for the PLC
- A result is only evaluated if result valid is set for this part. A remaining OK from the previous part must not count.
- If the result does not arrive within the defined time, the part counts as NOK.
- The PLC compares the acknowledged recipe with the expected type. If they differ, the line does not continue.
We also take over the programming on the PLC side if you wish. More on this under PLC and SCADA programming.
How much time does the evaluation have before the part reaches the ejector?
Between image capture and ejector the part travels a fixed distance. Evaluation, communication and the switching time of the ejector must fit into this time.
tA + tC + tS ≤ sv
- tA
- time for image capture and evaluation in s
- tC
- time for transmitting the result and the PLC cycle in s
- tS
- switching time of the ejector until it acts on the part in s
- s
- distance from the capture position to the ejector in m
- v
- belt speed in m/s
Example: The ejector is 0.6 m after the camera, the belt runs at 0.4 m/s. The part needs 1.5 s to get there. With 0.1 s switching time and 0.05 s for communication, 1.35 s remain for image capture and evaluation. All values are example values.
Calculate with the longest evaluation time, not with the mean. If the distance is not sufficient, extend it, reduce the speed or separate image capture and evaluation in time: the part moves on after image captured, the result follows later.
Part tracking up to the ejector
If several parts lie between camera and ejector, the PLC must assign the results in the correct order.
N = sa
- N
- parts between camera and ejector at the same time
- s
- distance from camera to ejector in m
- a
- spacing of the parts on the belt in m
Example: With a distance of 0.6 m and a part spacing of 0.15 m, four parts are on their way. The PLC keeps a list in which every result travels with its part.
With a fixed part spacing a shift register that moves on with every part is sufficient. With varying spacing the PLC tracks the position with a rotary encoder on the belt or with a second sensor shortly before the ejector. Otherwise, if a part is removed by hand, the assignment shifts for all following parts.
How do you make sure that every NOK part leaves the line?
The type of ejector depends on part, cycle time and sensitivity:
| Ejector | Suitable for | Points to note |
|---|---|---|
| Pusher | stable parts with a flat base | switching time, space next to the belt |
| Air nozzle | light parts at high cycle rates | compressed air, scatter of the trajectory |
| Diverter or flap | parts that must not be pushed | switching time, gap between the parts |
| Gripper or delta picker | sensitive parts, sorting into several classes | cycle time of the robot |
Reject check
The fact that the ejector has switched does not mean that the part is out. A sensor in the reject path or at the bin confirms every NOK part. If the confirmation is missing, the line stops or reports a fault. A second sensor after the ejector checks that no NOK part arrives there.
- Design the bin for NOK parts so that parts cannot return to the line unnoticed, for example covered or locked.
- Eject a recheck class separately if parts close to the limit are evaluated by hand.
- Consider faults, emergency stop and power failure: parts that lie between camera and ejector on restart count as not inspected.
The ejector is a moving part of the line. It belongs in the risk assessment and, if necessary, behind a guard.
Which inspection data should be stored for each part?
For traceability and complaints, store for each part: part number or code, time, recipe and recipe version, result per characteristic, error code, the version of the evaluation model and the inspection image. Where traceability is required, ISO 9001 section 8.5.2 requires the identification of outputs and the retention of the necessary information.
M = z · b · m · T
- M
- storage requirement in MB
- z
- parts per day
- b
- images per part
- m
- size of one image in MB
- T
- retention period in days
Example: 10,000 parts per day, two images per part, 5 MB per image as with 5 megapixels in monochrome at 8 bit uncompressed, 90 days retention: this gives 9,000,000 MB, or about 9 TB.
This is why it pays to differentiate: store NOK images completely, OK images with low-loss compression or as a sample, result data always. Define retention period and storage location in advance with your quality department and IT.
With the NIKLAS Vision Check, inspection image and inspection data are documented for each part and can be passed on to the next process. How results get into the inspection report and the ERP is described on the NIKLAS test software page.
How do you test the integration during commissioning?
Test the whole chain from image capture to the bin for NOK parts. These tests belong in the commissioning report:
- Send reference reject parts through the line in different positions: each must arrive in the NOK bin.
- Several reject parts directly one after the other and mixed with good parts: the assignment must be correct.
- Disconnect camera or network: the parts must count as NOK, the line must react.
- Specify a wrong recipe: the PLC must detect the difference.
- Block the reject path: the missing confirmation must trigger a fault.
- Emergency stop and restart with parts on the belt: parts not inspected must not pass as OK.
In operation, run a reference reject part through regularly, for example at the start of each shift. This checks detection and ejection in one pass. How to design and accept the detection itself is described in the article AI visual inspection in final inspection.
Frequently asked questions about integrating a visual inspection
Short answers for production, maintenance and automation.
Can a visual inspection be retrofitted into an existing line?
Yes, if installation space, feeding and cycle time fit and the PLC can be extended with the signals and the part tracking. We check this on site and on your sample parts.
What happens if the camera fails?
If the result does not arrive, the part counts as NOK. The PLC detects the failure via the ready signal and a timeout and stops the line or reports a fault.
Who programs the PLC side?
Either your team according to our interface description, or we do. We also program the PLC side and commission the whole chain with you.
How long should inspection images be kept?
You define this with your quality department and your customer. What matters is how long complaints are to be expected. Result data needs little space, images a lot.
Does every part need a code?
For assignment within the line a serial number in the PLC is sufficient. For traceability beyond the line the part or its load carrier needs a marking, for example a 2D code.
How do you prevent NOK parts from returning to the line?
With a reject check by sensor, a second sensor after the ejector and a bin from which parts cannot be put back unnoticed.
More technical articles
Test engineering
Test engineeringSurge testing
Resonant circuit, test voltage to EASA AR100 and IEEE 522, error area ratio EAR, procedure and buying criteria: how the surge test finds interturn faults that other measurements miss.
Test engineeringPump testing ISO 9906
Tolerances of grades 1B, 2B and 3B, head and efficiency with a worked example, measurement uncertainty, NPSH3 and test procedure: how a pump test to DIN EN ISO 9906 runs on the test bench.Integrate visual inspection
Tell us the component, cycle time, control system and what is to be inspected. We will get back to you with an initial assessment of inspection station, ejection and connection.

Simon Niklas
Mechanical engineer, M.Sc.
+49 941 56956720[email protected]
“Good engineering proves itself in day-to-day production. That is why we combine technical planning with a close understanding of process, operation and maintenance.”
Book a consultation