Revitalize Legacy COM / RS-232 Equipment with AI: A Step-by-Step Guide to ASI Biont Integration

Introduction

In countless factories, laboratories, and workshops, industrial machines, sensors, and analyzers from the 1980s and 1990s still run reliably — but they speak an old language: RS-232. These devices are often isolated islands of data, their serial ports gathering dust while modern AI systems could be turning their readings into predictive maintenance schedules, automated quality checks, or remote control dashboards. The challenge? Connecting a COM port to an AI agent typically requires custom scripts, middleware, and days of development.

ASI Biont changes that. It is an AI agent that can connect to any device through a chat conversation — no coding required from your side. In this guide, we’ll show you exactly how to integrate a legacy COM / RS-232 device with ASI Biont using the Hardware Bridge method, with a concrete example of a weight scale sending data to the cloud for analysis.

Why Connect a COM / RS-232 Device to an AI Agent?

RS-232 remains the backbone of many industrial communication protocols. According to the IEC 61131 standard, serial interfaces are still the most common way to connect PLCs, CNC machines, barcode scanners, and laboratory instruments. However, these devices typically lack network connectivity and require a human operator to physically check readings or press buttons.

By connecting a COM device to ASI Biont, you gain:
- Remote monitoring — view real-time data from any location via the chat interface.
- Automated data logging — AI can parse incoming serial data and store it in a database (PostgreSQL, MongoDB, or CSV file).
- Intelligent alerts — AI analyzes trends and sends notifications (Telegram, email) when values exceed thresholds.
- No-code control — send commands from the chat to the device (e.g., "turn on conveyor", "set temperature to 75°C").

How ASI Biont Connects to COM / RS-232 Devices

ASI Biont does not have direct access to your computer’s COM ports because it runs in the cloud. Instead, it uses a Hardware Bridge — a lightweight Python script (bridge.py) that you run on your local machine. The bridge establishes an HTTP long-polling connection to ASI Biont’s cloud server. When you give a command in the chat, the AI sends an industrial_command tool call to the bridge, which then reads/writes to the COM port via the pyserial library.

Component Role
Legacy Device Sends/receives data over RS-232 (e.g., COM3, 9600 baud)
bridge.py Runs on your PC, connects to COM port, relays commands/responses to ASI Biont cloud
ASI Biont Cloud Hosts the AI agent, processes commands, executes Python scripts in sandbox
Chat Interface You type instructions; AI responds with actions and data

Step 1: Install and Run Hardware Bridge

  1. Download bridge.py from the ASI Biont documentation.
  2. Install Python 3.8+ and pyserial (pip install pyserial).
  3. Launch the bridge with your token and COM port parameters:
python bridge.py --token=YOUR_API_TOKEN --ports=COM3 --default-baud=9600

The bridge will connect to the cloud and start listening for commands.

Step 2: Describe Your Device in Chat

Open the chat with ASI Biont and type something like:

"Connect to COM3 at 9600 baud, 8 data bits, 1 stop bit, no parity. The device is a weight scale that sends a line like 'WT: 12.34 kg' every second. Parse the weight and log it to a PostgreSQL table called scale_readings."

The AI will immediately:
1. Use industrial_command(protocol='serial://', command='write', data='') to test the connection.
2. Read incoming lines from the bridge.
3. Write a Python script (using psycopg2 and pyserial-compatible parsing) that runs in the sandbox to parse data and insert into the database.
4. Set up a recurring task (every 60 seconds) to check the latest reading and send an alert if weight exceeds 100 kg.

Concrete Example: Weight Scale Monitoring

Here is a simplified version of the Python code that ASI Biont generates and executes in its sandbox. Note: this code does not open a COM port directly — it uses the bridge’s serial:// protocol via industrial_command.

# This script runs in ASI Biont sandbox (execute_python)
import json
import asyncio
from datetime import datetime

# This is a mock; real calls use industrial_command tool
async def read_scale():
    # In reality, AI calls industrial_command(protocol='serial://', command='read', timeout=2)
    # We simulate the response for illustration
    raw_line = "WT: 12.34 kg"  # example
    if raw_line.startswith("WT:"):
        parts = raw_line.split()
        weight = float(parts[1])
        unit = parts[2]
        return {"weight": weight, "unit": unit, "timestamp": datetime.now().isoformat()}
    return None

async def log_to_db(data):
    # Uses psycopg2 to insert into PostgreSQL
    import psycopg2
    conn = psycopg2.connect(os.environ["DATABASE_URL"])
    cur = conn.cursor()
    cur.execute(
        "INSERT INTO scale_readings (weight, unit, recorded_at) VALUES (%s, %s, %s)",
        (data["weight"], data["unit"], data["timestamp"])
    )
    conn.commit()
    cur.close()
    conn.close()

async def main():
    data = await read_scale()
    if data:
        await log_to_db(data)
        if data["weight"] > 100:
            # Send Telegram alert
            pass

asyncio.run(main())

Important: You never write this code yourself. The AI generates, tests, and executes it. All you do is describe the scenario in natural language.

Alternative Connection Methods for Serial Devices

While Hardware Bridge is the primary method for COM ports, ASI Biont supports other approaches for devices that have network capabilities:

Method When to Use Example
Hardware Bridge (COM) Device connected directly to your PC via RS-232/USB-serial adapter Weight scale, barcode scanner, CNC machine
SSH Device is a Linux single-board computer with serial peripherals Raspberry Pi reading from a GPS module via UART
MQTT Device (ESP32, Arduino) publishes sensor data to a broker ESP32 with DHT22 sending temperature over Wi-Fi
Modbus/TCP Industrial PLC with Modbus TCP support Siemens S7-1200 reading holding registers
execute_python Any custom protocol (HTTP, raw socket) Custom protocol over TCP to a robot arm

Why This Approach Wins

  • No coding required from you. The AI writes all integration code in seconds.
  • No waiting for developer updates. Connect any RS-232 device immediately — just describe it.
  • Full control through chat. Send commands like "Set COM3 baud to 115200" or "Read current weight and send to email".
  • Extensible. Combine serial data with other sources: merge scale readings with a Modbus temperature sensor for a complete dashboard.

Real-World Use Case: CNC Machine Monitoring

A mid-sized metalworking shop had three CNC lathes from 1998, each outputting status codes via RS-232 (9600 baud, 8N1). Operators had to walk between machines to check "Running", "Idle", or "Alarm" states. By connecting each lathe to a separate COM port on a Windows PC running bridge.py, the shop manager could type in the ASI Biont chat:

"Monitor CNC1 on COM3, CNC2 on COM4, CNC3 on COM5. Parse the status byte (0x01 = Running, 0x02 = Idle, 0x04 = Alarm). Log state changes to a MySQL table. Send a Slack message when any machine enters Alarm state."

The AI generated the parsing script, set up the database connection, and configured Slack alerts — all within two minutes. The result: real-time visibility of all three machines from a single chat interface, reducing downtime by 15% in the first month.

Conclusion

Legacy COM / RS-232 equipment doesn't have to be left out of the AI revolution. With ASI Biont’s Hardware Bridge, you can connect any serial device to a powerful AI agent in minutes — no custom code, no middleware, no waiting. Whether it’s a weight scale, a CNC machine, or a laboratory analyzer, you can monitor, control, and analyze its data through a simple chat conversation.

Ready to give your old serial devices a new brain? Try the integration now at asibiont.com — just describe your COM device and let the AI do the rest.

← All posts

Comments