How to Connect RS-485 Modbus Devices to ASI Biont AI Agent — Industrial Automation Without Coding

Introduction

If you work with industrial equipment — energy meters, temperature sensors, VFDs, or PLCs — you've probably dealt with RS-485 and Modbus RTU. It's the backbone of factory automation, but integrating it with a modern AI agent often feels like a bridge too far. Not anymore.

ASI Biont connects to RS‑485 devices via a COM port (RS‑232/RS‑485) using a lightweight Hardware Bridge (bridge.py). This bridge is downloaded from the ASI Biont dashboard — never from random GitHub repos — and once it's running, you control the device through a simple chat dialog. No complex dashboards, no vendor SDKs, just plain English.

In this guide, I'll show you how to wire an RS‑485 device to ASI Biont, read Modbus RTU registers, and set up automatic monitoring — all without writing a single line of code on your side. The AI writes the code, you review it, and it runs in a secure sandbox.

Why RS‑485 and Modbus RTU?

RS‑485 is a robust differential serial standard used in industrial environments for its noise immunity and long-distance transmission (up to 1200 meters). Modbus RTU is the most common application-layer protocol on top of it. Devices like power analyzers (e.g., Eastron SDM230), temperature controllers, and flow meters expose registers that you can read with function codes (0x03, 0x04, etc.).

Typical use cases:

  • Reading energy consumption from a smart meter
  • Monitoring temperature and humidity in a server room
  • Controlling a motor via a VFD
  • Logging pressure from industrial sensors

How ASI Biont Connects to RS‑485

ASI Biont supports many protocols, but for RS‑485 the recommended path is the Hardware Bridge (COM port). Here's why:

  • It's a small Python script that opens the serial port and exposes a local communication channel to the AI agent.
  • You pass it your token, port name, baud rate, and poll rate.
  • The AI can then send Modbus commands using a special helper called industrial_command().
Step Action
1 Buy a USB-to-RS‑485 adapter (e.g., FTDI FT232RL) and connect it to your device (A/B pins).
2 Download bridge.py from the ASI Biont dashboard (not from GitHub).
3 Launch it: python bridge.py --token=YOUR_TOKEN --ports=COM3 --baud 9600 --rate=10
4 In ASI Biont chat, type: “Connect to the RS‑485 meter on COM3 and read register 0x0000.”

The bridge does not have an HTTP API — everything goes through industrial_command(), which the AI generates for you.

Practical Example: Energy Meter Monitoring

Let's assume you have an Eastron SDM230 Modbus energy meter connected to COM3 at 9600 baud, slave ID 1. You want to read voltage (register 0x0000) and current (register 0x0006) every 10 seconds, then send an alert to Telegram if voltage drops below 200 V.

After describing this in the chat, ASI Biont will generate and run a Python script like this:

import struct
import requests

# Calculate CRC16 for Modbus RTU
def crc16(data):
    crc = 0xFFFF
    for byte in data:
        crc ^= byte
        for _ in range(8):
            if crc & 0x0001:
                crc = (crc >> 1) ^ 0xA001
            else:
                crc >>= 1
    return crc

# Read holding register via industrial_command (bridge)
def read_register(slave_id, register, length=2):
    # Build Modbus request
    request = struct.pack('>BBHH', slave_id, 0x03, register, length)
    request += struct.pack('<H', crc16(request))

    # industrial_command sends the raw bytes through the COM port bridge
    response = industrial_command(
        protocol='modbus_rtu',
        command='raw',
        data=request.hex(),
        port='COM3',
        baudrate=9600,
        timeout=1
    )
    return response

# Example: read voltage (register 0x0000)
resp = read_register(1, 0x0000)
print(f"Raw response: {resp}")
# Parse float from Modbus registers 0x0000-0x0001
raw_bytes = bytes.fromhex(resp)
voltage = struct.unpack('>f', raw_bytes[3:7])[0]
print(f"Voltage: {voltage} V")

# Send a Telegram alert if voltage is low
if voltage < 200:
    requests.post(
        f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage",
        json={"chat_id": TELEGRAM_CHAT_ID, "text": f"⚠️ Low voltage: {voltage} V"}
    )

Important: The bridge does not expose send_telegram() or similar helpers. In an execute_python block you use standard libraries (requests for Telegram, pymodbus or pyserial for Modbus). The AI handles the actual code — you just describe the logic in chat.

Automating Data Collection and Control

Once the bridge is running, you can ask the AI to:

  • Schedule readings: “Read every 30 seconds and store in a CSV file.”
  • Set alerts: “Send me a Telegram message if the temperature exceeds 60°C.”
  • Control actuators: “Write a coil value 1 to relay at register 0x0005 to start the pump.”

Because the AI generates the script, you don't need to know the Modbus register map in advance — just paste it into the chat if you have it, or let the AI probe common registers.

What If You Don't Have a Bridge? Use execute_python for Anything

If you're connecting a device that isn't RS‑485 (or don't want to run the bridge), ASI Biont also has a universal execute_python mode. The AI writes a Python script using pyserial, paho-mqtt, pymodbus, aiohttp, or any library — and runs it in a sandbox with a 30-second execution timeout.

This means you can connect to any device or API:

  • A Raspberry Pi GPIO sensor
  • An industrial PLC via Snap7
  • A cloud service via HTTP API

Just tell the AI in chat:

“Connect to my Siemens S7 PLC at 192.168.1.10 and read DB1.DBD0.”

The AI will generate and execute the appropriate Python code using snap7 or pymodbus. No waiting for vendor support — the integration is written on the fly.

Real‑World Experience and Pitfalls

I've integrated several RS‑485 meters this way. Here are the lessons learned:

  1. Wiring errors are the #1 issue. A/B swapped or missing ground causes timeouts. Always double-check the pinout.
  2. Baud rate and parity matter. Modbus RTU defaults are 9600 8N1, but some devices use 19200 or even odd parity. Set the correct values in the bridge launch command.
  3. CRC is non-negotiable. If you manually craft Modbus frames, a wrong CRC will make the device ignore you. Use a library like pymodbus whenever possible.
  4. The bridge's 10 Hz rate limit is enough for most monitoring. Don't try to poll faster than that.
  5. For long-running tasks, don't use while True in execute_python — it will hit the 30-second timeout. Use a scheduled task or the bridge's built-in polling (--rate parameter).

Why This Matters

In traditional industrial automation, integrating a new device takes days — reading datasheets, writing PLC code, debugging endpoints. With ASI Biont, the AI does the heavy lifting in seconds. You describe the task in natural language, review the generated code, and let it run. This is a game-charger for OT/IT convergence.

Get Started Now

Try it yourself: visit asibiont.com, download the Hardware Bridge, and connect your first RS‑485 device. Whether it's an energy meter, a temperature sensor, or a full PLC — ASI Biont can talk to it. Start the conversation today.

← All posts

Comments