Welcome to the world where your I2C sensors get a second life. You've probably spent hours wiring up a BME280 to an ESP32, only to watch raw numbers scroll by in a serial monitor. Now imagine asking your AI agent: "What's the temperature in the lab?" and getting an instant answer, or "Notify me if the humidity drops below 30%". That's exactly what ASI Biont makes possible.
Why I2C + AI?
I2C (Inter-Integrated Circuit) is a simple, low-speed bus used by thousands of sensors – temperature, humidity, pressure, accelerometers, displays, ADCs. The problem? It's a local bus. Your AI agent lives on a server, not on your desk. To connect the two, you need a gateway – typically an ESP32, ESP8266, or Raspberry Pi. ASI Biont can talk to that gateway via MQTT, serial (COM port), or even plain Python code. And the best part: you don't write the integration code from scratch. The AI writes it for you, right in the chat – no separate management panels, no "Add Device" buttons. Just describe what you have, and the AI does the rest.
How ASI Biont Connects to I2C
ASI Biont is protocol-agnostic. Out of the box, it supports MQTT, Modbus, OPC-UA, COM ports, and many more. For I2C, the most common scenario is:
- ESP32 + I2C sensor → reads physical values.
- ESP32 publishes to MQTT → over Wi-Fi.
- ASI Biont subscribes to MQTT → AI now has real-time data.
But there's a second path: connect the ESP32 to your PC via USB and use the Hardware Bridge (bridge.py) to expose the COM port to ASI Biont. The AI can then send commands to the ESP32 and read responses. The Hardware Bridge is downloaded from the ASI Biont dashboard (not GitHub), and launched with:
python bridge.py --token=YOUR_TOKEN --ports=COM3 --baud=115200 --rate=10
And there's the universal fallback: execute_python. ASI Biont can run any Python script in a sandbox, using libraries like pyserial, paho-mqtt, or even smbus2 (if you have a Raspberry Pi with local access). You simply describe the device in chat, and the AI writes the script on the fly. This means ASI Biont connects to any device through execute_python – you don't need to wait for developers to add support. The AI codes around any hardware, right now.
Real-World Example: ESP32 + BME280 via MQTT
Let's build a complete monitoring setup. I'll assume you have an ESP32 DevKit, a BME280 breakout board (I2C address 0x76 or 0x77), and a Wi-Fi network.
Wiring Diagram
| BME280 Pin | ESP32 Pin |
|---|---|
| VCC (3.3V) | 3V3 |
| GND | GND |
| SDA | GPIO21 |
| SCL | GPIO22 |
Remember to connect 4.7kΩ pull-up resistors from SDA and SCL to 3.3V if your breakout doesn't have them. Many modules already include them, but verify with a multimeter.
MicroPython Code
Flash MicroPython on your ESP32 (see official docs), then run this script. It reads the BME280 and publishes to an MQTT broker every 10 seconds.
from machine import Pin, I2C
import bme280
import network
import time
from umqtt.simple import MQTTClient
# I2C setup
i2c = I2C(0, scl=Pin(22), sda=Pin(21), freq=400000)
sensor = bme280.BME280(i2c=i2c)
# Wi-Fi connection
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect('YOUR_SSID', 'YOUR_PASSWORD')
while not wlan.isconnected():
time.sleep(0.5)
# MQTT client (public broker for demo)
client = MQTTClient('esp32_01', 'broker.emqx.io', port=1883)
client.connect()
while True:
temp, press, hum = sensor.read_compensated_data()
temp_c = temp / 100.0
press_hpa = press / 100.0
hum_r = hum / 1024.0
client.publish('sensors/room1/temperature', str(temp_c))
client.publish('sensors/room1/humidity', str(hum_r))
client.publish('sensors/room1/pressure', str(press_hpa))
time.sleep(10)
Note: You'll need the BME280 MicroPython library. Copy it to your ESP32.
Chat with ASI Biont
Now, open your ASI Biont chat and type:
Connect to MQTT broker at broker.emqx.io, port 1883, topic
sensors/room1/#. Store the latest temperature, humidity, and pressure. Alert me if temperature exceeds 30°C.
That's it. ASI Biont's AI Integration Builder (the chat interface) handles the MQTT subscription, data parsing, and alert logic. You can then ask: "What's the temperature right now?" or "Send a daily summary to my Telegram at 9am." The AI will use requests.post to call the Telegram Bot API, or any other action you specify.
Alternative: Serial via Hardware Bridge
If you prefer a wired connection, the Hardware Bridge is rock-solid. Flash this Arduino sketch on your ESP32:
#include <Wire.h>
#include <Adafruit_BME280.h>
Adafruit_BME280 bme;
void setup() {
Serial.begin(115200);
Wire.begin(21, 22);
if (!bme.begin(0x77)) {
Serial.println("BME280 not found!");
while (1);
}
}
void loop() {
if (Serial.available()) {
String cmd = Serial.readStringUntil('\n');
cmd.trim();
if (cmd == "read") {
float t = bme.readTemperature();
float h = bme.readHumidity();
float p = bme.readPressure() / 100.0F;
Serial.print("temp="); Serial.print(t);
Serial.print(",hum="); Serial.print(h);
Serial.print(",press="); Serial.println(p);
}
}
}
Launch the Hardware Bridge (downloaded from the ASI Biont dashboard) with your COM port and baud rate:
python bridge.py --token=MY_TOKEN --ports=COM5 --baud=115200 --rate=10
Then in chat, tell the AI:
Use the serial bridge on COM5 to send "read" and parse the response.
The AI will call industrial_command(protocol='serial', command='read', port='COM5', baud=115200) and return the sensor values. No HTTP endpoints, no custom webhooks – just direct serial communication. The bridge has no HTTP API, so industrial_command() is the way to go.
Pitfalls to Avoid
- Pull-up resistors: I2C requires pull-ups. If your data lines float, you'll get random bytes or hangs. 4.7kΩ to 3.3V is standard.
- Address conflicts: Many sensors share addresses. Use
i2c.scan()in MicroPython to find yours. For BME280, it's often 0x76 or 0x77. - Level shifting: For 5V sensors, use a logic level converter. ESP32 pins are not 5V tolerant.
- MQTT QoS: For sensor data, QoS 0 is fine. For critical alerts, use QoS 1 to avoid missed messages.
- execute_python timeout: The AI's Python sandbox has a 30-second timeout. Don't run infinite loops; use a single request-response pattern instead. That's important for
execute_python– the AI script must finish quickly. - Serial noise: When using the Hardware Bridge, keep your ESP32 free of
Serial.printdebug statements that could confuse the AI's parser.
Universal execute_python: Connect Anything
One of the most powerful features of ASI Biont is execute_python. You're not limited to pre-built integrations. The AI can write a Python script that does exactly what you need – using pyserial, paho-mqtt, paramiko, requests, or any other library. For example, if you have a Raspberry Pi with an I2C sensor and want to read it directly, you can grant SSH access to the Pi and let the AI use paramiko to run a remote script. Or if your sensor has a Python library, the AI can install it in the sandbox and fetch data via a one-off script.
The workflow is always the same:
1. You describe your device: "I have a Raspberry Pi at 192.168.1.50 with a BME280 on I2C, user pi, password ..." (or better, use SSH keys).
2. The AI writes a paramiko script to connect, run Python, and read the sensor.
3. You get the result in chat.
No need to wait for the ASI Biont team to add support for your specific sensor. The AI codes around any hardware, and with execute_python the possibilities are literally endless.
Why This Matters
Traditional IoT platforms require you to configure dashboards, write integration logic, and set up alerts. With ASI Biont, the integration is a conversation. The AI understands the context, writes the code, and even debugs it for you. In my experience, what used to take a day of plumbing now takes five minutes of chat. For instance, just last week I connected three I2C sensor nodes (temperature, moisture, and air quality) to a single ASI Biont agent. The AI automatically created separate MQTT topics, set alerts for each, and posted a daily summary to Slack. All I did was describe the sensors and the thresholds.
Try It Yourself
Head over to asibiont.com, grab your API token, and start connecting your sensors. Whether you're building a smart greenhouse, a server room monitor, or just a weather station that chirps at you in Telegram, ASI Biont will handle the hard part. Describe your I2C device in the chat, and watch the AI do the rest. No more serial monitor, no more dashboards – just pure, conversational automation.
Comments