To connect an MES to a PLC, choose a route (OPC UA, a protocol driver, or a gateway sending MQTT), agree a written tag list with the controls team, start read-only, and prove the data against a hand count. Add writes such as order download only later, with a handshake built into the PLC program.
The project is mostly agreement between people
The technical link is often the quick part. The slow part is getting production, controls and IT to agree what each bit means and who may change it.
Which signals to read is covered in PLC signals for OEE. This page covers how to run the integration from there.
Pick a route
| Route | Fits when | Watch for |
|---|---|---|
| OPC UA | The PLC or a gateway has a server. TCP port 4840 is registered, but check the device | Certificates, granted sampling rates |
| Modbus TCP or RTU | Older PLCs, drives, counters. TCP port 502 | Classic form has no login or encryption; register maps; word order of 32-bit values |
| Siemens S7 driver | S7 PLCs where OPC UA is not in use. TCP port 102 | S7-1200 and 1500 usually need PUT/GET access on and optimized access off on the blocks read, so agree that with controls first |
| EtherNet/IP | Controllers that use CIP over standard Ethernet. Port 44818 is registered for messaging, which tag reads normally use | Needs a driver or gateway that speaks it |
| Gateway sending MQTT | Mixed machines, several sites, cloud systems. TCP port 8883 is registered for secure MQTT | Topic and payload rules; Sparkplug, published as ISO/IEC 20237, defines one set |
| External sensors | No PLC, or no access to it | Fewer signals, fault codes not available |
Drivers for Modbus, S7 and EtherNet/IP tag reads usually poll, so a pulse between two reads is lost. Read totals and latched bits instead, and see OPC UA integration for how subscriptions differ.
A shared driver library is one more option if you build your own. Apache PLC4X is an open source set of libraries for talking to PLCs through one API.
Write the tag list before anyone connects
This one document prevents most arguments later. It belongs to the controls team, and the MES team checks it against each machine.
| Tag (made up) | Type | Meaning | Reset rule | Owner |
|---|---|---|---|---|
| L3_Producing | Bit | 1 = auto mode and infeed running | None | Controls |
| L3_GoodTotal | 32-bit | Parts past the reject station | Never, rolls over | Controls |
| L3_Fault | 16-bit | First fault code, 0 = none | Clears on reset | Controls |
| L3_OrderId | 32-bit | Order loaded on the HMI | At next order | Production |
Where machines come from one builder, ask for one set of tags across all of them. Across builders, the PackML guidelines from OMAC, adopted by ISA as ISA-TR88.00.02, aim at a common look and feel on the plant floor.
Check the load on the controller
A busy PLC has a job to do, and its communication load matters to the controls team. How you read often matters more than what you read.
Group tags into blocks where the protocol allows it, and read slow values less often. Then ask the controls team to watch scan time and communication load during the first shift.
Stay read-only as long as you can
Reading alone can deliver stops, counts and OEE. That first phase carries little risk to the machine, and it builds trust in the data.
Enforce it, instead of just promising it. Use a read-only user where the protocol has users, or a gateway set to read functions only, and give the link its own path through the network.
When the MES must write, use a handshake
Order download and recipe selection are the usual reasons to write. The MES should never set outputs directly, and the PLC program keeps the final say.
It writes order ID and recipe number to a small area kept only for this.
A single bit says that new data is waiting.
Is the machine idle? Is the recipe known? It copies the data only if both are true.
The MES shows the result to the operator.
The bits clear in order. No answer in the agreed time raises an alert.
Safety functions stay outside all of this. Nothing from the MES should ever bypass a safety circuit or a guard.
Plan for the bad days
- Network gap: keep a running total in the PLC or gateway, so counts catch up after the gap.
- PLC program download: tags can move. Agree a change note, and retest after each download.
- Clock drift: time-stamp at one place, and sync it.
- Replaced PLC: keep the tag list and connection settings with the machine's documents.
- Unknown state: if data stops, show unknown time instead of running.
Prove it on the floor
Run one shift with a person watching, and write down each stop and a hand count. Set your pass limits before the test, so no one argues afterwards.
| Check | Watcher | System | Our limit | Result |
|---|---|---|---|---|
| Good count | 4,812 | 4,806 | Within 0.5% | 0.12%, pass |
| Stops seen | 24 | 23 | All | 1 missed, find out why |
| Fault codes mapped | 9 | 9 | All | Pass |
| Stop minutes | 52 | 51 | Within 2 min | Pass |
The missed stop is the valuable find. It often points to a read interval that is too slow, or to a stop threshold set too long.
Signs the integration is in trouble
- Counts drift a little each day. Check rollover, resets at order change and where the sensor sits.
- Operators say the screen is wrong. They are usually right, so go and watch.
- Only one person understands the mapping. Keep the tag list where others can find it.
Who does what
- Controls: tag list, safe read path, any PLC changes.
- IT: network path, firewall rule, certificates.
- Production: what counts as a stop, and reason lists.
- MES team: mapping, state rules, the floor test.
Start with one machine, and copy the pattern when it passes. Connect old machines covers those with no usable PLC.
A clean connection is the start, and each stop still needs a cause. Fabrico is a light MES for OEE that takes stops, speed and counts live from PLCs or IoT sensors (external sensors on older machines), and operators tag the cause at the line. See how Fabrico reads machine data.
What people ask next
How does an MES communicate with a PLC?
Usually through OPC UA, a protocol driver such as Modbus, or a gateway that reads the PLC and sends the data on, often over MQTT. The MES reads tags, and the PLC keeps controlling the machine. See IIoT gateway for the middle option.
Will connecting an MES slow down my PLC?
A sensible read rate through an agreed path normally should not cause trouble, but heavy polling on a busy PLC can. Use block reads, read slow values less often, and have controls watch the load. PLC signals for OEE covers read rates.
Do I need to change the PLC program?
Not always. If a good total and a producing state already exist, you can read them as they are, though many plants add a small data block to keep tags stable. Writes from the MES do need program changes.
Can an MES work with PLCs from different brands?
Yes, usually through OPC UA or a gateway with several drivers. Keep the MES fields the same, and map each machine to them. Line OEE vs machine OEE helps when mixed machines form one line.
Should an MES connect to the PLC or to SCADA?
Either can work. Reading from SCADA means fewer connections if it already holds the tags, but you depend on its update rate and upkeep. See MES vs HMI for how the layers differ.
Fabrico is a light MES for OEE. It takes stops, speed and counts from PLCs or IoT sensors, with add-on AI cameras counting output where a machine has no usable signal, and operators tag the cause at the line.