← cd ..

Cup inspection & sorting station

A SCADA-style station that inspects printed reusable cups with six cameras and tells a Siemens PLC which of ten boxes each cup goes into, within two seconds.

Role
Software engineer, from scratch
Company
Machinify, Budapest
Year
2025
Stack
C# · WPF · TCP/IP · Siemens S7 · Cognex VisionPro
Machine map showing which print pattern goes to which of the ten boxes

The machine map: each print pattern is assigned to a box. Client details removed.

Context

The problem

Reusable cups come off the line with different printed patterns and the occasional defect. Each cup has to be checked from several angles and sent to the right box, at line speed.

The cameras are split across two PCs, so the station needed two PCs that behave like one machine, plus a reliable link to the PLC that moves the cups.

Requirements

NeedTarget
Inspection6 images processed in parallel
LatencyResult and sort signal to the PLC within 2 s
Sorting10 boxes, any pattern to any box
UptimeThe PLC link must survive dropped messages
OperatorsEnglish and Hungarian, switchable while running

Architecture

Two PCs, one machine

Hover or tap any box for a plain-English explanation.

images images TCP/IP sync sort signal ACK / NACK Camerasgroup A Camerasgroup B Main PCWPF HMI · VisionPro Secondary PCsame codebase Siemens S7 PLCACK/NACK + retry Sorter10 boxes
tipHover or tap a box to see what it does and why it's there.

Key decisions

The trade-offs that shaped it

ADR-01One codebase, two roles

Context
Two PCs with two separate apps would double the maintenance and drift apart.
Decision
One app that decides at start-up whether it is main or secondary, from the cameras attached. Every operator action syncs between both over TCP/IP.
Trade-off
A sync protocol to get right; one build to ship and test.

ADR-02Acknowledge every PLC command

Context
A lost sort command means a cup in the wrong box, and nobody notices.
Decision
ACK/NACK on every message, with a retry on NACK or timeout.
Trade-off
A little extra traffic; the link held 99.9% uptime.

ADR-03Keep vision off the UI thread

Context
Six images arrive in parallel; updating the screen from those threads freezes or crashes WPF.
Decision
Vision runs in the background; results are marshalled onto the UI thread through the Dispatcher.
Trade-off
More careful threading code; a responsive screen under full load.

ADR-04Change products without a developer

Context
Products and patterns change often; a code change per product is not workable.
Decision
JSON recipes, drag-and-drop pattern mapping, round-robin for unassigned patterns, and an English ⇄ Hungarian switch with no restart.
Trade-off
More UI to build; operators run new products on their own.

Screens

What the operators use

Client details removed on purpose.

Outcome

Where it landed

6
images processed in parallel
≤2 s
from images to sort signal
99.9%
PLC link uptime
10
output boxes, any pattern to any box
← Back to all work