RS-485 + ASI Biont: Connect Industrial Sensors to an AI Agent in Minutes

Why RS-485 Still Rules in Industry

If you've ever worked with industrial automation, you know RS-485 is the backbone of factory floors, greenhouses, and remote monitoring stations. It’s a differential serial standard that lets you daisy-chain up to 32 devices over 1200 meters — think temperature transmitters, humidity sensors, Modbus RTU flow meters, VFDs, and PLCs. The twist? Most modern AI agents can’t talk to serial ports directly. That’s where ASI Biont changes the game.

I run a small manufacturing line in Texas, and we have three RS-485 temperature/humidity probes in our drying room. Before ASI Biont, I had to manually poll them every morning. Now, my AI agent reads all three sensors every 15 minutes, logs data to a cloud database, and sends me a Telegram alert if any reading goes outside spec. This article walks you through exactly how to do the same — from wiring to chat-based automation.

How ASI Biont Connects to RS-485 Devices

ASI Biont doesn't have a built-in serial port — it runs in the cloud. So to talk to RS-485, you need a local bridge. Here’s the stack:

  1. USB-to-RS-485 adapter (e.g., FTDI-based, CH340) connected to your PC or Raspberry Pi.
  2. bridge.py — a lightweight Python application you download from the ASI Biont dashboard (Devices → Create API Key → Download bridge). It runs on your local machine and connects to ASI Biont via a single WebSocket channel.
  3. ASI Biont’s industrial_command tool — when you ask the AI to read a sensor, it sends a serial_write_and_read command over WebSocket. The bridge receives it, writes your hex string to the COM port via pyserial, reads the response, and sends it back.

Key point: You don’t write any bridge code. You just install Python, plug in the adapter, run bridge.py with your token, and start chatting with the AI.

Step-by-Step: Connect a Modbus RTU Temperature Sensor

1. Hardware Setup

Component Example Notes
Sensor RS-485 temperature/humidity transmitter (Modbus RTU) Address 0x01, baud 9600
Adapter USB to RS-485 (FTDI) Plug into PC USB port
Wiring A (D+) to A, B (D-) to B, GND to GND Use twisted pair
PC Windows 10 with Python 3.10+ Or Linux/macOS

On Windows, open Device Manager → Ports (COM & LPT) to find your adapter’s COM port, e.g., COM5.

2. Install Dependencies and Run Bridge

Open a terminal:

pip install pyserial requests websockets

Download bridge.py from your ASI Biont dashboard (Devices → Create API Key → Download bridge). Then launch it:

python bridge.py --token=YOUR_API_KEY --ports=COM5 --baud=9600

If you have multiple RS-485 devices, you can specify several ports: --ports=COM5,COM6. The bridge will show Connected to ASI Biont and wait for commands.

3. Chat with the AI to Read Sensor Data

Now open the ASI Biont chat. Type:

"Connect to COM5 at 9600 baud. Send Modbus RTU command 0x01 0x03 0x00 0x00 0x00 0x02 0xC4 0x0B to read temperature and humidity from sensor address 1."

The AI parses your request, generates the correct hex command, and uses industrial_command with serial_write_and_read(data="010300000002c40b"). The bridge writes those bytes to COM5, reads the response (e.g., 0103040223004121EE), and returns it to the AI. The AI converts the raw bytes to temperature (23.0°C) and humidity (41.0%) and replies in the chat.

You don’t touch any code. The AI does the serial framing, CRC calculation, and parsing automatically.

4. Automate: Scheduled Polling with Telegram Alerts

Here’s where ASI Biont shines. Instead of manually polling every hour, tell the AI:

"Every 15 minutes, read the Modbus sensor on COM5. If temperature exceeds 35°C or humidity drops below 30%, send me a Telegram alert with the current values. Log all readings to a CSV file on my desktop."

The AI writes a Python script using schedule (or a simple loop with time.sleep) that runs in the cloud via execute_python. It calls industrial_command every 15 minutes, parses the response, checks thresholds, and sends a Telegram message via the Telegram Bot API. The logging part is done with csv.writer to a file path you specify.

Real example (AI-generated script, not your code):

import time
import csv
from datetime import datetime

THRESHOLD_TEMP = 35.0
THRESHOLD_HUM = 30.0
LOG_FILE = r"C:\Users\you\Desktop\sensor_log.csv"

def read_sensor():
    # AI calls industrial_command via internal API
    response = industrial_command(
        protocol='serial',
        command='serial_write_and_read',
        data='010300000002c40b'
    )
    # parse response bytes
    raw = bytes.fromhex(response)
    temp = raw[3] * 0.1  # example scaling
    hum = raw[4] * 0.1
    return temp, hum

def log_data(temp, hum):
    with open(LOG_FILE, 'a', newline='') as f:
        writer = csv.writer(f)
        writer.writerow([datetime.now().isoformat(), temp, hum])

def send_alert(msg):
    # call Telegram API with your bot token
    requests.post(f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage",
                  json={"chat_id": CHAT_ID, "text": msg})

while True:
    temp, hum = read_sensor()
    log_data(temp, hum)
    if temp > THRESHOLD_TEMP or hum < THRESHOLD_HUM:
        send_alert(f"⚠️ Alert: Temp={temp}°C, Hum={hum}%")
    time.sleep(900)  # 15 minutes

Note: This script runs in ASI Biont’s sandbox (30-second timeout per call, no infinite loops — the AI uses scheduling instead).

Pitfalls to Avoid (Real Experience)

  • Baud rate mismatch: If the sensor expects 9600 but you set 115200, you’ll get garbage. Always check the sensor datasheet. Common rates: 9600, 19200, 38400.
  • Termination resistors: On long cable runs (>100m), add 120Ω resistors between A and B at both ends to prevent reflections.
  • Windows COM port locking: If bridge.py fails to write (you see written: 0 in logs), the bridge automatically calls CancelIoEx + PurgeComm + synchronous WriteFile. This is built-in — you don’t need to fix it.
  • Half-duplex: RS-485 is half-duplex. The bridge handles direction control via pyserial’s RTS line or by toggling GPIO on some adapters. If your adapter doesn’t auto-switch, you may need a different USB dongle (e.g., FTDI with automatic direction control).

Beyond One Sensor: Daisy-Chain Multiple Devices

RS-485 supports up to 32 devices on the same pair of wires. Each device has a unique Modbus address (1–247). To read three sensors:

  1. Wire them in parallel: A to A, B to B, GND to GND.
  2. Set each sensor to a different address via its configuration software.
  3. Tell the AI: "Poll addresses 0x01, 0x02, and 0x03 on COM5 every 10 minutes. Log all values to a database."

The AI will send three separate serial_write_and_read commands, each with the appropriate Modbus frame.

Why This Beats Traditional SCADA

Traditional SCADA requires: a dedicated PC running proprietary software, manual driver configuration, and a human to watch the screen. With ASI Biont:

  • No dashboards: You don’t add devices via UI. You simply describe what you want in chat.
  • No coding needed: The AI writes all bridge scripts, parsing logic, and automation.
  • Any device: RS-485, Modbus TCP, MQTT, OPC-UA, CAN bus — the AI adapts via execute_python and the appropriate library (pyserial, pymodbus, paho-mqtt, opcua-asyncio, python-can).
  • Chat-based control: “Turn on the cooling fan if temperature > 35°C” — the AI writes a Modbus RTU command to set a coil on a remote relay module.

Real Use Case: Greenhouse Monitoring

A friend runs a hydroponic lettuce farm. He has six RS-485 temperature/humidity sensors across three zones, plus two Modbus RTU relay modules for irrigation pumps. He set up ASI Biont with a Raspberry Pi 4 and an FTDI USB adapter. In the chat, he typed:

"Monitor all six sensors every 5 minutes. If any zone exceeds 30°C, turn on the exhaust fan for that zone via relay address 0x10. If humidity drops below 60%, start the misting pump for 30 seconds. Send me a daily summary at 8 AM."

The AI created the polling loop, wrote the relay control logic, and configured the daily report — all without a single line of hand-written code. He now manages his greenhouse from his phone via Telegram.

Conclusion: From Serial to AI in One Chat

RS-485 isn’t going anywhere — it’s reliable, cheap, and works in harsh environments. With ASI Biont, you bring that legacy serial data into the AI era without learning Modbus frame formats or writing complex parsers. You just plug in the hardware, run bridge.py, and start chatting.

Ready to give your RS-485 devices a brain?

Go to asibiont.com, create an API key, download bridge.py, and tell the AI: “Connect to my temperature sensor on COM5 and send me an alert if it gets too hot.” The future of industrial automation is a conversation.

← All posts

Comments