Industrial IoT Gateways + ASI Biont: How to Connect Factory Equipment to an AI Agent Without Coding

Why Connect Industrial IoT Gateways to an AI Agent?

Industrial IoT gateways are the backbone of modern factory floors. They aggregate data from PLCs, sensors, and legacy equipment via protocols like Modbus, OPC-UA, and BACnet, then forward it to the cloud or on-premises servers. But raw telemetry is useless without analysis. That's where ASI Biont's AI agent comes in — it connects directly to your gateway, reads real-time data, detects anomalies, and even writes back control commands. No dashboards, no manual scripting. You just describe your equipment in chat, and the AI builds the integration on the fly.

How ASI Biont Connects to Your Gateway

ASI Biont supports 14 connection methods out of the box. For industrial gateways, the most relevant are:

Protocol Library Use Case
Modbus/TCP pymodbus Read/write PLC registers
OPC-UA opcua-asyncio Aggregate tags from multiple controllers
MQTT paho-mqtt Stream sensor data from edge devices
Siemens S7 snap7 Direct access to S7-1200/1500 DBs
BACnet bac0 Building automation (HVAC, lighting)
EtherNet/IP pycomm3 Rockwell/Allen-Bradley controllers
HTTP API aiohttp REST-based gateways

All these libraries are pre-installed in ASI Biont's sandbox. You simply tell the AI: "Connect to my Moxa gateway at 192.168.1.100 via Modbus/TCP" — and it writes the code, executes it, and starts monitoring.

Step-by-Step: Real-Time Temperature Monitoring on a Factory Floor

Let's walk through a concrete example. You have a Moxa MGate 5114 Modbus gateway connected to an RTD temperature sensor. You want the AI to:
- Poll temperature every 30 seconds
- Alert you on Telegram if temperature exceeds 85°C
- Log data to a CSV file for later analysis

Step 1: Describe the task in chat

You type:

"Connect to Moxa gateway at 192.168.1.100:502 via Modbus TCP. Read holding register 40001 (temperature, scale 0.1). If value > 850 (85°C), send Telegram alert. Log every reading to temperature_log.csv."

Step 2: AI generates and runs the code

Here's what the AI writes and executes inside the sandbox (using execute_python):

import asyncio
from pymodbus.client import AsyncModbusTcpClient
import csv
from datetime import datetime
import os

TELEGRAM_BOT_TOKEN = os.environ.get('TELEGRAM_BOT_TOKEN')
TELEGRAM_CHAT_ID = os.environ.get('TELEGRAM_CHAT_ID')

async def send_telegram_alert(msg):
    # Uses requests inside sandbox to send message
    import requests
    url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage"
    requests.post(url, json={'chat_id': TELEGRAM_CHAT_ID, 'text': msg})

async def poll_temperature():
    client = AsyncModbusTcpClient('192.168.1.100', port=502)
    await client.connect()

    with open('temperature_log.csv', 'a', newline='') as f:
        writer = csv.writer(f)
        if os.stat('temperature_log.csv').st_size == 0:
            writer.writerow(['timestamp', 'temperature_c'])

        while True:
            result = await client.read_holding_registers(40001, 1, unit=1)
            if result.isError():
                print(f"Read error: {result}")
            else:
                temp = result.registers[0] * 0.1
                now = datetime.now().isoformat()
                writer.writerow([now, temp])
                f.flush()
                print(f"{now}: {temp:.1f}°C")

                if temp > 85.0:
                    await send_telegram_alert(f"⚠️ Temperature exceeded 85°C: {temp:.1f}°C at {now}")

            await asyncio.sleep(30)

asyncio.run(poll_temperature())

Step 3: AI monitors and acts

The code runs in the sandbox for up to 30 seconds per execution (sandbox timeout). For continuous monitoring, AI can set up a scheduled task (cron) via the chat — or the code itself loops within the limit. When temperature spikes, the AI sends a Telegram alert instantly.

Alternative: Using the industrial_command Tool

For quick one-off actions, you don't need full Python scripts. Just use the industrial_command tool:

"Read register 40001 from 192.168.1.100 via Modbus TCP"

The AI executes:

industrial_command(
    protocol='modbus',
    command='read_registers',
    params={'host': '192.168.1.100', 'port': 502, 'address': 40001, 'count': 1, 'unit': 1}
)

And returns the value: Register 40001 = 782 (78.2°C).

Connecting via MQTT (Edge Gateways)

Many industrial gateways (e.g., Advantech WISE-4000, Siemens IOT2050) publish data via MQTT. ASI Biont can subscribe to topics and react.

Example:

import paho.mqtt.client as mqtt

def on_message(client, userdata, msg):
    print(f"Received: {msg.topic} -> {msg.payload}")
    # AI can parse and decide actions

client = mqtt.Client()
client.on_message = on_message
client.connect("192.168.1.50", 1883, 60)
client.subscribe("factory/machine1/temperature")
client.loop_start()

Why This Beats Traditional Integration

  • No coding required — The AI writes all the glue code. You just describe.
  • Supports any protocol — Modbus, OPC-UA, BACnet, MQTT, HTTP, S7, CAN bus — all pre-installed.
  • Real-time alerts — Telegram, email, Slack — the AI sends notifications based on your rules.
  • Automatic logging — Data goes to CSV, database (PostgreSQL, MySQL), or cloud storage.
  • Two-way control — Not just read: you can write back to PLCs, set outputs, change setpoints.

Pitfalls and How to Avoid Them

  1. Sandbox timeout (30s) — Don't write infinite loops. For continuous monitoring, use scheduled tasks or the industrial_command tool for point queries.
  2. Firewall rules — Ensure your gateway's IP/port is reachable from the ASI Biont server. Test with telnet first.
  3. Modbus unit IDs — Many gateways require a unit ID (slave ID). Default is 1, but verify.
  4. Data scaling — Registers often return raw integers. Know the scaling factor (e.g., 0.1 for temperature).
  5. Secure protocols — If using OPC-UA, you may need to disable certificate validation for testing: client = OPCUAClient('opc.tcp://...', security=False).

Real-World Scenario: Predictive Maintenance

A manufacturer connected their Advantech ECU-1251 gateway (with Modbus RTU to TCP conversion) to ASI Biont. The AI:
- Polled vibration and temperature from 12 motors every 10 seconds
- Calculated rolling averages and standard deviations
- Detected when vibration exceeded 3-sigma threshold
- Automatically sent a work order to their CMMS via HTTP API

Result: Downtime reduced by 40% in the first quarter.

Conclusion

Industrial IoT gateways are powerful, but their true value unlocks when an AI agent can interpret and act on the data. ASI Biont makes this trivial — no need for custom middleware or dashboard configuration. Just connect, describe, and let the AI handle the rest.

Ready to connect your factory floor? Go to asibiont.com, create a free account, and start chatting with your equipment today.

← All posts

Comments