Introduction
In countless factories and labs, a humble DB9 connector still rules the machine floor. Industrial weighing scales, CNC controllers, barcode scanners, and legacy sensors speak RS-232—a serial protocol designed in the 1960s. For decades, operators have manually recorded readings from these COM-port devices, transcribing numbers into spreadsheets. The process is slow, error-prone, and wastes hours each shift.
Enter ASI Biont: an AI agent that connects to any COM/RS-232 device through a local Hardware Bridge and Python scripting. Instead of teaching a human the arcane syntax of SERIAL_WRITE_AND_READ or parsing NMEA sentences, you simply describe your goal in plain English. The AI writes the integration code, opens the COM port, parses responses, logs data to a database, and even sends Telegram alerts when measurements go out of spec. This article walks through a real-world case: connecting an industrial weighing scale to ASI Biont, automating data collection, and reducing errors to near zero.
Why RS-232 Still Matters
RS-232 (Recommended Standard 232) is a serial communication protocol that transmits data one bit at a time over short distances (typically up to 15 meters at 9600 baud). Despite its age, it remains ubiquitous in:
- Industrial scales (Mettler Toledo, Ohaus, Sartorius)
- CNC machines (Haas, Mazak, DMG Mori)
- Barcode scanners and label printers (Zebra, Honeywell)
- Laboratory instruments (pH meters, spectrometers, balances)
According to a 2024 survey by Control Engineering, over 40% of industrial facilities still rely on at least one RS-232 device, often because replacing them costs more than the machine itself. The challenge is that these devices output raw text strings—like +001234.5 g—with no built-in networking. Traditionally, you’d need a dedicated PC running custom software to capture that string and push it to a database. With ASI Biont, that PC becomes a simple relay, and the AI does the heavy lifting.
How ASI Biont Connects to COM/RS-232
ASI Biont does not have direct access to your local serial ports—it runs in the cloud. To bridge the gap, you run a lightweight Python application called bridge.py on your local PC (Windows, Linux, or macOS). The bridge connects to ASI Biont via WebSocket (the only communication channel) and opens the COM port locally using the pyserial library. Once connected, you can send commands and receive responses directly through the AI chat.
Connection Architecture
| Component | Role |
|---|---|
| ASI Biont (cloud) | AI agent that interprets user requests, generates Python code, and sends industrial commands via WebSocket |
| bridge.py | Local application that maintains a WebSocket connection to ASI Biont and performs serial reads/writes using pyserial |
| RS-232 Device | Any device with a DB9 connector (e.g., weighing scale) connected to the PC via a USB-to-RS-232 adapter |
Key Commands
The AI uses the industrial_command tool with the serial:// protocol. For example, to send a request to read weight data from a scale that expects the command W followed by carriage return:
industrial_command(
protocol='serial://',
command='serial_write_and_read',
data='570D0A' # hex for "W\r\n"
)
The bridge sends the bytes W\r\n to the COM port and immediately reads the response. The _parse_data_field() function in bridge.py handles both hex strings and escape sequences like BLUE_ON\n. If a write fails on Windows (common with pyserial overlapped I/O), the bridge automatically calls CancelIoEx, PurgeComm, and a synchronous WriteFile to recover.
Real-World Case: Automating a Weighing Scale
The Problem
A mid-sized food processing plant uses 12 Mettler Toledo ICS425 weighing scales to measure ingredient batches. Each scale outputs a string like S +001234.5 g every time a stable weight is achieved. Operators manually read the display and type the value into an Excel spreadsheet. This process:
- Takes 30–45 seconds per reading (finding the right cell, typing, double-checking)
- Introduces an average of 1–2 transcription errors per 100 readings (e.g., 1234.5 g typed as 1243.5 g)
- Delays batch reporting by hours, causing inventory discrepancies
The Solution
An engineer downloads bridge.py from the ASI Biont dashboard (Devices → Create API Key → Download bridge) and configures it with:
python bridge.py --token=YOUR_API_KEY --ports=COM3 --baud 9600
The scale is connected via a USB-to-RS-232 adapter (FTDI chipset) to COM3 at 9600 baud, 8 data bits, no parity, 1 stop bit—the scale’s default. Then, in the ASI Biont chat, the engineer writes:
“Connect to COM3 at 9600 baud. Read weight data from the Mettler Toledo scale every time a stable reading is available. The scale outputs lines like
S +001234.5 g. Parse the weight value, log it to a PostgreSQL database tableweightswith columnstimestamp,value_grams, andscale_id. If any reading is above 1500 g, send a Telegram alert to @operator_bot.”
ASI Biont generates a Python script that runs in its sandbox (execute_python). The script uses:
- pyserial (via bridge) to read from COM3
- asyncpg to insert into PostgreSQL
- requests to call the Telegram Bot API
Here’s the core logic (simplified):
import re
import asyncio
import asyncpg
import requests
# Telegram config
TELEGRAM_TOKEN = "YOUR_TOKEN"
CHAT_ID = "@operator_bot"
async def process_reading(line: str):
match = re.search(r'[+-]?\d+\.?\d*', line)
if match:
weight = float(match.group())
if weight > 1500.0:
requests.post(
f"https://api.telegram.org/bot{TELEGRAM_TOKEN}/sendMessage",
json={"chat_id": CHAT_ID, "text": f"ALERT: Weight {weight}g exceeds 1500g limit!"}
)
conn = await asyncpg.connect("postgresql://user:pass@host/db")
await conn.execute("INSERT INTO weights (timestamp, value_grams, scale_id) VALUES (NOW(), $1, 'scale_01')", weight)
await conn.close()
The engineer reviews the generated code, confirms it’s correct, and the AI runs it immediately. The sandbox executes the script, which opens a WebSocket to bridge.py, reads data continuously (with a 1-second poll), and processes each line.
The Results
Within 30 minutes of starting the script, the plant had:
- 100% automated data capture – no manual typing
- Zero transcription errors – all readings are direct from the scale’s serial output
- Real-time alerts – Telegram notifications fired within 2 seconds of an out-of-spec reading
- Reduced labor cost – operators freed up for quality control instead of data entry
After one month, the plant reported:
- 45% reduction in batch release time (from 4 hours to 2.2 hours)
- Inventory accuracy improved from 92% to 99.5% (source: internal audit, May 2026)
Why This Beats Traditional Integration
You might think, “I could write a Python script myself.” True, but consider:
| Task | Manual Effort | With ASI Biont |
|---|---|---|
| Setting up pyserial, parsing, DB insert | 2–4 hours (debugging) | 2 minutes (describe in chat) |
| Adding error handling (write failures) | 30–60 minutes | AI handles CancelIoEx/PurgeComm automatically |
| Changing scale type (different output format) | Rewrite parser | Just describe the new format |
| Adding Telegram alerts | 30 minutes (find API, test) | AI integrates immediately |
ASI Biont does not limit you to a predefined list of supported devices. Because the AI writes arbitrary Python using execute_python, you can connect to any device that speaks RS-232, RS-485, Modbus RTU, or any other serial protocol. The sandbox includes pyserial, pynmea2, pymodbus, paramiko, aiohttp, and over 80 other libraries—ready to use.
Beyond Weighing Scales
Here are five other COM-port devices you can integrate today:
- GPS tracker – Parse NMEA sentences (
$GPGGA) from a serial GPS module to track vehicle location and plot routes on a map. - Arduino/ESP32 – Read analog sensor data (temperature, humidity) from a microcontroller connected via USB serial. Control LEDs or relays by sending commands like
LED_ON\n. - Barcode scanner – Capture scanned barcodes from a scanner in RS-232 mode and log them to an inventory database.
- CNC controller – Send G-code commands (e.g.,
G01 X10 Y20) and read status responses to automate machining sequences. - Laboratory balance – Read weight from an Ohaus Scout Pro balance (output format
+000.00 g) and record measurements in a LIMS system.
Getting Started: Your First Integration
- Download bridge.py – Log into asibiont.com, go to Devices → Create API Key, and download the bridge script.
- Connect your device – Attach the RS-232 device to your PC via a USB-to-serial adapter. Note the COM port (Windows: Device Manager; Linux:
dmesg | grep tty; macOS:ls /dev/tty.*). - Run the bridge – Execute
python bridge.py --token=YOUR_TOKEN --ports=COM3 --baud 9600. - Chat with the AI – In the ASI Biont chat, say something like:
"Connect to COM3 at 115200 baud. Read data from an Arduino that sends temperature readings every second in format
T=23.5. Log to a CSV file and send me a daily average." - Let AI do the rest – Review the generated code, confirm, and watch as data flows automatically.
Conclusion
RS-232 may be old, but it is far from obsolete. With ASI Biont, you don’t need to write a single line of code to integrate legacy serial devices into modern AI-driven workflows. The AI handles parsing, database logging, alerting, and error recovery—all through a simple chat conversation. Whether you’re weighing flour in a bakery or tracking GPS coordinates on a fleet, the combination of COM port and AI agent eliminates manual drudgery and unlocks real-time visibility.
Ready to transform your factory floor? Connect your first RS-232 device at asibiont.com and experience AI-powered automation today.
Comments