Introduction
Serial ports refuse to die. RS‑232, the granddaddy of industrial communication, still hums in countless CNC machines, PLCs, environmental sensors, and lab equipment. Yet most of these devices have no built-in networking, no cloud connectivity, and no easy way to log or automate their data. Enter ASI Biont, an AI agent that can speak RS‑232 natively—no custom firmware, no middleware server, just a Python bridge and a chat conversation. In this guide, we’ll show you exactly how to connect a COM‑port device to ASI Biont, automate data collection, and control actuators with nothing more than a few sentences in a chat window.
Why connect an RS‑232 device to an AI agent?
RS‑232 is slow (typically 9600–115200 baud) and point‑to‑point, but it’s deterministic and ubiquitous. By bridging it to an AI agent you gain:
- Intelligent logging: AI can parse raw hex or ASCII responses, detect anomalies, and store structured data.
- Event‑driven automation: trigger SMS/Telegram alerts when a sensor reading exceeds a threshold, or send commands back to the device when conditions change.
- Zero‑code integration: you don’t write a single line of Python yourself—the AI writes it for you, runs it in a sandbox, and even debugs errors.
ASI Biont connects to RS‑232 devices through its Hardware Bridge—a lightweight bridge.py script you run on any Windows, Linux, or macOS machine with a physical COM port. The bridge connects to ASI Biont over a WebSocket (the only channel), and the AI agent talks to the serial port using the industrial_command tool with the serial_write_and_read command.
How the bridge works
- Download bridge.py from the ASI Biont dashboard (Devices → Create API Key → Download bridge). No GitHub, no Git – only the dashboard.
- Run it with your API token and the COM port parameters:
bash pip install pyserial requests websockets python bridge.py --token=YOUR_API_TOKEN --ports=COM3 --baud 115200 --rate=10 - The bridge opens COM3 at 115200 baud and waits for commands from the AI. Every command is an atomic
serial_write_and_read(data=hex_string)– the bridge sends the data and immediately reads the response.
Real‑world use case: Arduino temperature logger
Imagine you have an Arduino Uno with a DHT22 sensor, connected to your PC via USB (virtual COM port). It prints temperature and humidity every second in the format T:23.5 H:65. You want the AI agent to log these values, store them in a CSV, and alert you if the temperature goes above 30°C.
Step 1 – Tell the AI what you need
In the ASI Biont chat, you write:
"Connect to COM3 at 115200 baud. Read the serial data stream, parse lines that match
T:%.1f H:%.1f, store them in an SQLite database, and send me a Telegram message if temperature exceeds 30.0."
The AI doesn’t need a dashboard button. It understands natural language and generates the integration code automatically.
Step 2 – AI generates and executes the bridge commands
Behind the scenes, the AI uses industrial_command to first verify the connection:
# AI sends this via the chat tool (not user-visible, but for illustration)
from asibiont import industrial_command
response = industrial_command(
protocol='serial://',
command='serial_write_and_read',
data='48454c500a' # hex for "HELP\n"
)
# If device supports HELP protocol, it returns a list of commands.
Then it sets up a continuous logging loop using execute_python (which runs in the cloud sandbox with database access). Note: the sandbox has a 30‑second timeout, so we use a single fire‑and‑forget script that collects data for that window.
# This script runs remotely in ASI Biont’s execute_python sandbox
import pyserial
import sqlite3
import datetime
# Connect to bridge via WebSocket? No – execute_python cannot access COM ports directly.
# Instead, the AI uses the bridge's serial_write_and_read for each request.
# But for streaming, the AI would set up a relay: bridge reads continuously and pushes to a queue.
# Simplified example: AI asks bridge to send a command, receives one reading.
# The actual logging is orchestrated by the AI calling industrial_command repeatedly.
# For a full streaming solution, see the MQTT pattern below.
Important: The execute_python sandbox has no local COM port access. For streaming data, the recommended pattern is to use an intermediate MQTT broker: an Arduino publishes sensor data via MQTT, and the AI subscribes to that topic. But if you’re stuck with RS‑232, the bridge’s serial_write_and_read is the atomic operation; you can poll at your desired interval.
Step 3 – AI creates an automated rule
The AI can set up a recurring task (e.g., every 60 seconds) that executes a Python script in the sandbox. That script calls industrial_command to perform a serial read, parses the result, logs to a database, and conditionally sends an alert. All of this is configured through chat.
Advanced scenario: Control a servo via RS‑232
Many low‑end industrial robots and motion controllers accept ASCII commands over RS‑232. For example, a Pololu Maestro servo controller responds to commands like 0, 8000\r (set servo 0 to 8000 microseconds).
Chat prompt:
"Send command to COM4 at 9600 baud: set servo 0 to position 6000. Wait 2 seconds, then set it to 8000. Confirm each response."
The AI uses:
# industrial_command call (serial_write_and_read)
industrial_command(
protocol='serial://',
command='serial_write_and_read',
data='302c20363030300d' # hex for "0, 6000\r"
)
# response bytes echoed back
No manual hex conversion needed – the AI handles that with _parse_data_field(). It also supports escape sequences like BLUE_ON\n.
Other connection methods that complement RS‑232 devices
While RS‑232 is the focus, ASI Biont can also connect to the same device through other channels if you upgrade the hardware:
| Interface | Method | Typical use case |
|---|---|---|
| MQTT | execute_python with paho‑mqtt |
ESP32 with DHT22 → MQTT broker → AI agent |
| Modbus TCP | industrial_command with read_registers |
PLC with serial‑to‑Ethernet converter |
| HTTP API | execute_python with aiohttp |
Smart thermostat with REST API |
| CAN bus | industrial_command with send_frame |
Automotive sensor node |
The real power is that you can mix protocols – use RS‑232 for legacy machines and MQTT for new sensors, all orchestrated by the same AI agent.
Why this approach beats traditional integration
- No coding required: You never write a line of Python. Describe what you want in plain English, and the AI writes, debugs, and runs the code.
- No infrastructure: The bridge runs on any PC; the AI agent runs in the cloud. No servers to configure.
- Immediate results: Connection in seconds. Change baud rate or port – just ask.
- Extensible: If your device changes from RS‑232 to Ethernet, the AI can switch to Modbus TCP or HTTP with zero re‑wiring.
Real‑world example: Water treatment plant
A mid‑sized water treatment facility uses an old pH meter that outputs ASCII data over RS‑232 (e.g., pH:7.2, Temp:22.1). Previously, an operator checked it every two hours. By connecting it to ASI Biont via a Raspberry Pi running the Hardware Bridge, the AI agent now:
- Reads pH every minute.
- Stores readings in PostgreSQL (on cloud via sandbox).
- Checks trend: if pH deviates more than 0.5 from setpoint, it alerts the maintenance team via Telegram and logs the event.
- Generates a weekly report PDF with matplotlib (available in sandbox) and emails it.
The entire integration took 15 minutes of chat conversation. No Python IDE, no Git, no deployment pipelines.
Getting started today
- Sign up at asibiont.com.
- Create an API key from the dashboard.
- Download
bridge.py(the only way to get it). - Connect your RS‑232 device (check baud rate, parity, etc.).
- Run
python bridge.py --token=... --ports=COM3. - Open the chat and say: “Connect to COM3, read the serial stream, and alert me if the data shows a temperature above 30°C.”
The AI will handle the rest. You can iterate – add logging, change thresholds, or control outputs – all through conversation.
Conclusion
RS‑232 isn’t dead – it’s hiding inside thousands of reliable, field‑tested devices. ASI Biont gives you a modern AI interface to these legacy workhorses without touching their firmware. Whether you’re logging a greenhouse sensor, controlling a CNC spindle, or monitoring a chemical reactor, the combination of a simple hardware bridge and an intelligent chat‑based agent turns any serial device into a smart, connected node. Try it yourself today at asibiont.com – you’ll be surprised how far a few sentences and an old COM port can take you.
Comments