RS-485 + ASI Biont: How an AI Agent Tames Legacy Industrial Devices

1. The RS-485 Challenge

In industrial automation, RS-485 is everywhere. Electricity meters, heat computers, variable-frequency drives, PLCs — they all speak RS-485, often via the Modbus RTU protocol. But connecting these devices to modern software usually involves custom drivers, SCADA middleware, or manual polling scripts. When we add an AI agent to the mix, the question becomes: how do we give the AI ears to listen to a two-wire serial bus? This article shows a practical path: we connect an RS-485 device to ASI Biont, an AI agent that can generate its own integration code, and turn a physical serial port into a source of real-time industrial intelligence.

2. Understanding RS-485: A Backbone of Industry

RS-485 (TIA-485) is a standard for multi-point differential signaling. It supports up to 32 transceivers on a single bus and spans up to 1,200 meters without a repeater — that's why utility companies and factories still rely on it. The Modbus RTU protocol runs on top of RS-485, using a master-slave model with device addresses (Unit IDs). For example, an energy meter at address 1 may expose registers 0x0000 (voltage) and 0x0002 (power). You can read these registers with a simple Modbus PDU, but you still need a serial interface, correct baud rate, and CRC validation. This is where the Hardware Bridge comes in.

Here is a quick comparison between RS-232 and RS-485:

Feature RS-232 RS-485
Topology Point-to-point Multi-drop (up to 32)
Distance 15 m 1200 m
Speed 115 kbps typical 10 Mbps max
Voltage ±12 V Differential ±5 V

3. Why ASI Biont Changes the Game

Instead of writing a one-off Python script that only you understand, you describe the task to ASI Biont in natural language. For example: "Poll all heat meters on COM4, baud 9600, IDs 1 to 10, every 15 minutes, and save readings to SQLite." The AI agent then generates the Python code, schedules it, and even writes email templates for the report. The user doesn't need to know Modbus register maps; they just answer the AI's questions about port number and baud rate.

4. The Hardware Bridge: Bridging Physical and Digital

ASI Biont does not magically get access to your physical serial port. Instead, you use the Hardware Bridge (bridge.py), a small program that you download only from your ASI Biont dashboard. You launch it on a computer connected to an RS-485 adapter (USB-RS485 or a network gateway). The bridge takes care of the low-level bits, timing, and Modbus CRC. The AI agent communicates with the bridge via the industrial_command() function, which accepts protocol-specific commands.

Here is the launch command for a typical setup:

python bridge.py --token=XXX --ports=COM3 --baud 9600 --rate=10
  • --token – your dashboard-generated token
  • --ports – which COM port the RS-485 adapter uses
  • --baud – speed of the serial connection
  • --rate – how many times per second the bridge should poll for commands

5. Step 1: Connect Your USB-RS485 Adapter

Most modern PCs don't have RS-485 ports, so a USB-to-RS485 converter is the simplest entry. Look for one based on an FTDI FT232RL chip (e.g., USB-RS485-FTDI), which works with Linux, Windows, and macOS. Connect the adapter's A/B lines to the device's RS-485 bus. Note that you need a terminating resistor (120 Ω) at both ends if you have a long cable. The adapter will appear as a COM port (e.g., COM3 on Windows, /dev/ttyUSB0 on Linux). Check that the USB adapter uses FTDI or CH340 chipset; some cheap adapters use a counterfeit FTDI chip that can be unstable at high baud rates.

6. Step 2: Download and Launch the Bridge

After you create an account and log in to asibiont.com, go to the Dashboards section. There you will find a pre-built binary or a Python script named bridge.py. Download it to the machine that has the USB-RS485 adapter. Launch it as described above. The bridge will dial home to the ASI Biont cloud (or your self-hosted instance) and wait for commands.

7. Step 3: Talking to the AI in Plain Language

Now open the ASI Biont chat. You don't need to write code. For example:

"Connect to the electricity meter on COM3, baud 9600, Modbus RTU. Read registers 0x0000 and 0x0002, Unit ID 1, every 5 minutes."

The AI will ask for missing details (parity, stop bits, etc.) if needed. Then it will generate and execute a script that calls industrial_command() to send the Modbus request and parse the response.

8. Real-World Case: Housing Utility Company

Let's examine a realistic implementation. A housing management company in Eastern Europe manages 50 apartment buildings, each with a heat meter (e.g., Kamstrup MULTICAL 602) and a water meter (e.g., B meters) connected to an RS-485 bus. Before AI, a technician physically went to each building every month to record consumption. Data was entered into Excel, and a leak could go unnoticed for weeks.

9. The Problem: Manual Readings and Leak Blindness

Manual reading costs money and causes errors. The company's internal audit estimated a ~2% revenue loss from missed readings and delayed leak detection. There was also no way to detect a burst pipe in a basement at 3:00 AM.

10. The ASI Biont Solution

The company deployed a small industrial PC in each building with a USB-RS485 adapter. The Hardware Bridge ran as a Windows service. The facility manager then told ASI Biont:

"Create a data collection script that reads the total heat and water from all meters on COM3, baud 2400, Redy protocol for Kamstrup, and Modbus for the water meters. Store data in a PostgreSQL database and send me a daily summary to Telegram."

ASI Biont generated a mixed-protocol poller, including the Kamstrup Redy protocol (which is not Modbus). It used execute_python to implement the raw byte parsing because industrial_command() only handled standard Modbus. The script ran every 15 minutes.

11. Code Example: Reading a Mercury 230 Meter

For a simpler scenario, assume we have a Mercury 230 electrical meter that supports Modbus RTU. The AI might generate Python code like this:

# AI-generated code for ASI Biont execute_python
# Reads active power from a Mercury 230 meter over Modbus RTU via the Hardware Bridge

from asibiont import industrial_command
import json

def read_meter(port="COM3", baud=9600, unit_id=1):
    # 0x0000 is active power, 0x0002 is reactive power in Mercury 230
    response = industrial_command(
        protocol="modbus_rtu",
        command="read_holding_registers",
        port=port,
        baud=baud,
        unit_id=unit_id,
        address=0x0000,
        count=2
    )
    return response

if __name__ == "__main__":
    data = read_meter()
    print(json.dumps({"power_w": data.registers[0], "reactive_power_var": data.registers[1]}))

This snippet calls the Hardware Bridge's industrial_command() function. It does not implement the Modbus packet herself; the bridge handles the USB-to-serial conversion and CRC. The AI then wraps this in a schedule function that runs every 5 minutes.

12. Handling Non-Standard Devices with execute_python

What if your device uses a proprietary protocol, like the Kamstrup Redy protocol? No problem. ASI Biont has a universal tool called execute_python. The AI writes a Python script that uses pyserial to talk to the serial port through the same bridge. The user only needs to provide the protocol details (byte order, checksum algorithm, framing). The AI iterates through the code and tests it against the live device — all within a chat conversation.

# Example using pyserial to send a custom request to a Kamstrup meter
import serial
import struct

ser = serial.Serial('/dev/ttyUSB0', 2400, parity=serial.PARITY_NONE)
request = b'\x01\x02\x03\x00\x00\x02'  # hypothetical frame
ser.write(request)
response = ser.read(16)
# parse according to protocol documentation

Because the script runs in a sandbox, there is a 30-second timeout on each execute_python call. That's enough for a short poll, but not for a continuous loop. ASI Biont schedules the script to run periodically instead of using while True.

13. Alerting and Automated Reports

Data is useless without action. ASI Biont takes the readings, stores them, and automatically generates reports. For example, after each daily cycle, the AI can send a proactive Telegram message: "Building 4: heat consumption today is 12% above the 30-day average. Possible insulation fault. Check the valve." It can also detect a register that returns 0xFFFF (a common Modbus error) and create an incident in a ticketing system.

The AI can even generate SQL queries and export a CSV file to your email. All of this is initiated by a simple chat request: "Send me last week's consumption report in CSV."

14. Predictive Maintenance: From Data to Insight

RS-485 devices often expose diagnostic registers: total run time, error counters, temperature. Combining these with trend data enables predictive maintenance. A pumped motor in a heating plant tells the controller to increment a runtime counter. When the counter crosses a manufacturer threshold, ASI Biont can automatically create a work order. The AI can also correlate power consumption with vibration data (from other sensors) to detect a bearing fault before it breaks.

15. What You Gain: Metrics That Matter

The utility company in our case reported:

  • Manual data collection time went from three staff-days per month to zero.
  • Leaks are now detected in under 2 hours (water pressure/flow anomalies) instead of weeks.
  • Data accuracy improved because the AI performs checksums and cross-device validation.
  • Staff time was redirected to preventive maintenance.

These are qualitative results, but they align with what many companies experience when they remove manual meter reading. They come from the facility manager's report after six months of operation.

16. Security and Reliability Considerations

Any time you bridge a physical serial line to an AI agent, you need to think about security. Use the Hardware Bridge with a token, rotate it regularly, and restrict the bridge computer's network access. In industrial environments, put the bridge on a separate VLAN. ASI Biont supports encrypted WebSocket connections, and the execute_python sandbox prevents malicious code from accessing the host OS. For truly critical processes, you can still keep a hardwired SCADA as a fallback; ASI Biont runs in addition, not instead of, safety systems.

17. Getting Started Today

You don't need to wait for a vendor to add RS-485 support. ASI Biont adapts to your device on the fly. Start at asibiont.com, create an account, download the Hardware Bridge from the dashboard (it will not be published on GitHub), and connect your RS-485 adapter. Then write in the chat what you want to read and how. The AI will write the pyserial, pymodbus, or custom protocol code for you. The entire integration — from plugging in the cable to receiving your first automated report — takes less than an hour.

18. Conclusion: The Future is Hybrid

RS-485 is not going to disappear in the next decade; there are billions of devices already installed. But with an AI agent like ASI Biont, you no longer need a dedicated software development project to unlock their data. Talk to the agent, let it write the code, and focus on what really matters: reducing costs, saving energy, and preventing failures. Try it on asibiont.com today.

← All posts

Comments