Industrial IoT gateways are the backbone of smart factories, bridging legacy sensors and controllers to the cloud. But truly unlocking their potential requires an intelligent layer that can analyze data, detect anomalies, and act in real time. ASI Biont, an AI agent that connects to any device via chat, changes the game. Instead of weeks of manual coding, you describe your gateway, and ASI Biont writes the integration code on the fly. This article is a technical guide to connecting industrial IoT gateways to ASI Biont using supported protocols—COM port, Modbus/TCP, MQTT, OPC-UA, and more—with real code examples and wiring diagrams. You'll see how to automate predictive maintenance, trend analysis, and alerting without a single dashboard button.
Why Connect an Industrial IoT Gateway to an AI Agent?
Industrial gateways (like the Siemens IOT2050, Advantech WISE-3610, or Raspberry Pi-based aggregators) collect data from PLCs, sensors, and actuators via RS-485/232, Modbus, CAN, or MQTT. Traditionally, you'd write custom Python scripts to parse, store, and alert. ASI Biont replaces that pipeline with a conversational AI that generates and executes the code automatically. The result: setup drops from days to minutes, and the AI can continuously optimize rules based on data trends.
Connection Methods Supported by ASI Biont
ASI Biont connects to industrial IoT gateways through multiple protocols, all accessed via chat commands. No UI panels—just describe your device:
| Protocol | Tool / Library | Use Case |
|---|---|---|
| COM port (RS-232/485) | Hardware Bridge + pyserial | Legacy sensors, Arduino, GPS trackers |
| Modbus/TCP | pymodbus via industrial_command | PLC registers, industrial controllers |
| MQTT | paho-mqtt via execute_python | IoT sensors, ESP32, smart home |
| OPC-UA | opcua-asyncio via industrial_command | Factory servers, Siemens controllers |
| HTTP API | aiohttp via execute_python | Smart plugs, REST endpoints |
| SSH | paramiko via execute_python | Raspberry Pi, Linux gateways |
| CAN bus | python-can via industrial_command | Vehicle diagnostics, robot arms |
All commands are sent through industrial_command() in the chat. For COM port access, you run bridge.py locally (downloaded from the ASI Biont dashboard) which connects to the cloud via WebSocket. The AI uses serial_write_and_read(data=hex_string) to perform atomic write+read operations.
Use Case 1: Predictive Maintenance via Modbus/TCP
Scenario: A factory gateway reads temperature and vibration from a PLC via Modbus/TCP. You want AI to detect abnormal trends and send alerts.
How to connect: In the ASI Biont chat, describe: "Connect to my Modbus/TCP gateway at 192.168.1.100:502. Read holding registers 0 and 1 every minute. If temperature exceeds 85°C or vibration exceeds 50 units, send a notification." The AI will generate and execute this code:
from pymodbus.client import ModbusTcpClient
import time
from datetime import datetime
client = ModbusTcpClient('192.168.1.100', port=502)
client.connect()
try:
for _ in range(5): # 5 iterations (30s timeout per iteration)
# Read holding registers 0 and 1
temp_resp = client.read_holding_registers(0, 1)
vib_resp = client.read_holding_registers(1, 1)
if temp_resp.isError() or vib_resp.isError():
print(f"[{datetime.now()}] Modbus read error")
continue
temp = temp_resp.registers[0] / 10.0 # scaling
vib = vib_resp.registers[0]
print(f"[{datetime.now()}] Temp={temp}°C, Vibration={vib}")
if temp > 85:
print(f"ALERT: Overheating! Temp={temp}°C")
if vib > 50:
print(f"ALERT: Excessive vibration! Vib={vib}")
time.sleep(10)
except Exception as e:
print(f"Error: {e}")
finally:
client.close()
The AI runs this in the sandbox (execute_python) with a 30-second timeout—no infinite loops. It prints alerts to the chat, and you can ask it to send alerts via Telegram or email next.
Real-world impact: According to a 2023 study by the International Society of Automation, predictive maintenance can reduce unplanned downtime by 30-50%. With ASI Biont, you set this up in under 5 minutes.
Use Case 2: MQTT-Based Temperature Monitoring from ESP32
Scenario: An ESP32 with a DHT22 sensor sends temperature/humidity via MQTT every 10 seconds. You want AI to analyze trends and trigger a relay if temperature exceeds a threshold.
How to connect: In the chat, say: "Subscribe to MQTT broker at broker.hivemq.com:1883, topic 'factory/sensor1'. Parse JSON payload with temp and humidity. If temp > 35°C, publish 'on' to topic 'factory/relay1'." The AI writes:
import paho.mqtt.client as mqtt
import json
def on_connect(client, userdata, flags, rc):
client.subscribe("factory/sensor1")
def on_message(client, userdata, msg):
data = json.loads(msg.payload.decode())
temp = data.get('temp', 0)
humidity = data.get('humidity', 0)
print(f"Received: temp={temp}°C, humidity={humidity}%")
if temp > 35:
client.publish("factory/relay1", "on")
print("Relay ON due to high temperature")
client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message
client.connect("broker.hivemq.com", 1883, 60)
client.loop_start()
# Keep script alive for 25 seconds (within sandbox limit)
import time
time.sleep(25)
client.loop_stop()
The sandbox executes this for 25 seconds, receiving and processing messages. You can extend to publish to a second topic for long-term storage.
Wiring diagram: Connect DHT22 data pin to ESP32 GPIO4, VCC to 3.3V, GND to GND. Flash the ESP32 with a MicroPython script that publishes JSON via MQTT every 10 seconds (code not shown here, but ASI Biont can generate that too).
Use Case 3: COM Port Access via Hardware Bridge for Legacy Equipment
Scenario: A GPS tracker sends NMEA sentences over RS-232 at 9600 baud. You want AI to parse coordinates and log them.
How to connect: Download bridge.py from the ASI Biont dashboard (Devices → Create API Key → Download bridge). Run it locally:
pip install pyserial requests websockets
python bridge.py --token=YOUR_API_TOKEN --ports=COM3 --baud 9600
Then in chat: "Read from COM3 via bridge. Parse NMEA $GPGGA sentences. Extract latitude, longitude, altitude. If altitude > 100m, print 'High altitude'."
The AI uses industrial_command:
# This is what the AI sends internally
industrial_command(
protocol='serial://',
command='serial_write_and_read',
data='48454c500a' # 'HELP\n' in hex
)
But for continuous reading, the AI generates a script that runs in execute_python and uses the bridge's output. Wait—the bridge runs locally, so execute_python can't read COM directly. Instead, the AI writes a script that uses paramiko to SSH into a Raspberry Pi that itself connects to the COM port. Or you can ask the AI to set up a periodic read via the bridge by sending commands to the bridge from chat.
Simpler approach: Use the bridge interactively. In chat, say: "Bridge, read from COM3 and send me the raw NMEA data." The AI will use industrial_command(protocol='bridge://', command='serial_write_and_read', data='...') to send a request. The bridge sends the command to the COM port and returns the response.
Use Case 4: OPC-UA for Factory Sensor Array
Scenario: A Siemens S7-1500 PLC exposes temperature, pressure, and level sensors via OPC-UA. You want AI to log data and predict failures.
How to connect: "Connect to OPC-UA server at opc.tcp://192.168.1.50:4840. Read variables 'ns=2;i=1001', 'ns=2;i=1002', 'ns=2;i=1003'. If any exceeds threshold, print alert."
ASI Biont uses industrial_command(protocol='opcua://', command='read_variable', ...):
from opcua import Client
client = Client("opc.tcp://192.168.1.50:4840")
client.connect()
temp = client.get_node("ns=2;i=1001").get_value()
pressure = client.get_node("ns=2;i=1002").get_value()
level = client.get_node("ns=2;i=1003").get_value()
print(f"Temp={temp}, Pressure={pressure}, Level={level}")
if temp > 100:
print("ALERT: Temperature critical!")
client.disconnect()
The AI runs this once (or in a loop with short waits). You can ask to store results in a PostgreSQL database for trend analysis.
Why This Approach Wins
Traditional integration requires: (1) reading API docs, (2) writing connection code, (3) testing and debugging, (4) deploying. ASI Biont compresses this into one chat interaction. The AI knows all the libraries (pymodbus, paho-mqtt, opcua-asyncio, etc.) and writes production-ready code on demand. No waiting for vendor SDKs—any device that speaks TCP/Serial/MQTT/Modbus/OPC-UA is supported immediately.
Conclusion
Industrial IoT gateways are powerful, but their value multiplies when paired with an AI agent that can automate predictive maintenance, anomaly detection, and alerting without custom software. ASI Biont connects via COM port, Modbus/TCP, MQTT, OPC-UA, HTTP, SSH, and more—all through chat. You describe the device, the AI writes the code, and you get results in seconds.
Ready to integrate your industrial gateway? Visit asibiont.com, create an API key, download bridge.py, and start a chat. Describe your device and let AI handle the rest.
Comments