Skip to main content

Send Modbus Data from a Merlin 3100 PLC to Ubidots via MQTT

Learn how to configure a Merlin 3100 PLC to collect Modbus data and send it to Ubidots via MQTT, enabling real-time monitoring and visualization of your industrial data in the cloud.

Sergio M avatar
Written by Sergio M
Updated today

The Merlin 3100 Series is an industrial cellular router providing high-speed and secure data connectivity for SCADA and IoT systems. It supports LTE Cat 4, Gigabit Ethernet, and dual SIM operation for network redundancy. Built-in cybersecurity features such as Trusted Platform Module (TPM), Secure Boot, and VPN/firewall support ensure data integrity and device protection. This guide describes how to configure the Merlin 3100 to collect Modbus data from field devices and transmit it to Ubidots via MQTT for cloud-based monitoring and visualization.

This guide applies to the 3100 Series.

Requirements

1. Configuring the application on the Merlin PLC

The setup involves enabling the following three key elements:

  • The application

  • The Server protocol. For this guide, it will be MQTT

  • The Master protocol. For this guide, it will be Modbus

  • Data point.

Enabling the application

Log in to the WebUI of your Merlin PLC and then browse to the IECD configuration page, there enable IECD from the Main configuration tab:

Then hit the SAVE & APPLY button.

Configuring the Server protocol

To set up MQTT as the Server protocol, navigate to the Slave Protocol tab and under dropdown with the same name, select MQTT:

Then click the CONFIGURE MQTT buttton, this will display the MQTT Configuration modal. Under the Main tab perform the following configurations:

Parameter

Value

MQTT Broker Hostname

industrial.api.ubidots.com

MQTT Broker Port

1883 (non-TLS) or 8883 (TLS)

MQTT username

MQTT password

(Leave blank)

Client ID (optional)

merlin-plc-01

Configuring TLS (Optional)

At minimum, to enable TLS communication, user needs to provide a Certificate

Authority’s (CA) Public Certificate file. For setting this up, move to the TLS tab and there perform the following configurations:

Parameter

Value

MQTT Enable TLS (2)

Select Enable from the dropdown options

Select MQTT TLS CA File Upload (3)

Get the Ubidots MQTT CA Certificate and save it to your PC, then upload it to the PLC by clicking Choose File

Select MQTT TLS Certificate File Upload (5)

Leave blank

Select MQTT TLS Key File Upload (4)

Leave blank

Click SAVE & APPLY at the bottom of the page.

MQTT Topics

Advance to the Topic tab and there edit the MQTT Monitor Topic field:

Ubidots expects the following topic structure:

/v1.6/devices/<device-label>

For example:

/v1.6/devices/merlin-demo

Leave MQTT Number of Control Vars and MQTT Control Var1 Topic blank

MQTT Payload

Move to the Advanced tab and there in the MQTT Payload Format dropdown, select Ubidots/Thingsboard:

This ensures that the payload's format complies with the expcted format by Ubidots, which is:

{
"RegisterHR": 123
}

The RegisterHR name can be configured in the option name of config data point block.

Click SAVE & APPLY at the bottom of the page.

Configuring the Master protocol

Back in the application's main configuration interface, go to Master Protocols tab, there select MODBUS as the Master protocol from the drop-down list, then click on CONFIGURE MODBUS button:

Modbus Serial

If you are using Modbus over serial interface, go to the Modbus #1 protocol dropdown and select Modbus Serial, then change the Serial parameters accordingly with your hardware setup:

Modbus TCP

If you are using Modbus over TCP interface, go to the Modbus #1 protocol dropdown and select Modbus TCP, then change the required parameters accordingly with your hardware setup:

For Modbus over TCP, it is required t configure a TCP route. Go to the bottom of the page and find the Modbus TCP Route section, then click the ADD button:

This will reveal the following parameters, configure them accordingly and then hit the SAVE & APPLY button.

Configuring data point

Each data point maps one Modbus register to a corresponding MQTT variable.

Back in the application's main configuration window, go to the Points tab and click Configure Data Points

Click the ADD button to create a data point and then the EDIT button:

Here, go to the General tab and set the following parameters:

Parameter

Value

Slave Protocol

MQTT

Master/RTU protocol

MODBUS

Name

Any unique name for this data point

Move forward to the Master tab and there change the following parameters accordingly with the hardware setup and the previous Modbus configuration:

Configuration example:

  • Link Number: 1

  • Device Address: 10

  • Register Type: Holding Register (HR)

  • Register Index: 40001

  • Data Format: INT16 / FLOAT (based on your Modbus data type)

Save the changes

2. View the data on Ubidots

Did this answer your question?