Introduction
In the world of IoT and embedded systems, small OLED displays like the SSD1306 (128×64 pixels) and SH1106 (132×64 pixels) are ubiquitous. They are cheap, low-power, and perfect for showing sensor readings, system status, or notifications. However, programming them manually—writing I2C/SPI drivers, formatting text, updating data—is tedious and time-consuming. For a developer maintaining a fleet of devices, this can eat up 15+ hours per month in firmware changes alone.
Enter ASI Biont, an AI agent that integrates directly with hardware via natural language. Instead of coding display logic yourself, you describe what you want to show (weather, server load, Telegram mentions), and ASI Biont writes and deploys the code automatically. No dashboard, no buttons—just a chat conversation.
This article explains how to connect an OLED (SSD1306 or SH1106) to ASI Biont, which integration method fits best, and what automation scenarios become possible.
Why Connect an OLED Display to an AI Agent?
An OLED display is a passive output device—it shows information but doesn’t make decisions. By linking it to ASI Biont, you gain:
- Dynamic content without firmware updates – The AI can change what’s displayed based on real-time data (e.g., switch from temperature to stock price).
- Cross-service integration – Pull data from Telegram, Slack, weather APIs, or database queries and render it on the screen.
- Zero coding effort – The AI writes the MicroPython or Python script for you. You just connect the wires and provide credentials.
Connection Methods: Which One to Use?
ASI Biont supports multiple hardware communication protocols. For an OLED display, the most practical options are:
| Method | Description | Best For |
|---|---|---|
| SSH | Connect to a single-board computer (Raspberry Pi, Orange Pi) that has GPIO pins and an I2C interface. ASI Biont writes a Python script with the smbus2 or luma.oled library to drive the display. |
Permanent installations with a Linux host. |
| Hardware Bridge + COM port | If the OLED is connected to an Arduino or ESP32 via I2C, ASI Biont can flash or send commands through bridge.py on your PC. The AI uses industrial_command with serial:// protocol to write to the COM port. |
Prototyping or temporary setups. |
| MQTT | The OLED is driven by an ESP32 that subscribes to an MQTT topic. ASI Biont publishes formatted messages (e.g., JSON with text and position) to the topic. The ESP32’s firmware just reads the topic and renders it. | Scalable IoT fleets. |
For this guide, we focus on SSH + Raspberry Pi as the most flexible approach: the Pi runs a Python script that updates the OLED, and ASI Biont controls the script remotely.
Concrete Use Case: Real-Time Server Status on OLED
Imagine you have a small server room. You want an OLED display on the wall showing:
- CPU load of the main server
- Uptime
- Number of active users (from a PostgreSQL query)
- Latest Telegram notification
Step 1: Hardware Setup
- Raspberry Pi 3/4/5 with I2C enabled (
sudo raspi-config→ Interface Options → I2C → Enable). - OLED 128×64 (SSD1306) connected to Pi’s I2C pins: SDA (GPIO2) → SDA, SCL (GPIO3) → SCL, VCC → 3.3V, GND → GND.
- Default I2C address: 0x3C (check with
i2cdetect -y 1).
Step 2: Tell ASI Biont What You Want
Open the chat at asibiont.com and describe:
“Connect to my Raspberry Pi at 192.168.1.100 via SSH. Install the luma.oled library if missing. Write a Python script that shows on the OLED: current CPU load (top command), uptime, number of active users from PostgreSQL (database mydb, table users, column active), and the latest message from a Telegram bot. Use my Telegram API key and chat ID. Update every 10 seconds. Run the script in the background.”
In seconds, ASI Biont generates the full code and executes it. Here’s a simplified version of what it produces:
import psutil
import subprocess
import time
from luma.core.interface.serial import i2c
from luma.core.render import canvas
from luma.oled.device import ssd1306
import asyncpg
import requests
# OLED setup
serial = i2c(port=1, address=0x3C)
device = ssd1306(serial)
async def get_users():
conn = await asyncpg.connect(user='pi', password='secret', database='mydb')
count = await conn.fetchval('SELECT COUNT(*) FROM users WHERE active = true')
await conn.close()
return count
def get_telegram():
url = f"https://api.telegram.org/bot{TELEGRAM_TOKEN}/getUpdates"
resp = requests.get(url, params={'limit': 1, 'timeout': 5})
data = resp.json()
if data['ok'] and len(data['result']) > 0:
return data['result'][-1]['message']['text']
return "No messages"
while True:
cpu = psutil.cpu_percent(interval=1)
uptime = subprocess.getoutput('uptime -p')
active_users = asyncio.run(get_users())
last_msg = get_telegram()
with canvas(device) as draw:
draw.text((0, 0), f"CPU: {cpu}%", fill="white")
draw.text((0, 12), f"Up: {uptime}", fill="white")
draw.text((0, 24), f"Users: {active_users}", fill="white")
draw.text((0, 36), f"TG: {last_msg[:20]}", fill="white")
time.sleep(10)
But wait—the while True loop won’t work inside ASI Biont’s sandbox (30-second timeout). So ASI Biont actually writes a systemd service instead:
“Create a systemd unit
/etc/systemd/system/oled-display.servicethat runs this script on boot and restarts it if it crashes. Enable and start it.”
The AI does all of this in one conversation.
Step 3: Results
- The OLED now shows live server metrics.
- If a new Telegram message arrives, it appears on the screen within 10 seconds.
- If the database schema changes, you just ask: “Update the SQL query to count only users logged in the last hour.” The AI edits the script and reloads the service.
Alternative Scenario: MQTT with ESP32
If you prefer an ESP32-based display (no Raspberry Pi), connect the OLED to an ESP32 and flash a simple MQTT subscriber sketch. Then in ASI Biont, use the industrial_command tool with mqtt:// protocol to publish:
industrial_command(protocol='mqtt', command='publish', params={'topic': 'home/oled', 'message': '{"line1":"Temp: 22.5C","line2":"Pressure: 1013hPa"}'})
The ESP32 receives the JSON, parses it, and renders the text. The AI handles all formatting and scheduling.
Why This Beats Manual Coding
| Aspect | Manual Approach | ASI Biont Approach |
|---|---|---|
| Time to first display | 2-3 hours (wiring, library install, code debug) | 5 minutes (chat description) |
| Changing content | Edit firmware, recompile, reflash | “Add a line with stock price” – AI edits and restarts |
| Adding new data source | Write HTTP client, parse JSON, format text | “Pull data from my Google Sheets” – AI integrates Google API |
| Error handling | Manual try/except, watchdog | AI adds retries and logs automatically |
Conclusion
OLED displays (SSD1306, SH1106) are no longer just simple output peripherals—they become dynamic dashboards when connected to an AI agent. ASI Biont eliminates the firmware bottleneck: you describe what you want to see, and the AI writes, deploys, and maintains the code.
Whether you use a Raspberry Pi with SSH, an ESP32 with MQTT, or an Arduino via Hardware Bridge, the process is the same: chat with the AI, provide connection details, and watch your OLED come alive with real-time data.
Try it yourself at asibiont.com. Describe your OLED setup and your first automation scenario. The AI will connect, code, and run it in seconds.
Comments