Most plants already have the data an MES needs. The PLC on every machine knows whether it is running, how many good parts it made and how many it rejected. The problem is that the numbers never leave the controller, so someone copies them onto a sheet, and the MES learns about a stop hours after it happened.
This guide shows how to connect a machine with a Modbus TCP PLC to OpenMES, the free, open source MES. No coding and no middleware: you add a connection, tell OpenMES what each register means, start polling, and from then on the machine state, part counts and stops arrive by themselves. The example is a tunnel oven in a bakery, but the steps are the same for a CNC lathe, an injection moulding machine or a packing line.
Watch it first: a machine connected in five minutes
The video goes through every step below on real OpenMES screens, from the empty plant board to a fault that OpenMES logs as downtime on its own.
What you need before you start
- OpenMES 0.29 or newer, installed on your own server or in the cloud. If you do not have it yet, follow the installation guide.
- A machine with a Modbus TCP PLC that the OpenMES server can reach on the plant network, usually on port 502.
- The register map: which register holds the machine state, which ones count good parts and rejects. It comes from the PLC programmer or the machine manual.
- A line and a workstation in OpenMES for the machine, so its data lands in the right place on the plant board and in the reports.
Step 1: Add the Modbus connection
In OpenMES open Connectivity → Modbus and click New connection. Fill in:
- Name: call it after the machine on the floor, for example “Tunnel oven 3”.
- Active: on. OpenMES starts reading the machine as soon as polling runs.
- Host: the PLC address on the plant network, an IP address or a host name.
- Port: 502, the Modbus TCP standard.
- Unit ID: as set in the PLC, usually 1.
- Poll interval: 1000 ms reads the machine once a second, which is enough for state and counters.
- Byte order: leave the default unless the PLC documentation says otherwise.
After saving, the connection shows 0 tags. That is expected: OpenMES knows where the machine is, but not yet what to read.
Step 2: Describe the registers with tags
A tag tells OpenMES what one register means and which workstation it belongs to. In the oven example the PLC exposes four holding registers (4x):
| Register | Signal | What OpenMES does with it |
|---|---|---|
| 40001 | Machine state | A value map translates the numbers: 1 running, 2 idle, 3 fault |
| 40002 | Good parts counter | Works out the increase between two reads and books it as output |
| 40003 | Rejects counter | Same as good parts; together they give the quality part of OEE |
| 40004 | Temperature | A plain reading stored with the machine state |
The key setting on every tag is the workstation. Without it the value has nowhere to go. In the video all four tags are assigned to oven OVEN-03 on the Ovens line.
A tip for the register numbers: PLC manuals mix two conventions, “40001” and a zero-based address “0”. If the values you read look shifted by one register, check which convention your PLC documentation uses.
Step 3: Start polling
Polling runs as a separate background service, so a slow PLC never slows down the screens your operators use. The connection page tells you plainly when polling is not running yet and shows the exact command for your setup. On the OpenMES server, in the install folder, run one of these:
# with Docker
docker compose --profile connectivity up -d modbus-poller
# without Docker
php artisan modbus:poll
To test a single connection once, without leaving the service running, add --once (and --connection= with its name or id) to the second command.
The service starts in about two seconds. Refresh the connection page and you will see Running, a heartbeat from a second ago and the connection status Connected.
Step 4: Watch the machine live
Open the machine monitor: the oven shows RUNNING, the good parts go up every second and the temperature is there. On the plant board every connected machine shows its real state, and stations without a connection say No signal instead of pretending everything is fine.
Step 5: Let the downtime log itself
This is where the connection pays for itself. When the oven faults, OpenMES shows FAULT about a second later, the counter stops and the fault time starts running. On the plant board the oven turns red: stopped, cause not given yet.
Nobody has to type the stop in. OpenMES records it with its duration, the parts lost and the FAULT state. The supervisor only adds the cause, with one click, and the stop goes straight into the downtime and OEE reports. Availability drops by exactly the fault time, so OEE works itself out from real data instead of estimates.
Good practice for Modbus on the shop floor
- Keep Modbus on the OT network. Modbus has no authentication or encryption. Let the OpenMES server reach the PLC, but never expose port 502 outside the plant network.
- Read only what you need. State, good parts and rejects already give you OEE. Add process values such as temperature or pressure when you have a use for them.
- Start with one machine. Connect the bottleneck first, prove the numbers, then repeat the same tags on similar machines.
Not Modbus? MQTT and OPC UA work too
OpenMES also listens to MQTT brokers (a separate mqtt:listen service, set up in the same Connectivity section) and connects to OPC UA servers through its gateway, which tells you why a machine is not connected when something is wrong. For an overview of the protocols and when to use each one, read why collecting data from production machines matters and how SCADA and MES work together.
Try it on your own machine
OpenMES is free and open source. Download it from GitHub, connect one machine and see your first stop log itself. If you would rather have help with a larger rollout, our Enterprise team connects machines, PLCs and ERP systems on real shop floors.