CAN Bus Meets AI: Real-Time Industrial Diagnostics with ASI Biont
In modern factories, vehicles, and robotic cells, the CAN bus (Controller Area Network) remains the backbone for real-time communication between sensors, actuators, and PLCs. But raw CAN frames are just noise without intelligent analysis. The ASI Biont AI agent changes that — it connects directly to your CAN bus, parses messages, detects anomalies, and triggers actions. No custom dashboard required; everything happens through a chat conversation.
Why Integrate CAN Bus with an AI Agent?
A typical production line has dozens of CAN nodes (temperature sensors, motor drives, valve controllers). When a node fails, the bus floods with error frames. A human operator might notice after minutes. ASI Biont, connected via python-can, monitors frame IDs in real time, spots unusual repetition rates, and sends alerts or commands corrective actions. The AI doesn't just read data — it interprets it.
How ASI Biont Connects to CAN Bus
ASI Biont uses the industrial_command tool with the can protocol. The AI writes a Python script that runs in the sandbox (via execute_python) using the python-can library. The script connects to a CAN interface (e.g., SocketCAN on Linux, PCAN-USB on Windows) and performs three operations:
| Operation | Command | Description |
|---|---|---|
| Send frame | send_frame |
Transmit a CAN frame with given arbitration ID and data |
| Read frame | read_frame |
Wait and return the next received CAN frame |
| Monitor bus | monitor_bus |
Continuously collect frames for a specified duration |
The user provides connection parameters (interface type, channel, bitrate) in the chat. The AI generates the integration code instantly.
Concrete Use Case: Predictive Maintenance on a Conveyor Line
Scenario: A factory uses a CAN bus to connect 12 motor drives (IDs 0x201–0x20C). Each drive sends a status frame every 100 ms: 8 bytes containing current (A), temperature (°C), and vibration (mm/s).
Goal: Detect abnormal vibration on motor ID 0x205 before it fails, and alert via Telegram.
Step-by-step integration:
-
User describes the task in chat: "Connect to CAN interface 'can0' on Linux at 500 kbit/s. Monitor frames from IDs 0x201 to 0x20C. If vibration (byte 5–6, little-endian) on ID 0x205 exceeds 12.0 mm/s, send a Telegram alert."
-
ASI Biont writes and executes the script:
import can
import struct
import asyncio
from asyncua import Client # for OPC-UA logging (optional)
# Telegram alert function (using requests in sandbox)
def send_alert(msg):
import requests
token = "YOUR_BOT_TOKEN"
chat_id = "YOUR_CHAT_ID"
requests.post(f"https://api.telegram.org/bot{token}/sendMessage",
json={"chat_id": chat_id, "text": msg})
async def monitor():
bus = can.Bus(interface='socketcan', channel='can0', bitrate=500000)
print("Monitoring CAN bus...")
while True:
msg = bus.recv(timeout=1.0)
if msg is None:
continue
if 0x201 <= msg.arbitration_id <= 0x20C:
# Parse bytes: current bytes[0:2], temp bytes[2:4], vibration bytes[4:6]
vib = struct.unpack('<H', msg.data[4:6])[0] / 100.0 # scale 0.01 mm/s
if msg.arbitration_id == 0x205 and vib > 12.0:
alert = f"⚠️ Motor 0x205 vibration {vib:.2f} mm/s (threshold exceeded)"
send_alert(alert)
print(alert)
asyncio.run(monitor())
-
AI runs the script in the sandbox (30-second timeout per execution). For continuous monitoring, the AI sets up a recurring task that calls
monitor_busevery 10 seconds viaindustrial_command. -
AI explains the result: "Connected to can0. Now monitoring frames. If vibration on motor 0x205 exceeds 12.0 mm/s, you'll receive a Telegram alert. To adjust thresholds, just tell me."
Alternative Connection Methods for CAN Bus
If the CAN interface is connected via USB (e.g., PCAN-USB, USBtin) on a local PC, the user can run bridge.py (downloaded from the ASI Biont dashboard). The bridge exposes the COM port, and the AI sends serial_write_and_read commands to communicate with the CAN adapter using ASCII protocols (e.g., "AT\r" for ELM327). For advanced users, the AI writes a script using pyserial directly inside the bridge's Python environment.
Why This Approach Beats Traditional SCADA
Traditional SCADA requires engineering hours to configure tags, set alarms, and build dashboards. With ASI Biont, the AI does all of that in seconds — just describe your equipment and logic. The AI can also combine CAN data with other sources: read a temperature from an OPC UA server, cross-check with CAN vibration data, and decide to stop a motor via Modbus/TCP — all in one conversation.
Getting Started
- Go to asibiont.com and create an account.
- In the chat, type: "I want to monitor a CAN bus on interface can0 at 500 kbit/s. Alert me if any frame with ID 0x300 appears — that's a fault code."
- ASI Biont will generate the code, connect to your bus, and start monitoring.
No more waiting for developers. Connect your CAN bus to an AI brain today.
Ready to try? Describe your CAN device in the chat at asibiont.com — the AI will handle the rest.
Comments