Introduction
In the world of industrial IoT, sensor data is the lifeblood of automation. Temperature, humidity, pressure, vibration — these measurements tell you if a machine is healthy, a warehouse is safe, or a process is on schedule. But collecting and acting on telemetry traditionally requires custom software, scripting, and constant maintenance. What if an AI agent could do it all for you — just by describing what you need?
ASI Biont is an AI engineering agent that connects directly to your hardware. Through chat, you tell it: "Connect to my MQTT broker, subscribe to sensor topics, and alert me if temperature exceeds 30°C." In seconds, ASI Biont writes the integration code using libraries like paho-mqtt, pymodbus, pyserial, opcua-asyncio, or paramiko. You don't need to open a code editor — the AI handles everything.
Below, we explore ten real-world scenarios where ASI Biont connects to sensors and telemetry systems, with full code examples and wiring insights. Each scenario uses a different protocol or interface — from classic RS-232 to modern MQTT and OPC UA.
1. MQTT: Smart Warehouse Temperature Monitoring with ESP32 + DHT22
Scenario: A warehouse manager needs real-time temperature and humidity tracking from five locations. Each ESP32 reads a DHT22 sensor and publishes readings via MQTT every 10 seconds. If any sensor exceeds 30°C or 70% humidity, the AI must send a Telegram alert and log data to a PostgreSQL database.
Connection method: MQTT via paho-mqtt inside execute_python. ASI Biont writes a Python script that runs in its sandbox, subscribes to sensor/+/telemetry, parses the JSON payload, and applies rules.
How it works:
- The user tells ASI Biont: "I have an MQTT broker at mqtt://192.168.1.100:1883, topics sensor/+/telemetry with JSON like {"temp":25.5,"hum":60}. Subscribe and alert me if temp > 30 or hum > 70, also log to Postgres at postgresql://user:pass@host/db."
- ASI Biont generates a script using paho-mqtt and psycopg2, tests it, and runs it continuously.
Python code (generated by ASI Biont):
import paho.mqtt.client as mqtt
import json
import psycopg2
from datetime import datetime
DB = psycopg2.connect("postgresql://user:pass@host/warehouse")
CURSOR = DB.cursor()
def on_message(client, userdata, msg):
data = json.loads(msg.payload)
topic = msg.topic
temp = data['temp']
hum = data['hum']
sensor_id = topic.split('/')[1]
# Log to DB
CURSOR.execute("INSERT INTO telemetry(sensor_id, temp, hum, ts) VALUES (%s,%s,%s,%s)",
(sensor_id, temp, hum, datetime.utcnow()))
DB.commit()
# Alert if over threshold
if temp > 30 or hum > 70:
print(f"ALERT: Sensor {sensor_id}: temp={temp}, hum={hum}")
# In production, send Telegram via Slack SDK or Twilio
client = mqtt.Client()
client.connect("192.168.1.100", 1883, 60)
client.subscribe("sensor/+/telemetry")
client.on_message = on_message
client.loop_forever()
Why it's beneficial: No need to write, host, or manage a custom MQTT consumer. AI handles connection, parsing, logic, and integration with external services.
2. Modbus/TCP: Reading Pressure and Level from a Siemens PLC
Scenario: A water treatment plant uses a Siemens S7-1200 PLC connected to pressure and level sensors via analog inputs. The telemetry is exposed as Modbus/TCP holding registers. An operator wants the AI to read those values every 5 seconds and detect abnormal drops that indicate a leak.
Connection method: Modbus/TCP via industrial_command with protocol modbus. ASI Biont uses the industrial_command tool with commands like read_registers and write_register.
How it works:
- User provides the PLC IP (192.168.0.10), port (502), and register addresses (e.g., pressure at 40001, level at 40003).
- ASI Biont sends a series of industrial_command calls, or writes a persistent script with pymodbus if polling is needed. Since the sandbox timeout is 30 seconds, for continuous polling the AI schedules a repeating task using the platform's cron-like mechanism (user configures via chat).
Example command in chat:
industrial_command(protocol='modbus', command='read_registers', params={'host':'192.168.0.10','port':502,'address':0,'count':2,'unit':1})
Python script (if persistent polling needed):
from pymodbus.client import ModbusTcpClient
client = ModbusTcpClient('192.168.0.10', port=502)
client.connect()
result = client.read_holding_registers(0, 2, unit=1)
if not result.isError():
pressure = result.registers[0] / 100.0 # scale
level = result.registers[1] / 10.0
print(f"Pressure: {pressure} bar, Level: {level} m")
if pressure < 2.0:
print("ALERT: Low pressure - possible leak!")
client.close()
3. COM Port (RS-232): Analog Data from an Arduino via Hardware Bridge
Scenario: An Arduino Uno reads an LM35 temperature sensor (analog pin A0) and a potentiometer (A1). The user wants the AI to read these values via USB serial, and also control an LED on pin 13 based on temperature.
Connection method: Hardware Bridge — the user runs bridge.py on their PC (Windows/Linux/macOS) which connects to ASI Biont via WebSocket. The AI sends commands through industrial_command with serial:// protocol.
How it works:
- User downloads bridge.py from the ASI Biont dashboard (Devices → Create API Key → Download).
- User runs: python bridge.py --token=xxx --ports=COM3 --baud=9600
- In chat, user says: "Read analog 0 and 1 from Arduino on COM3, and if temp > 30, turn on LED on pin 13."
- ASI Biont sends:
industrial_command(protocol='serial', command='serial_write_and_read', params={'port':'COM3','data':'ANALOGREAD 0\n','baud':9600})
industrial_command(protocol='serial', command='serial_write_and_read', params={'port':'COM3','data':'ANALOGREAD 1\n','baud':9600})
- The Arduino runs a simple sketch that understands commands like ANALOGREAD n and returns the value.
Arduino sketch (provided by user or pre-loaded):
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);
}
void loop() {
if (Serial.available()) {
String cmd = Serial.readStringUntil('\n');
if (cmd.startsWith("ANALOGREAD ")) {
int pin = cmd.substring(10).toInt();
Serial.println(analogRead(pin));
} else if (cmd.startsWith("DIGITALWRITE ")) {
int pin = cmd.substring(13).toInt();
int val = Serial.parseInt();
digitalWrite(pin, val);
}
}
}
Benefit: No custom Python app needed — the bridge handles serial I/O, and the AI orchestrates everything via chat.
4. SSH: Raspberry Pi Camera for Visual Inspection
Scenario: A Raspberry Pi 5 with a camera module monitors a conveyor belt. The AI connects via SSH, runs a Python script using OpenCV to detect defects, and saves images when anomalies are found.
Connection method: SSH via paramiko inside execute_python. The AI writes a script that connects to the Pi (IP, user, password/key), remotes execution, and retrieves results.
How it works:
- User provides the Pi's credentials and says: "Connect to 192.168.1.50, run a script that captures an image and uses OpenCV to detect if the product is defective."
- ASI Biont generates a script that SSHs to the Pi, uploads a detection script, runs it, and downloads the result.
Example script (generated):
import paramiko
import base64
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('192.168.1.50', username='pi', password='raspberry')
stdin, stdout, stderr = ssh.exec_command("python3 /home/pi/detect.py")
output = stdout.read().decode()
if "DEFECT" in output:
# Retrieve image via SCP
sftp = ssh.open_sftp()
sftp.get('/home/pi/latest.jpg', 'defect.jpg')
sftp.close()
print(f"Detection result: {output}")
ssh.close()
5. HTTP API: Smart Plug Energy Monitoring
Scenario: A smart plug (TP-Link Kasa or Shelly) exposes an HTTP API for power consumption. The AI wants to read current wattage every minute and turn off the plug if consumption exceeds 2000W.
Connection method: HTTP API via aiohttp inside execute_python. ASI Biont writes a script that GETs the energy status and POSTs commands.
Example code:
import aiohttp
import asyncio
async def monitor():
async with aiohttp.ClientSession() as session:
async with session.get('http://192.168.1.20/energy') as resp:
data = await resp.json()
power = data['power']
if power > 2000:
async with session.post('http://192.168.1.20/relay/0?turn=off') as r:
print("Plug turned off")
print(f"Power: {power}W")
asyncio.run(monitor())
6. OPC UA: Factory Floor Sensor Array
Scenario: A large factory uses OPC UA to expose hundreds of tags from temperature, pressure, and vibration sensors. The AI reads a subset of tags every 5 seconds, computes rolling averages, and predicts failures using a simple model.
Connection method: OPC UA via opcua-asyncio (asyncua). ASI Biont uses industrial_command with read_variable or writes a script.
Example command:
industrial_command(protocol='opcua', command='read_variable', params={'url':'opc.tcp://192.168.1.100:4840','node':'ns=2;i=1001'})
7. BACnet: Building Management System (BMS) HVAC Data
Scenario: A large office building uses BACnet/IP. The AI reads temperature setpoints and actual temperatures from air handling units. If a zone is too cold, it adjusts the setpoint.
Connection method: BACnet via bac0 inside execute_python. ASI Biont uses industrial_command with read_property and write_property.
Example command:
industrial_command(protocol='bacnet', command='read_property', params={'device':'AHU-1','object_type':'analogInput','instance':1,'property':'presentValue'})
8. CAN Bus: Vehicle Telemetry from a Bus
Scenario: An electric city bus uses CAN bus to transmit speed, battery voltage, and motor temperature. The AI wants to monitor battery health and alert if voltage drops below 350V during operation.
Connection method: CAN bus via python-can inside execute_python (requires CAN interface connected to the server, e.g., USB-to-CAN). Since execute_python runs in cloud, actual CAN hardware must be accessible via a local bridge. Alternatively, the bus's telemetry gateway publishes to MQTT. For direct CAN, use Hardware Bridge with a CAN adapter (serial/COM).
Example with bridge: Send CAN frame as hex command.
9. CoAP: Constrained IoT Sensor Node
Scenario: An ESP32-based sensor node using CoAP (lightweight M2M) publishes temperature. The AI wants to GET the resource /temp and OBSERVE for changes.
Connection method: CoAP via aiocoap inside execute_python or industrial_command.
Example command:
industrial_command(protocol='coap', command='get', params={'uri':'coap://192.168.1.200/temp'})
10. gRPC: Microservice in an Industrial Gateway
Scenario: An industrial edge gateway exposes a gRPC service TelemetryService with a StreamReadings RPC. The AI wants to consume the stream and react to anomalies.
Connection method: gRPC via grpcio inside execute_python.
Example code:
import grpc
import telemetry_pb2_grpc as pb2_grpc
import telemetry_pb2 as pb2
channel = grpc.insecure_channel('192.168.1.30:50051')
stub = pb2_grpc.TelemetryServiceStub(channel)
responses = stub.StreamReadings(pb2.Empty())
for r in responses:
if r.temperature > 80:
print(f"Overheat: {r}")
Conclusion
From an MQTT-enabled warehouse to a CAN bus–equipped bus, ASI Biont connects to virtually any sensor or telemetry system without a single line of code written by you. The AI agent understands your hardware, chooses the right protocol, writes the integration script, and executes it — all in response to plain-English instructions.
Why this matters: Traditional telemetry projects require weeks of development. With ASI Biont, you can set up a complete alerting and logging pipeline in minutes. No dashboards to configure, no servers to manage — just describe your devices in chat.
Ready to try it? Head over to asibiont.com, create an API key, download the bridge, and tell the AI to connect your sensors. The future of industrial automation is conversational.
Comments