Bring Your Factory PLC into the AI Era: Integrating Modbus/TCP Controllers with ASI Biont

The Silent Language of Industrial Machinery

For decades, interacting with a PLC meant either standing in front of a panel with a programming laptop, or building a full SCADA system. Both are time‑consuming, expensive, and rigid. When something goes wrong at 2 AM, the maintenance engineer often has no way to remotely check a register without a pre‑configured dashboard.

ASI Biont changes this. It is an AI agent that connects directly to industrial equipment over standard protocols – and you don’t need to write a single line of Modbus client code. You simply describe what you need in natural language, and the AI does the rest.

This article is a practical guide to integrating Modbus/TCP‑enabled devices (PLCs, RTUs, drives, meters) with ASI Biont. We will cover how the connection works, walk through real‑world examples of reading and writing registers via chat, and show how to build an automated monitoring script that sends alerts to your phone. No prior AI or Modbus expertise required – just a PLC with an Ethernet port and a desire to make it smarter.

What is Modbus/TCP and Why Connect an AI Agent?

Modbus/TCP is the dominant open protocol in industrial automation. It uses a client‑server model over TCP/IP (port 502), where the client (here, ASI Biont) sends a request and the server (PLC, RTU) responds. Common operations include reading holding registers (read_registers), writing single registers (write_register), reading coils (read_coils), and writing coils (write_coil).

Connecting an AI agent to this ecosystem brings three immediate benefits:

  1. Zero‑code integration – No need to compile a Modbus client. The AI already knows the protocol and can handle framing, byte ordering, and unit IDs.
  2. Natural‑language interface – Ask “What is the boiler temperature now?” instead of memorising register 40001.
  3. Actionable intelligence – The AI can analyse trends, compare values from multiple registers, and trigger external actions (e.g., send a Telegram message) without a separate SCADA logic engine.

How ASI Biont Connects to Modbus/TCP Devices

ASI Biont runs in the cloud, but its industrial_command tool allows it to directly communicate with any device reachable over TCP. For Modbus/TCP, the AI uses the pymodbus library under the hood, exposed through the following commands:

Command Description
read_registers Read one or more holding registers (16‑bit values)
write_register Write a single 16‑bit value to a holding register
read_coils Read the state of one or more digital outputs (coils)
write_coil Set a coil to ON or OFF

All commands are sent via the chat interface. The user provides the IP address, port (default 502), and unit identifier (slave ID) if required. The AI executes the request and returns the result – plus a plain‑English interpretation.

Network requirement: The PLC must be reachable from the ASI Biont servers. If your PLC is behind a corporate firewall, use a VPN tunnel (e.g., WireGuard) or a secure TCP forwarder. For quick testing, a cloud‑hosted Modbus simulator (like pymodbus.simulator) can be used – the AI can even help you set one up.

Real‑World Scenario: Remote Boiler Monitoring

Imagine a factory with a Mitsubishi FX‑series PLC controlling a steam boiler. The PLC exposes three holding registers:

Register Description Scaling
100 Water temperature (°C) raw × 0.1
101 Steam pressure (bar) raw × 0.01
200 Burner state (coil) ON/OFF

Step 1: Connect and Read a Register

The engineer opens ASI Biont chat and types:

Connect to Modbus PLC at 192.168.1.100:502, unit ID 1. Read holding register 100 and tell me the temperature.

ASI Biont internally calls:

industrial_command(
    protocol='modbus',
    command='read_registers',
    ip='192.168.1.100',
    port=502,
    unit=1,
    start_address=100,
    count=1
)

The response is a raw value (e.g., 253). Because the AI knows the scaling from the user description (or from a previous context), it replies:

Temperature is 25.3 °C. That is within the normal range.

No dashboard, no Python script – just a conversation.

Step 2: Write a Coil to Start a Backup Pump

Fifteen minutes later, the pressure rises. The engineer types:

If pressure (register 101) > 7.0 bar, set coil 200 to ON to start the backup pump.

ASI Biont first reads register 101, converts the raw value (e.g., 850 → 8.5 bar), evaluates the condition, and then writes:

industrial_command(
    protocol='modbus',
    command='write_coil',
    ip='192.168.1.100',
    port=502,
    unit=1,
    address=200,
    value=True
)

The AI confirms: Pressure 8.5 bar exceeds threshold. Backup pump started (coil 200 set to ON).

Step 3: Build an Automated Alert via Python

Manual queries are useful, but continuous monitoring is better. ASI Biont allows the AI to write and execute Python scripts in its secure sandbox (execute_python). The engineer asks:

Write a Python script that every hour reads registers 100, 101, and coil 200. If temperature > 80 °C or pressure > 9.0 bar, send a Telegram alert.

Important: The sandbox has a 30‑second execution limit, so while True loops are not allowed. For periodic tasks, you can run the script on an external cron scheduler or use the AI's built‑in scheduler (if available). For this example, we create a script that performs a single read‑analyze‑alert cycle – the user can then schedule it externally.

The AI generates the following script:

import requests
import logging
from pymodbus.client import ModbusTcpClient

# Telegram configuration (user provides these)
TELEGRAM_TOKEN = "YOUR_BOT_TOKEN"
TELEGRAM_CHAT_ID = "YOUR_CHAT_ID"

# Modbus configuration
PLC_IP = "192.168.1.100"
PLC_PORT = 502
UNIT_ID = 1

client = ModbusTcpClient(PLC_IP, port=PLC_PORT, timeout=5)
try:
    client.connect()
    # Read registers
    temp_raw = client.read_holding_registers(100, 1, unit=UNIT_ID)
    press_raw = client.read_holding_registers(101, 1, unit=UNIT_ID)
    burner_coil = client.read_coils(200, 1, unit=UNIT_ID)

    if not (temp_raw.isError() or press_raw.isError() or burner_coil.isError()):
        temperature = temp_raw.registers[0] * 0.1
        pressure = press_raw.registers[0] * 0.01
        burner = burner_coil.bits[0]

        alert = False
        message_parts = []
        if temperature > 80:
            message_parts.append(f"Temperature {temperature:.1f}°C exceeds 80°C")
            alert = True
        if pressure > 9.0:
            message_parts.append(f"Pressure {pressure:.2f} bar exceeds 9.0 bar")
            alert = True

        if alert:
            alert_text = "\n".join(message_parts)
            requests.post(
                f"https://api.telegram.org/bot{TELEGRAM_TOKEN}/sendMessage",
                json={"chat_id": TELEGRAM_CHAT_ID, "text": f"⚠️ Boiler alert:\n{alert_text}"}
            )
            print("Alert sent.")
        else:
            print("All values normal.")
    else:
        print("Modbus read error")
finally:
    client.close()

The AI runs this script in the sandbox, performs the check, and sends an alert if needed. The engineer can then ask the AI to schedule the script using a cron‑like command (if the platform supports it) or set up a cron job on a Raspberry Pi that calls the ASI Biont API to trigger the same script.

Beyond the Basics: Multi‑Device Orchestration

Because ASI Biont can connect to any device via its industrial_command tool or through execute_python with any supported library, you can combine Modbus data with other systems. For example:

  • Read a PLC register, then write a tag to a Siemens S7 controller (using snap7)
  • Query a Modbus energy meter and store the data in a PostgreSQL database (using psycopg2)
  • If a motor coil is ON, turn on an ESP32‑connected relay via MQTT

All of this is achieved through a single conversation. The AI writes the glue code on‑the‑fly, using whichever protocol library is needed – pymodbus, paho.mqtt, snap7, bac0, or plain HTTP with aiohttp.

Why This Approach Wins

Traditional SCADA integration requires: commissioning a data historian, writing scripted blocks, and maintaining a UI. With ASI Biont, the AI acts as both the integration engineer and the user interface. The benefits are concrete:

  • No Modbus driver development – the AI speaks Modbus natively.
  • Immediate value – get the first register reading in under 30 seconds.
  • Adaptive logic – change thresholds by simply typing “raise the pressure limit to 10.5 bar”.
  • One tool to rule them all – Modbus, MQTT, BACnet, EtherNet/IP, and dozens of other protocols under a single chat interface.

Get Started with Your Own PLC

You don't need to install any bridge software for Modbus/TCP – just make your PLC reachable and open a chat with ASI Biont. Describe your equipment, provide the IP and register map, and start reading data instantly.

For devices behind strict NAT or firewalls, the Hardware Bridge can tunnel low‑level serial or even encapsulate Modbus TCP over WebSocket – but for most Ethernet‑connected PLCs, the direct TCP connection works out of the box.

Ready to give your factory floor a voice? Try ASI Biont now at asibiont.com and tell it: “Connect to my Modbus PLC at 10.0.0.50 and read registers 100 to 110.”

Your old SCADA never answered back. Your AI agent does.

← All posts

Comments