The Advantech ADAM-6050 is an Ethernet I/O module with 12 digital inputs and 6 digital outputs. With MQTT firmware, it publishes its I/O status straight to the cloud, with no gateway in between. This guide sends that data to Ubidots. The module publishes to a UbiFunction, which turns Advantech's message format into one Ubidots variable per channel.
When you finish, Ubidots shows one device with a variable for each channel: di1 to di12 for the inputs, do1 to do6 for the output states, and online for the connection.
Requirements
An ADAM-6050-D or ADAM-6050-D1. The older -CE and -BE revisions don't support MQTT. See the FAQ at the end for those.
Firmware V6.15 or later, from Advantech's ADAM-6050 firmware page. Overwriting the MQTT topics needs at least V6.11 B41.
A Windows PC with Adam/Apax .NET Utility V2.05.11 B23 or later.
An active Ubidots account and your Ubidots token.
A network that lets the module reach functions.ubidots.com on port 1883, or 8883 with TLS.
How the data gets to Ubidots
The ADAM-6050 publishes a fixed JSON format: one key per channel with a true/false value, plus four keys that Advantech reserves (s, t, q and c):
{"s":1,"t":0,"q":192,"c":1,"di1":true,"di2":false,...,"di12":true,"do1":false,...,"do6":false}You can rename the keys, but you can't remove the reserved ones or change the true/false values. So the module publishes to a UbiFunction on functions.ubidots.com instead of straight to the Ubidots broker. The function drops the reserved keys, turns true/false into 1/0 and writes each channel as a variable on one device.
The function endpoint only accepts messages published under /prv/<your-username>/, and it rejects subscriptions. The ADAM-6050 also subscribes to its own control topics (Advantech/<MAC>/ctl/...) every time it connects, and that can't be turned off. The steps below redirect every message the module lets you redirect, and switch off the configuration messages it publishes to fixed Advantech topics. If the connection still drops repeatedly, see Troubleshooting.
1. Create the decoder function in Ubidots
In your Ubidots account, go to Dev Center → Functions and click + to create a function.
Set the Name to adam-6050-decoder, the Method to POST and the Runtime to Python 3.14 Lite.
Delete the sample code and paste the code below. Replace PUT-YOUR-TOKEN-HERE with your Ubidots token.
Save the function.
import json
import requests
BASE_URL = "https://industrial.api.ubidots.com"
TOKEN = "PUT-YOUR-TOKEN-HERE"
# Keys the ADAM adds to every message. Advantech reserves them, so they are skipped.
RESERVED = {"s", "t", "q", "c"}
def main(args):
payload = args.get("payload") or {}
if isinstance(payload, str):
payload = json.loads(payload)
# Topic: /prv/<username>/<function-label>/<device-label>[/status]
parts = args["topic"].strip("/").split("/")
device_label = parts[3].lower() if len(parts) > 3 else "adam-6050"
if "status" in payload:
# Will topic: "connect" when the module connects, "disconnect" when it drops
values = {"online": 1 if payload["status"] == "connect" else 0}
else:
values = {}
for key, value in payload.items():
if key in RESERVED:
continue
if isinstance(value, bool):
value = int(value)
if isinstance(value, (int, float)):
values[key.lower()] = value
if not values:
return {"status": "ignored"}
response = requests.post(
f"{BASE_URL}/api/v1.6/devices/{device_label}/",
headers={"X-Auth-Token": TOKEN, "Content-Type": "application/json"},
json=values,
timeout=10,
)
return {"status": response.status_code, "text": response.text}
Copy the function's label from its HTTPS endpoint URL, which ends in /prv/<your-username>/<function-label>. Don't retype it from the name, because the label can differ, for example with underscores instead of hyphens. You'll use it in the module's topics in step 3.
2. Find the ADAM-6050 and update its firmware
Connect the ADAM-6050 to power and to your network with an Ethernet cable. Its default IP address is 10.0.0.1.
Open Adam/Apax .NET Utility, right-click the Ethernet entry and click Search Device. The module appears in the device tree.
Select the module. The Information tab shows its Firmware Version. When you apply changes, the Utility asks for the module's password, 00000000 by default.
Set an IP address, subnet mask and gateway on your network so the module can reach the internet.
If the firmware is older than V6.15, update it to the latest build. Advantech's firmware page sets the upgrade order: V6.05 B00 first, then V6.14 B00, then V6.15.
3. Configure MQTT on the ADAM-6050
In the Utility, select the module and open the Cloud tab, then the IOT sub-tab.
Connection
Pub/Sub Service: ADAM MQTT
Host: functions.ubidots.com
Port: 1883. Leave TLS off for now. You'll turn it on once data arrives.
User Name: your Ubidots account username
Password: your Ubidots token
Publish Interval: 60000 ms. The default is 5000 ms. Each publish is one function run carrying 18 values, so 5 seconds means about 17,000 runs a day. Changes on a digital input also trigger a publish, limited by Deadband, so a longer interval still records every change.
Heartbeat, Retain Message and Deadband: leave the defaults.
Note: the function endpoint takes your username as the MQTT user and your token as the password. That's the reverse of the main Ubidots broker, where the token is the username.
Publish only the data topic
Under Basic Settings, the Publish Topic list shows every topic the module publishes. Keep the first one, Advantech/<MAC>/data, checked and uncheck the rest. They carry configuration data to fixed Advantech topics that the function endpoint doesn't accept. If your Utility version shows Publish Value Mode, leave it off, because it publishes each channel to fixed topics too.
Click Apply.
The screenshot shows Advantech's example values, with an IP address as Host and TLS on port 8883. Use the values listed above.
Point the topics and messages at the function
Open Advanced Settings, then the Publish sub-tab, and set:
User Defined MQTT Publish: check Enable.
Overwrite Will Topic Name: /prv/<your-username>/<function-label>/<device-label>/status. The default will topic is outside /prv/, and the endpoint can refuse the connection because of it.
Overwrite Will Message: {"status":"disconnect"}
Overwrite Connect Message: {"status":"connect"}
Overwrite Publish Topic Name: /prv/<your-username>/<function-label>/<device-label>. The last part becomes the device's label in Ubidots. For example: /prv/acme/adam-6050-decoder/adam-6050.
Click Apply Advanced Settings.
The connect and disconnect messages reach the function on the /status topic, which turns them into the online variable.
4. Check the data in Ubidots
In the Utility, open Cloud → Diagnosis. MQTT Connection State shows Connected, MQTT Heart Count keeps rising, and MQTT Diagnostic Information lists a Publish entry for each message.
In Ubidots, go to Devices. A device with your device label appears, with the variables di1 to di12, do1 to do6 and online, each 1 or 0. Ubidots names the device after its label; you can rename it, as in the screenshot.
After a sudden power or network loss, the module can't send its disconnect message, so online can keep showing 1. To get notified when the module goes quiet, set up an inactivity event on the device.
5. Optional: encrypt the connection with TLS
Once data arrives on port 1883, go back to Cloud → IOT, check TLS: Enable, change Port to 8883 and click Apply. The endpoint accepts the module's TLS 1.2 cipher suites.
Leave Use TLS Certificate and Verify Certificate date unchecked. The module only loads CA certificates through Advantech's over-the-air update, which needs a broker that can send commands to the module. The connection is encrypted, but the module doesn't verify the server's certificate. If you load a CA certificate some other way, use ISRG Root X1, and set the module's clock on the SNTP tab so the certificate dates check out.
Troubleshooting: why is no data reaching Ubidots?
Diagnosis shows the module disconnected. Check that Host is functions.ubidots.com and the port matches the TLS setting (1883 off, 8883 on). The user name must be your account username and the password your token. Also check that the module's gateway can reach the internet.
The connection drops right after connecting, again and again. Diagnosis reports that the broker disconnected after the connection. First check that only the data topic is checked under Publish Topic and that the will topic is overwritten. If it keeps dropping, the endpoint is closing the connection over the module's built-in subscriptions. Put a bridge in front: a local Mosquitto broker or a Node-RED flow that receives the module's messages and forwards only the data and status topics to functions.ubidots.com. For a fleet, Ubidots can also map a dedicated broker to your function; contact Ubidots sales.
Connected, but no device appears. The data topic must start with /prv/<your-username>/<function-label>/, using the label copied from the function's endpoint, and the function's method must be POST. Open the function's logs to see whether it ran. If Diagnosis lists no Publish entries, update the firmware to the latest V6.15 build: some earlier builds were reported to connect without publishing.
The function runs but returns 401 or 403. The token in the code is wrong or has been deleted.
Values update late. Lower Publish Interval. Digital input changes publish right away, within the Deadband time.
FAQ
Which ADAM-6050 models support MQTT?
The ADAM-6050-D and -D1. MQTT arrived in firmware V6.01 B11, the user name and password in V6.02 B01, and topic overwriting in V6.11 B41. Use V6.15 or later. The -CE revision (firmware 5.x) and the -BE revision (4.x) don't support MQTT.
Can the ADAM-6050 publish straight to the Ubidots broker without a function?
The topic can be set to a Ubidots device topic, but the message can't be changed enough. It always includes the four reserved keys, which would arrive as four extra variables, and it sends true/false instead of numbers. The function removes both problems.
Can Ubidots switch the ADAM-6050's outputs?
Not with this setup. The function endpoint only receives data, so data flows one way, from the module to Ubidots. The outputs' states arrive as the do1 to do6 variables.
Does the same function work for other ADAM-6000 modules?
The function doesn't depend on ADAM-6050 channel names. It writes every numeric or true/false key it receives, so several modules can share it. Give each module its own device label at the end of its topics.
My ADAM-6050 is an older revision without MQTT. What are the options?
Poll it over Modbus TCP from a gateway and let the gateway send the data to Ubidots. See EdgeLink Studio Modbus TCP Setup: ECU-1051 and ADAM-6717 for the ECU-1051, or Use vNode to poll sensor data using Modbus TCP.
Other Advantech guides





