Introduction
SPI (Serial Peripheral Interface) is the quiet workhorse of embedded systems. It's how your MCU talks to thermal sensors, barometers, flash memory, and glossy TFT screens. Yet SPI has almost zero natural interfaces to the cloud — a raw hardware protocol with no notion of IP addresses, users, or JSON payloads. Connecting an SPI device to an AI agent usually meant writing a custom daemon, exposing an HTTP API, and then building dashboards.
ASI Biont changes that. It treats every device as a conversation partner. In this article, I'll show you how to connect SPI-based sensors and peripherals to ASI Biont via a COM port / serial bridge, what tasks the AI agent can automate, and how to do it without a single button in a management panel.
Why Attach an AI Agent to SPI?
Most industrial AI integrations happen over MQTT or Modbus TCP because those protocols are already data-friendly. SPI is a register-level bus: low latency, high speed, but no self-describing frames. You need a local gateway — an ESP32, an Arduino, or a USB-SPI adapter — to translate SPI reads into serial ASCII. That's actually a perfect foundation for an AI loop: the sensor data becomes a text stream, and the AI agent becomes the interpreter.
Connection Architecture: SPI → Serial → ASI Biont
Here's a typical data path for a SPI temperature sensor (MAX31855) and a SPI OLED display:
SPI sensor (MAX31855) <--SPI--> ESP32 (gateway) <--UART--> CP2102 (USB-TTL) <--COM port--> bridge.py <--WebSocket/HTTPS--> ASI Biont AI agent
The ESP32 runs a small firmware that polls the sensor and prints a line like TEMP=25.4. The USB-UART adapter exposes this as a virtual COM port on your PC. ASI Biont's Hardware Bridge (bridge.py) opens that port, reads the lines, and forwards them to the AI agent in the cloud. All setup is done through a chat dialog — no web dashboards, no "add device" buttons.
Setting Up the Hardware Bridge
Download bridge.py from the ASI Biont dashboard (it's not on GitHub; you get the exact build for your token). Launch it from the command line:
python bridge.py --token=YOUR_TOKEN --ports=COM3 --baud=115200 --rate=10
The --rate=10 flag tells the bridge to push data at 10 Hz to the ASI Biont cloud. Note that the bridge has no HTTP API — you don't curl it. The AI agent talks to it via industrial_command() under the hood, which sends structured commands over the existing connection.
Code Example: Monitoring a MAX31855 via the AI Agent
Let's say you want ASI Biont to log the cold-junction temperature from an SPI thermocouple module and alert you when it exceeds 30 °C.
Step 1: ESP32 MicroPython firmware
The ESP32 reads the MAX31855 over SPI and writes a human-readable line to its USB serial:
from machine import Pin, SPI
import time
spi = SPI(1, baudrate=1000000, polarity=0, phase=0)
cs = Pin(15, Pin.OUT)
def read_temp():
cs.off()
data = spi.read(4)
cs.on()
raw = (data[0] << 16)
| (data[1] << 8) | data[2]
if raw & 0x800000: # negative
raw -= 0x1000000
return raw * 0.25 # resolution
while True:
temp = read_temp()
print("TEMP={:.2f}".format(temp))
time.sleep(5)
Flash this to an ESP32, wire the MAX31855 to GPIO pins, and plug the board into your computer's USB port. The COM port appears (on Linux it's /dev/ttyUSB0, on Windows COM3).
Step 2: Tell ASI Biont about the device
Open the chat and describe the connection:
"I have a temperature sensor on COM3 at 115200 baud, data format is TEMP=xx.xx. Read it every 5 seconds and notify me if it goes above 30°C."
The AI agent replies with a Python workflow that it runs inside its execution sandbox (or pushes to the bridge — depending on your plan):
# AI-generated logic (conceptual)
import serial
ser = serial.Serial('COM3', 115200, timeout=1)
line = ser.readline().strip().decode()
if line.startswith("TEMP="):
temp = float(line.split("=")[1])
if temp > 30.0:
# send alert via Telegram
import requests
requests.post("https://api.telegram.org/bot<TOKEN>/sendMessage",
json={"chat_id": "...", "text": f"Alert: {temp}°C"})
The point is you don't write this plumbing from scratch. You define the goal, and the AI generates the integration code, including error handling and byte parsing.
No-Code Configuration through the Chat
You don't have to be an expert in pyserial or pymodbus. ASI Biont's AI constructor works entirely through prompts. For example:
- "Poll /dev/ttyUSB0 at 9600 baud, look for lines with 'HUM=' and store them in a table."
- "Send this Modbus request to a PLC over the same COM port and parse the registers."
- "When the SPI display client sends the string 'status:error', restart the device via an MQTT command."
The AI translates natural language into a Python integration on the fly. It supports pyserial, paho-mqtt, paramiko, pymodbus, aiohttp, and opcua-asyncio. And if your device is truly exotic, there's always execute_python — the universal backdoor where the AI writes arbitrary glue code in a sandbox. This means ASI Biont can connect to ANY device, not just the ones with pre-built plugins. You just describe the port, baud rate, API key, or IP address, and the AI writes the Python script itself.
Real-World Scenarios
- Greenhouse monitoring — A Raspberry Pi with three SPI soil sensors and a 2.8" SPI LCD. The AI agent reads soil moisture, turns on irrigation via an MQTT relay, and displays the status on the LCD by sending text commands over the same serial port.
- Test bench automation — A PIC microcontroller reads SPI ADC samples and sends values over COM. ASI Biont correlates the data with timestamps, flags outliers, and writes a test report to Google Sheets.
- Legacy equipment without network access — An old industrial board has SPI EEPROM with calibration constants. The AI pulls the EEPROM contents over a serial bridge, validates checksums, and pushes new constants back.
- Smart display dashboard — The AI controls a SPI OLED display through the ESP32: it receives a user's chat message like "show the current uptime and CPU load", then sends OLED draw commands through the COM port.
Why This Matters
The traditional way of integrating hardware into an AI workflow is a multi-week project: write a device driver, build an API service, create a dashboard, and then manage authentication. ASI Biont collapses that to a chat exchange. After the initial bridging setup, the AI handles everything else — parsing, alerting, visualization, and even generating firmware code for the gateway.
Try It Yourself
Go to asibiont.com, download the bridge for your token, wire an SPI sensor to an ESP32 (or another COM-capable board), and just type what you want to measure. The AI will write the integration in seconds, and you'll see your data transformed into decisions as if the sensor were born with a natural language interface.
Comments