USB-to-Serial (FTDI, CH340, CP2102) + ASI Biont: AI-Powered Serial Automation Without Coding
You’ve got an old industrial controller, a GPS tracker, or an Arduino sitting on your desk, spitting data over a USB-to-Serial converter (FTDI, CH340, or CP2102). You want to read that data, log it, send alerts, or control relays—without writing a single line of Python. That’s where ASI Biont comes in.
ASI Biont is an AI agent that connects to any serial device via COM port using the Hardware Bridge tool. You run a small Python script (bridge.py) on your PC, and the AI talks to your device through chat. No dashboards, no buttons—just describe what you want, and the AI writes and executes the integration code in seconds.
What Is a USB-to-Serial Converter?
A USB-to-Serial converter (FTDI FT232RL, CH340G, CP2102) turns a USB port into a virtual COM port, allowing your computer to communicate with serial devices like:
- Arduino boards (Uno, Mega, Nano)
- GPS receivers (NMEA sentences)
- Industrial PLCs (Modbus RTU)
- Smart meters and sensors (temperature, humidity, pressure)
- Old modems and radio equipment
These chips are dirt cheap ($2–$10) and ubiquitous in maker and industrial setups.
How ASI Biont Connects to COM Ports
ASI Biont uses Hardware Bridge—a bridge.py application that runs on your local machine (Windows, Linux, macOS). It connects to the ASI Biont cloud via WebSocket (the only communication channel). You specify the COM port (e.g., COM3 on Windows, /dev/ttyUSB0 on Linux) and baud rate (9600, 115200, etc.). The AI sends commands through the industrial_command tool, which routes them to your bridge. Bridge performs an atomic serial_write_and_read()—sends hex data and reads the response immediately.
For example, to query a GPS tracker, you’d tell the AI:
“Connect to COM3 at 9600 baud, send $GPGGA command, and parse the NMEA sentence.”
The AI then uses the Hardware Bridge to do this:
# AI-generated code (runs in sandbox)
import serial
import time
# This is just illustrative—bridge handles serial internally
# The AI actually uses industrial_command(protocol='serial://', command='serial_write_and_read', data='2447504747412C2C2C2C2C2C2C2C2C2A')
Real Use Case: ESP32 + DHT22 Temperature Sensor → ASI Biont → Telegram
Let’s walk through a concrete example. You have an ESP32 with a DHT22 sensor connected to your PC via a USB-to-Serial converter (CH340). The ESP32 publishes temperature and humidity data to an MQTT broker (Mosquitto). ASI Biont subscribes to that topic, analyzes the data, and sends a Telegram alert if the temperature exceeds 30°C.
Step 1: ESP32 Code (Micropython)
Upload this to your ESP32:
import machine
import dht
import ujson
from umqtt.simple import MQTTClient
sensor = dht.DHT22(machine.Pin(4))
client = MQTTClient("esp32", "192.168.1.100")
client.connect()
while True:
sensor.measure()
temp = sensor.temperature()
hum = sensor.humidity()
msg = ujson.dumps({"temp": temp, "hum": hum})
client.publish(b"sensor/room1", msg)
time.sleep(60)
Step 2: ASI Biont Integration
In the ASI Biont chat, you write:
“Connect to MQTT broker at 192.168.1.100:1883, subscribe to topic sensor/room1, parse JSON, and if temperature > 30°C, send a Telegram message to chat ID 123456.”
The AI generates and runs this script in the sandbox (using execute_python):
import paho.mqtt.client as mqtt
import json
import requests
def on_message(client, userdata, msg):
data = json.loads(msg.payload)
if data["temp"] > 30:
requests.post(f"https://api.telegram.org/bot{TOKEN}/sendMessage",
json={"chat_id": 123456, "text": f"Alert! Temp: {data['temp']}°C"})
mqtt_client = mqtt.Client()
mqtt_client.on_message = on_message
mqtt_client.connect("192.168.1.100", 1883)
mqtt_client.subscribe("sensor/room1")
mqtt_client.loop_forever()
That’s it. The AI handles the MQTT subscription, JSON parsing, and Telegram API call—all from a single chat description.
More Use Cases with USB-to-Serial
1. GPS Tracker → COM Port → AI
- Device: GPS module (NEO-6M) with CH340 USB adapter
- Method: Hardware Bridge (bridge.py) on PC
- What ASI Biont does: Parses NMEA sentences ($GPGGA, $GPRMC), extracts lat/lon, plots routes on a map, logs coordinates to a CSV file
- Example command:
industrial_command(protocol='serial://', command='serial_write_and_read', data='2447504747412C2C2C2C2C2C2C2C2C2A')
2. Arduino Uno + Relay → AI Control
- Device: Arduino with relay module, controlled via serial commands (e.g., “RELAY_ON\n”)
- Method: Hardware Bridge
- What ASI Biont does: Sends hex-encoded commands to turn relays on/off based on time or sensor data
- Example: “At 6 PM, send ‘RELAY1_ON\n’ to COM3”
3. Industrial Modbus RTU → AI Monitoring
- Device: Temperature transmitter with RS-485 to USB (FTDI-based)
- Method: Hardware Bridge (Modbus RTU over serial)
- What ASI Biont does: Reads holding registers (e.g., address 0x0001, float32), logs temperature every 5 minutes, detects anomalies
- Example:
industrial_command(protocol='modbus://', command='read_registers', data='{"slave":1, "address":0, "count":2}')
4. Smart Meter (DLMS/COSEM) → AI
- Device: Electricity meter with optical probe → USB-to-Serial
- Method: Hardware Bridge
- What ASI Biont does: Sends DLMS commands, parses response, calculates consumption, generates daily reports
- Challenge: Need to handle CRC and frame formatting—AI does it automatically
Why Use ASI Biont for Serial Integration?
| Aspect | Traditional Approach | ASI Biont Approach |
|---|---|---|
| Coding | Write Python script from scratch | Describe in chat, AI writes code |
| Debugging | Manual trial and error | AI fixes errors in real-time |
| Monitoring | Build dashboard or cron job | AI runs periodic checks and alerts |
| Flexibility | One script per device | AI adapts to any serial device instantly |
No Coding Required? Really?
Yes. The AI uses execute_python to generate and run Python scripts in a sandbox environment on the ASI Biont cloud server. It has access to all major libraries: pyserial, paho-mqtt, pymodbus, paramiko, aiohttp, opcua-asyncio, bac0, snap7, python-can, and more. You just describe your device and what you want—the AI does the rest.
Important: The sandbox runs in the cloud, so it cannot directly access your PC’s COM ports. That’s why you need Hardware Bridge (bridge.py) for serial connections. For MQTT, Modbus/TCP, HTTP APIs, etc., the AI can connect directly from the sandbox.
Pitfalls to Avoid
- Wrong baud rate – The bridge defaults to 115200. If your device uses 9600, specify it in the chat: “Use COM3 at 9600 baud”.
- Hex encoding – Serial data is sent as hex strings. The AI handles conversion, but if you manually type commands, use proper hex (e.g., “0A” for newline).
- Windows overlapped I/O – On Windows, pyserial sometimes fails with writes returning 0. The bridge automatically applies
CancelIoEx,PurgeComm, and synchronousWriteFileto recover. If you see write errors, restart the bridge. - Sandbox timeout –
execute_pythonscripts have a 30-second timeout. Don’t use infinite loops for long-running tasks; use MQTT or cron-like scheduling via AI.
Conclusion
USB-to-Serial converters (FTDI, CH340, CP2102) are the backbone of countless IoT and industrial setups. With ASI Biont, you can turn any serial device into an AI-connected system—monitor sensors, control relays, parse GPS data, and automate alerts—all without writing a single line of Python.
Try it yourself: Go to asibiont.com, create an API key, download bridge.py, and tell the AI to connect to your USB-to-Serial device. You’ll be live in minutes.
Comments