Essembi Docs

PLC Integration

Jump To

Any PLC or system that can publish MQTT can send production data to Essembi Pulse. This includes third-party PLCs, machine controllers, and software that already tracks counts or weights. Each message is a small JSON object sent to the MQTT broker on your Essembi Pulse server. Essembi Pulse listens on that broker, counts units, detects downtime, and reports to Essembi in real time.

Your PLC or system only publishes. It never needs to subscribe to anything or receive replies. For installing the Pulse server and MQTT broker, see Edge Devices.

Before You Start

Agree on the following with the Essembi team before programming the PLC or system:

  • The topic each PLC or system will publish to, such as essembi/plc1 or lines/plc1. Any name works, as long as the publisher and Essembi Pulse use the same one.
  • The pin number for each sensor, scale, or quantity feed. A pin is a unique ID within its MQTT topic, and Essembi maps it to a Sensor and Line Component record (Settings > Lines).
  • The message type for each pin: count, weight, or quantity. See Message Format below.

Connection Settings

Point the MQTT client in your PLC or system at your Essembi Pulse server with these settings:

SettingValue
Broker hostIP address or hostname of your Essembi Pulse server
Port1883
ProtocolMQTT 3.1.1 or 5.0 over plain TCP (no TLS, no WebSockets)
Username / passwordNone (leave blank)
Client IDAny unique ID per PLC or system, for example plant-plc1. Do not start it with EssembiPulse_.
Keep-alive30 to 60 seconds
Clean sessionEither setting works

The PLC or system must be able to reach the server on TCP port 1883. If there is a firewall between them, allow inbound TCP 1883 to the server. See Firewall in Edge Devices.

MQTT Topics

Each PLC or system publishes all of its pins to one topic, and the pin field in each message identifies the sensor, scale, or feed. A pin only needs to be unique within its topic, so two PLCs can both use pin 22 on different topics. The topic name is up to you, such as essembi/plc1 or lines/plc1. What matters is that the publisher uses exactly the topic configured in Essembi Pulse.

  • Use the topic exactly as agreed. Topics are case-sensitive: essembi/plc1 and Essembi/PLC1 are different topics.
  • Do not add extra levels per pin, such as essembi/plc1/22. Pulse listens only on the exact topic, so those messages are ignored.
  • Two publishers must not send the same pin number on the same topic. Give each PLC or system its own topic.

Example: two PLCs and a packaging system on one site.

SourceTopicPins
PLC 1essembi/plc122, 23, 24, 25, 26
PLC 2essembi/plc222, 23, 24, 25, 26
Packaging systemessembi/packaging1

Message Format

Every message is one JSON object with a numeric pin and one value field. There are three message types, and each pin uses the one agreed with Essembi:

  • Count: Sends state. Use it for sensors and other on/off signals.
  • Weight: Sends weight. Use it for scales.
  • Quantity: Sends quantity. Use it when your PLC or system already knows how many units were produced.
FieldTypeRequiredMeaning
pinIntegerAlwaysUnique ID for this sensor, scale, or feed within its MQTT topic. Essembi maps each topic and pin pair to a Sensor and Line Component record. Any whole number. It does not have to be a physical pin.
stateInteger, 1 or 0Count pins1 = sensor on (blocked, triggered, running). 0 = sensor off. Pulse counts a unit on each change from 0 to 1.
weightNumberWeight pinsCurrent gross weight on the scale, in the unit agreed with Essembi.
quantityNumberQuantity pinsUnits produced since the last message. Pulse posts this quantity to the active work order on the pin's line.

Parser Rules

  • Send numbers as JSON numbers, not strings or booleans. "pin":"22" and "state":true are rejected.
  • Only a state of 1 counts as on. Any other value is treated as off.
  • Field names are not case-sensitive. Extra fields, such as a timestamp, are ignored.
  • Messages for a pin that Essembi has not configured are ignored.

Example Messages

A counting sensor turning on, then off (two separate messages):

{"pin":22,"state":1}
{"pin":22,"state":0}

A scale reporting a weight:

{"pin":0,"weight":42.5}

A packaging system reporting 24 units produced:

{"pin":1,"quantity":24}

Publishing Behavior

Publish each change the moment it happens. Pulse timestamps every message when it arrives, so delays or batching skew counts and downtime.

  • Counting sensors: Send one message when a sensor turns on and one when it turns off. Pulse counts a unit on each off-to-on change and measures downtime from how long a sensor stays in one state.
  • Repeats are safe for count pins: A state message that repeats the current state is ignored, so you may also resend each count pin's state as a periodic heartbeat.
  • Debounce at the PLC: Filter contact bounce and electrical noise before publishing. Every extra on/off pair that reaches Pulse is an extra unit.
  • Scales: Publish whenever the weight changes. Pulse detects a completed fill when the weight peaks and then drops back toward zero.
  • Quantities: Send each quantity once, as soon as the units are produced, for example once per completed case or batch. Send only the units produced since the last message, not a running total. Every quantity message is posted, so never resend one as a heartbeat.
  • QoS: Use QoS 1. QoS 0 works but can lose messages on a busy network.
  • Retain: Leave the retain flag off. A retained message replays when Pulse restarts and can record units that never happened.

Testing PLC Messages

Watch the broker on the Essembi Pulse server while your PLC or system sends data. Each sensor trigger should show an on message and an off message on your topic. Each weight or quantity should show one message.

Step 1: Start a listener on the server. Open a command prompt on the Essembi Pulse server and run:

cd "C:\Program Files\mosquitto"
.\mosquitto_sub.exe -h localhost -t "#" -v

Step 2: Send data from one pin at a time. Trigger each sensor, or send a test weight or quantity. You should see lines like:

essembi/plc1 {"pin":22,"state":1}
essembi/plc1 {"pin":22,"state":0}
essembi/packaging {"pin":1,"quantity":24}

Step 3: Confirm each pin. Check that each pin appears on the right topic with the right message type, then send the list to Essembi to confirm against the Pulse configuration.

Testing Without the PLC

To test the server without the PLC or system, publish a message by hand from any computer with the Mosquitto client tools installed. Open a command prompt in the mosquitto folder and run the following, replacing SERVER_IP with your server's IP address:

mosquitto_pub -h SERVER_IP -p 1883 -t "essembi/plc1" -q 1 -m "{\"pin\":22,\"state\":1}"

Troubleshooting PLC Messages

SymptomLikely Cause
PLC or system cannot connectWrong server address, or a firewall blocking TCP 1883 to the server
Messages appear in the listener but Pulse shows nothingTopic or pin does not match what is configured in Essembi Pulse, or values are sent as strings
Counts too highSensor bounce not filtered at the PLC, or retained messages replaying
Quantities too highQuantity messages resent as a heartbeat, running totals sent instead of new units, or retained messages replaying
Downtime recorded during productionMessages delayed or batched instead of sent on each change

For server-side checks, such as confirming the Essembi Pulse Listener Service is running, see Troubleshooting PLC Data in Edge Devices.

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.