COM / RS-232 Integration with ASI Biont: No-Code AI Automation for Industrial Serial Devices
Imagine a warehouse scale that sends weight data over RS-232—and an AI agent that reads it, logs it to a database, and alerts your team when inventory runs low. Or a barcode scanner on a production line that triggers automatic reordering in your ERP system. This is not a futuristic vision; it’s possible today with ASI Biont and a simple COM-port connection.
Serial interfaces like RS-232 and RS-485 are the backbone of industrial instrumentation: scales, barcode scanners, GPS receivers, PLCs, and measurement devices. According to the International Electrotechnical Commission (IEC 61131-2), RS-232 remains the most common point-to-point interface for industrial sensors. Yet integrating these devices with modern AI-driven workflows usually requires custom scripting, middleware, and dedicated engineers. ASI Biont eliminates that barrier.
This article is a practical guide to connecting any RS-232/RS-485 device to ASI Biont—without writing a single line of integration code. You’ll learn how the Hardware Bridge works, see real code examples for a warehouse scale and a GPS tracker, and discover how conversational AI automates your entire serial communication workflow.
Why Connect a COM-Port Device to an AI Agent?
A COM-port device is a data source. A scale outputs weight strings; a GPS receiver outputs NMEA sentences; a barcode scanner outputs product codes. Traditionally, you’d write a Python script with pyserial, parse the data, and build a dashboard. This works, but it’s rigid: changing logic requires code updates, new devices need new scripts, and AI capabilities like anomaly detection or natural‑language querying are absent.
ASI Biont flips the model. You connect the device once via the Hardware Bridge, and then you talk to the AI agent. You can ask: “What was the average weight of pallet #23 last hour?” or “Alert me if the barcode scanner reads the same code twice in one minute.” The AI agent writes the parsing and decision logic on the fly, runs it in a secure sandbox, and sends commands back through the same bridge. No dashboard, no YAML files—just conversation.
How ASI Biont Connects to COM / RS-232 Devices
ASI Biont does not have direct access to your physical COM ports—it runs in the cloud. The connection is established via a lightweight Hardware Bridge (bridge.py) that you run on your local PC (Windows, Linux, or macOS). The bridge connects to ASI Biont over a single WebSocket channel. Once connected, the AI agent can send commands to your serial device using the industrial_command tool.
The Hardware Bridge Architecture
The bridge is a Python application (~200 lines) that uses pyserial for serial communication. It registers with ASI Biont using a unique token. The only way the cloud talks to the bridge is via WebSocket—there is no HTTP server on localhost. All commands are atomic serial_write_and_read(data=hex_string) operations: the bridge writes a hex-encoded string to the port and immediately reads the response.
Key parameters you specify:
- --token=YOUR_TOKEN (required, generated in the ASI Biont dashboard)
- --ports=COM3 (comma-separated list of COM ports)
- --baud=115200 (baud rate, default 9600)
- --rate=10 (rate limiter, messages per second)
Example launch command:
pip install pyserial requests websockets
python bridge.py --token=abc123 --ports=COM3 --baud=9600 --rate=5
When the AI agent calls industrial_command(protocol='serial://', command='serial_write_and_read', data='48454c500a'), the bridge decodes 48454c500a (hex for HELP\n), writes it to COM3, and returns the device’s response. The AI can also send raw strings and escape sequences via _parse_data_field().
For Windows Reliability
On Windows, pyserial sometimes fails with overlapped I/O. The bridge automatically handles this: it calls CancelIoEx to cancel pending operations, PurgeComm to clear buffers, and falls back to synchronous WriteFile. This ensures robust writes even with problematic USB-to-serial adapters.
Use Case 1: Industrial Scale for Warehouse Inventory
Scenario: You have a Dibal or Mettler Toledo scale connected via RS-232 to COM3 at 9600 baud. The scale outputs a string like +000.500 kg\r\n when a weight is stable. You want ASI Biont to read weight every 10 seconds, log it to a PostgreSQL database, and send a Telegram alert if weight exceeds 1000 kg.
Step 1: Connect the Scale
In the ASI Biont chat, you describe:
“Connect to COM3 at 9600 baud, scale outputs weight in format
+XXX.XXX kg. Read every 10 seconds and log to PostgreSQL.”
The AI agent writes a Python script using pyserial (via the bridge) and psycopg2 (in the sandbox). Because the bridge handles serial I/O, the script uses industrial_command to send a read request.
AI-generated script (simplified):
import asyncio
import psycopg2
from datetime import datetime
# Bridge command function is provided by ASI Biont sandbox
async def read_weight():
# The AI calls industrial_command internally
response = await industrial_command(
protocol='serial://',
command='serial_write_and_read',
data='' # scale may output continuously; bridge reads buffer
)
return response
async def main():
conn = psycopg2.connect(
host='your-db-host',
dbname='warehouse',
user='admin',
password='secret'
)
cur = conn.cursor()
while True:
raw = await read_weight()
if raw and 'kg' in raw:
weight = float(raw.split()[0]) # e.g., +000.500
timestamp = datetime.now()
cur.execute(
"INSERT INTO weights (timestamp, value) VALUES (%s, %s)",
(timestamp, weight)
)
conn.commit()
if weight > 1000.0:
await send_telegram_alert(f"Overweight: {weight} kg")
await asyncio.sleep(10)
asyncio.run(main())
Note: The while True loop is only for illustration. In practice, the sandbox has a 30-second timeout; for persistent monitoring, the AI agent runs the script periodically via the scheduler (not covered in this article).
Step 2: Real-time Queries
Once the data flows, you can ask the AI:
“What was the total weight of all pallets today?”
The AI executes a SQL query:
SELECT SUM(value) FROM weights WHERE timestamp >= CURRENT_DATE;
And returns the result in natural language.
Use Case 2: GPS Tracker for Fleet Management
Scenario: A u-blox NEO-6M GPS module sends NMEA sentences (e.g., $GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47) via COM3 at 115200 baud. You want to track vehicle location and plot routes.
Step 1: Parse NMEA
You tell the AI:
“Read NMEA sentences from COM3 at 115200 baud. Parse GPGGA sentences, extract latitude, longitude, and altitude. Store in MongoDB.”
The AI generates a script using pynmea2 (available in the sandbox):
import asyncio
import pynmea2
from pymongo import MongoClient
async def read_nmea():
raw = await industrial_command(
protocol='serial://',
command='serial_write_and_read',
data='' # continuous stream
)
return raw
async def main():
client = MongoClient('mongodb://localhost:27017/')
db = client['fleet']
collection = db['gps']
while True:
raw = await read_nmea()
for line in raw.split('\n'):
if line.startswith('$GPGGA'):
msg = pynmea2.parse(line)
record = {
'timestamp': msg.timestamp,
'lat': msg.latitude,
'lon': msg.longitude,
'altitude': msg.altitude
}
collection.insert_one(record)
await asyncio.sleep(1)
asyncio.run(main())
Step 2: Route Visualization
You can ask:
“Show me the last 10 GPS points on a map.”
The AI generates a folium map (via folium in sandbox) and returns the HTML as a file attachment.
Alternative Connection Methods for Serial Devices
If your device is not directly connected to a PC, ASI Biont supports other methods to reach serial interfaces:
| Method | When to Use | How AI Connects |
|---|---|---|
| Hardware Bridge (COM) | Device on same PC via USB/serial | WebSocket → bridge → pyserial |
| SSH to SBC | Device on Raspberry Pi/BeagleBone | AI writes paramiko script in sandbox |
| MQTT | ESP32/Arduino publishes serial data | AI subscribes via paho-mqtt in sandbox |
| Modbus/TCP | PLC with serial-to-Ethernet converter | AI uses pymodbus via industrial_command |
For example, if your scale is connected to an ESP32 that publishes weight via MQTT, you’d use the MQTT method instead of the bridge.
Why No-Code Integration Matters
Traditional serial integration requires:
- Knowledge of pyserial and binary protocols
- Writing and maintaining Python scripts
- Setting up databases, alerts, and dashboards separately
- Debugging port conflicts and baud rate mismatches
With ASI Biont, you simply describe the device and the desired behavior. The AI agent:
1. Determines the correct connection method (bridge, SSH, MQTT, etc.)
2. Generates the Python integration code using pyserial, paramiko, paho-mqtt, or any of the 14 supported protocols
3. Executes the code in a secure sandbox (30-second timeout for scripts)
4. Handles errors and retries automatically
If your device is a barcode scanner, a pH meter, or a CNC machine with RS-232 output, the same pattern applies. You can even combine multiple devices in one conversation: “Read weight from COM3 and barcode from COM5; when barcode matches product X, log weight to Excel.”
Step-by-Step: Connecting Your First COM Device
- Install bridge.py – Download from ASI Biont dashboard (Devices → Create API Key → Download bridge). Do not use GitHub – the only source is your dashboard.
- Run the bridge – Open terminal:
python bridge.py --token=YOUR_TOKEN --ports=COM3 --baud=9600 - Verify connection – In chat, ask: “Send HELP command to COM3 and show response.” The AI uses
industrial_command(protocol='serial://', command='serial_write_and_read', data='48454c500a'). - Define automation – Describe what you want: “Read weight every 5 seconds, if above 500 kg send email to warehouse@company.com.”
- Monitor and iterate – Data flows, alerts work, and you can refine logic conversationally.
Conclusion
COM-port devices are not legacy—they are the most reliable and widespread industrial interfaces. With ASI Biont, you don’t need to be a Python developer to turn their data into actionable intelligence. The Hardware Bridge bridges the physical and digital worlds, and the AI agent writes, executes, and maintains the integration logic for you.
Whether you run a warehouse with scales, a factory with PLCs, or a fleet with GPS trackers, ASI Biont’s COM / RS-232 integration lets you automate without code. No dashboards, no DevOps—just a conversation with an AI that understands industrial protocols.
Ready to connect your first serial device? Try it now at asibiont.com. Download the bridge, plug in your device, and tell the AI what to do. The future of industrial automation starts with a chat message.
Comments