USB-to-Serial (FTDI, CH340, CP2102) + AI Agent: Automate Legacy Devices with ASI Biont
Introduction
Imagine a factory floor where a 20-year-old CNC machine, a weather station with a serial port, and a custom sensor array all speak the same language—and that language is controlled by an AI agent. That’s exactly what ASI Biont does when connected via USB-to-Serial adapters like FTDI FT232RL, CH340G, or CP2102. These tiny chips convert USB to UART, giving any modern PC a direct line to millions of legacy industrial devices, microcontrollers (Arduino, ESP32), GPS receivers, and barcode scanners.
In this guide, I’ll show you how ASI Biont’s AI agent connects to such devices through the Hardware Bridge—a local Python application that bridges your COM port to the cloud via WebSocket. No dashboard, no buttons: you describe your hardware in chat, the AI writes the integration code, and within seconds you’re reading sensor data or controlling actuators. Let’s dive into 12 real-world scenarios that prove why USB-to-Serial + AI is a killer combo.
How ASI Biont Connects to USB-to-Serial Devices
ASI Biont uses a Hardware Bridge (bridge.py) that runs on your Windows/Linux/macOS PC. This bridge connects to the ASI Biont cloud via WebSocket (the only communication channel). When you send a command via the industrial_command tool with protocol serial://, the AI routes it to your bridge, which writes to the COM port using pyserial and reads the response. Data is passed in hex format (e.g., data="48454c500a" for HELP+\n) or as escape sequences (BLUE_ON\n). The bridge also handles Windows quirks like CancelIoEx + PurgeComm for reliable writes.
You don’t need to write a single line of boilerplate. Just tell the AI: “Connect to COM3 at 115200 baud, send HELP, and parse the response.” The AI generates the industrial_command call instantly.
12 Integration Scenarios with Code Examples
1. Reading Temperature from an Arduino (DHT22) via COM Port
Use case: An Arduino Uno with a DHT22 sensor sends temperature and humidity every 2 seconds over Serial. ASI Biont reads the data, logs it, and alerts if temperature exceeds 30°C.
How to connect: User says: “Connect to COM5 at 9600 baud, read serial data, parse temperature and humidity, and alert me if temp > 30.”
AI-generated command (via chat):
industrial_command(
protocol="serial://",
command="serial_write_and_read",
params={
"port": "COM5",
"baud": 9600,
"data": "" # read without writing
}
)
The bridge reads the raw string like Temp: 25.4 Hum: 60.1. AI parses it and, if threshold exceeded, sends a Telegram message via send_message tool.
2. Controlling Servo Motors with Arduino via Hex Commands
Use case: An Arduino Mega controls a robotic arm. Each servo has a command like S1:90\n (servo 1 to 90°). ASI Biont sends hex-encoded commands.
User prompt: “Send servo 1 to 180 degrees, then servo 2 to 45 degrees.”
AI sends:
industrial_command(
protocol="serial://",
command="serial_write_and_read",
params={
"port": "COM3",
"baud": 115200,
"data": "53313a3138300a" # hex for "S1:180\n"
}
)
3. GPS Tracker (NMEA Parsing) with u-blox Module
Use case: A u-blox NEO-6M GPS module sends NMEA sentences at 9600 baud. ASI Biont extracts latitude/longitude and plots a route on a map.
User: “Read NMEA sentences from COM7, parse $GPGGA, and log coordinates.”
AI writes a Python script that runs in execute_python (sandbox) to parse the raw data and store it in a CSV file. The bridge reads the raw NMEA stream; AI uses pynmea2 (available in sandbox) to parse.
import pynmea2
import io
raw_data = "$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47"
stream = io.StringIO(raw_data)
reader = pynmea2.NMEAFile(stream)
for msg in reader:
if isinstance(msg, pynmea2.GGA):
print(f"Lat: {msg.latitude}, Lon: {msg.longitude}")
4. Industrial PLC (Modbus RTU) via USB-to-RS485 Adapter
Use case: A factory PLC (e.g., Siemens S7-200) communicates via Modbus RTU over RS485. A USB-to-RS485 adapter (FTDI-based) connects to the PC. ASI Biont reads holding registers and writes setpoints.
User: “Read register 40001 from device ID 1 on COM4 at 19200 baud.”
AI uses the Modbus RTU protocol via bridge:
industrial_command(
protocol="modbus://",
command="read_registers",
params={
"port": "COM4",
"baud": 19200,
"slave": 1,
"address": 0,
"count": 1
}
)
5. Barcode Scanner Automation (Serial Wedge)
Use case: A Honeywell barcode scanner (USB configured as serial) sends scanned codes as ASCII text. ASI Biont reads each scan and logs it into a Google Sheet.
User: “Read barcodes from COM8 at 9600 baud, strip newlines, and append to a spreadsheet.”
AI sends a read command, then uses gspread (via execute_python) to update the sheet.
6. Relay Control via Serial (8-Channel Relay Board)
Use case: A 8-channel relay board (e.g., Sainsmart) accepts commands like A1\n to turn on channel 1. ASI Biont toggles relays based on time schedule.
User: “At 8 AM, turn on relay 1 and 3. At 6 PM, turn them off.”
AI generates a cron-like loop in execute_python (using datetime) that sends commands via bridge at specified times.
7. Smart Weighing Scale (RS232) Data Logging
Use case: An Ohaus Scout Pro balance sends weight readings over RS232 via a USB adapter. ASI Biont records measurements for quality control.
User: “Read weight from COM2 at 2400 baud, log to a CSV file, and alert if weight deviates ±5g from target.”
8. CNC Machine (GRBL) Remote Control
Use case: A GRBL-based CNC (e.g., Arduino with CNC Shield) accepts G-code over serial. ASI Biont sends G-code commands to jog the machine.
User: “Send G91 G01 X10 F100 (move 10mm in X) to COM9 at 115200.”
AI converts to hex:
"473931204730312058313020463130300a"
9. RFID Reader (125 kHz) Gate Access Log
Use case: An RFID reader (e.g., RDM630) sends tag UID as hex over serial. ASI Biont checks against a whitelist and unlocks a door (via relay).
User: “Read RFID tags from COM6 at 9600, if tag matches whitelist, send unlock command.”
10. Weather Station (Davis Vantage Pro2) Data Collection
Use case: A Davis weather station outputs data via serial (1200 baud, 8N1). ASI Biont parses the Davis LOOP format and stores wind speed, temperature, and rainfall.
User: “Connect to COM1 at 1200 baud, parse LOOP packets, and plot temperature trend.”
11. Oscilloscope (Rigol DS1054Z) via USB-TTL
Use case: Some oscilloscopes expose a serial console for remote control. ASI Biont sends SCPI commands like :MEAS:VPP? and reads results.
User: “Send ':MEAS:VPP?' to COM10 at 115200 and return the voltage.”
12. Legacy CNC Mill (Fanuc RS232) — DNC Transfer
Use case: An old Fanuc controller accepts G-code via RS232 at 4800 baud. ASI Biont sends an entire G-code file line by line with handshaking.
User: “Upload milling.nc to COM11 at 4800 baud, send lines with 100ms delay.”
Why ASI Biont Beats Manual Coding
You don’t need to write Python scripts, handle serial port errors, or parse protocols. ASI Biont does it all: you describe your hardware in plain English, the AI generates the exact integration code (using pyserial, pynmea2, pymodbus, etc.), and executes it in the cloud or via the bridge. No waiting for a developer to add support for your device—connect anything with a serial port right now.
Conclusion
USB-to-Serial adapters are the universal translator for industrial and hobbyist hardware. Combined with ASI Biont’s AI agent, they become a remote-controlled, intelligent interface for automation, data logging, and control. Whether you’re monitoring a greenhouse, controlling a robot, or logging barcodes, the integration is one chat message away.
Ready to automate your serial devices? Try ASI Biont today at asibiont.com and let the AI do the wiring.
Comments