All Collections
Connect your Devices
Advantech Series: Connect ECU-1051 IoT Gateway to Ubidots Using MQTT
Advantech Series: Connect ECU-1051 IoT Gateway to Ubidots Using MQTT

Learn how to connect Advantech's ECU-1051 IoT gateway and simulate data to send to Ubidots through MQTT

Written by Sergio M
Updated over a week ago


Table of Contents

1. Set up the Gateway and the Development Environment

  • Connect the ECU-1051 to the power supply.

  • Connect the ECU-1051 to your router (LAN) using an Ethernet cable.

  • Download and install Advantech EdgeLink Studio from the link provided at the Requirements section.

Pro Tip: Each LAN port on the gateway has a status LED which will confirm if the device is correctly connected to the router and if it's correctly powered.

2. Create the Project

Open Advantech EdgeLink Studio utility. Look for the icon that resembles a computer screen at the bottom left side of the screen, click on it and then head to the "Search" option:

Once the gateway has been found, the utility will display it along with its IP address. Copy this address to use it later. It will look like this:

Head to the icon that resembles a hammer and then head to the upper left corner to the "Create Project" option; a window will pop up where you should put your project's name, author and description, while leaving the path on its default setting. When you are done filling the fields, hit the "OK" button to save the changes.

The project will then be displayed at the "Project Configuration" tab. Right click on it and then click "Add Device".

Then a new window will pop up where you'll have to set the following parameters:

  • Name: name of the current project

  • Model: select ECU-1051TL-R10A from the list that will be displayed

  • Password: do not change anything on this field

  • Identity: change from "Node ID" to "IP address"

  • IP Address: enter the IP address that you copied earlier (when searching for the device)

  • Time Zone: set the time zone according to your geographical position

  • Description (optional): set a meaningful description for your project

When you are done, hit the "Apply" button in order to save the changes.

The following two pictures depict the steps mentioned above:

As you'll notice, all of the project's folders are now displayed at the "Project Configuration" tab:

3. Create the I/O Tags to Send Simulated Data

This guide will simulate three different devices transmitting data to the gateway by making use of the "User Tag" functionality: a temperature sensor, a humidity sensor and an engine's status.

In order to do so, head to "Data Center" → "User Tag" → "Add...". There, you are going to set:

  • Name: boilerTemperature

  • Data Type: Analog

  • Initial Value: you can set any value

  • Read/Write: leave this option as it is by default

  • Description: this is optional

After filling the fields, hit the "Ok" button to save the changes.


Create the other two variables:

Variable name

Data Type





You can set whatever initial value you wish and also leave "Read/Write" as it is.

4. Send data to Ubidots

It's now time to manipulate the endpoint to which the gateway is publishing in order to parse the data. Head to your Ubidots account → "Devices" → "Functions" and create a new UbiFunction by clicking on the "+" icon. The windows should look like this:

Edit the function's name to "mqttadvantech", set the "Method" to POST, select "Python 3.7" as runtime and on the "Token" section set "Default Token". Lastly, delete all the code and paste the following one taking into account that you should edit the "token" variable to match your Ubidots Token:

import requests
from datetime import datetime as dt


def main(args: dict = {}):

data = args["payload"]["d"]
date_str = args["payload"]["ts"]
timestamp = int(dt.strptime(date_str, "%Y-%m-%dT%H:%M:%S%z").timestamp()*1000)
device_label = args["topic"].split("/")[4]
payload = parse_advantech_data(data)

res = send_data(device_label, payload, token, **{"timestamp":timestamp})
return {"status": res.status_code, "text": res.text}

def parse_advantech_data(data):
payload = {}
for tag in data:
var_label = tag["tag"]
value = tag["value"]
payload[var_label] = {
"value": value
return payload

def send_data(device, payload, token, **params):
url = f"{BASE_URL}/api/v1.6/devices/{device}/"
headers = {"X-Auth-Token": token, "Content-Type": "application/json"}
res = make_request("post", url, headers=headers, params=params, body_json=payload, attempts=5)
return res

def make_request(
Function to make a request with timeout and retries

req_session = requests.Session()
req_adapter = requests.adapters.HTTPAdapter(max_retries=attempts)
req_session.mount("https://", req_adapter)

response = req_session.request(


return response

5. Configure the MQTT

The next step is to configure the MQTT parameters and in order to do so, head to "Cloud" → "SimpleMQTT". Then a new tab will pop up and, in it, you'll have to scroll down and edit the following settings:

  • Enable: mark the checkbox in order to enable MQTT settings

  • Host:

  • User Name: your Ubidots account username

  • Password: your Ubidots Token

  • Data Topic: /prv/<your-ubidots-username>/mqttadvantech/gatewayadvantech

  • Publish period: Any publishing period that you wish, keep in mind that this variable is expressed in seconds.

After filling all the mentioned fields, head to "Tag Name" and, just below it, you'll find a text displaying "Double click to edit". Do as it says and then a screen will prompt you to select which tags are going to be published through MQTT: get to the "User Tags" section and select all the tags that you created for this purpose, then hit the "OK" button and then "Apply".

As stated before, this guide emulates three different variables, so this part might differ a little to yours:

After applying the MQTT settings, you can collapse all of the project's sub-folders while leaving the gateway selected. Then hit "Save", followed by "Project Download" in order to burn the firmware to the gateway:

The following window will pop up. In it, select "Force Download", hit "Download" and the firmware will start to be loaded onto the gateway. A pop-up might ask you about installing aditional hardware drivers, accept it and let the uploading finish.

That's it on the hardware side of things. Now let's code a little.

6. Visualize Data on Ubidots

Head over to the "Devices" section in your Ubidots account, where you'll see a device labeled "gatewayadvantech" with data being ingested.

7. Feedback, Suggestions and Related Articles

Feel free to post questions or suggestions in our community portal, or contact us via

Other users also found helpful...

Did this answer your question?