Integrate OLED (SSD1306, SH1106) Displays with ASI Biont: No-Code AI-Driven Notifications and Dashboards

Integrate OLED (SSD1306, SH1106) Displays with ASI Biont: No-Code AI-Driven Notifications and Dashboards

Introduction

Small OLED displays, like the ubiquitous SSD1306 (128×64 pixels) and SH1106 (132×64 pixels), are the unsung heroes of embedded projects. They show sensor readings, system status, or a cheeky smiley face — but traditionally, every line of text or pixel of graphics requires manual C/C++ or MicroPython programming. You write code, flash the firmware, tweak the layout, re-flash. It’s a cycle that kills agility.

What if you could tell an AI agent: “Show the current weather, my server CPU load, and the latest Telegram alert on the OLED, updating every 10 seconds” — and have it work in minutes, without touching a single line of firmware code? That’s exactly what ASI Biont delivers. The AI agent connects to your microcontroller (ESP32, Raspberry Pi Pico, Arduino) via MQTT, SSH, or COM port (through Hardware Bridge), and sends formatted data directly to the OLED display. No dashboard to configure, no buttons to click — just a conversation with the AI.

In this article, you’ll learn how ASI Biont integrates with OLED displays, what real-world tasks you can automate, and see working Python code examples. By the end, you’ll be able to turn any spare OLED into a live AI-powered notification panel.

Why Connect an OLED to an AI Agent?

Challenge Solution with ASI Biont
Manually programming display updates in C/Arduino AI writes MicroPython/Python code to control the display via I²C/SPI
Hard to combine data from multiple sources (weather, server stats, crypto prices) AI fetches data from any API, database, or MQTT topic and formats it for the OLED
Firmware updates require re-flashing AI sends new display content wirelessly — no firmware change needed
Limited screen real estate AI paginates content, scrolls text, or switches between screens automatically

Connection Methods: How ASI Biont Talks to Your OLED

ASI Biont supports multiple connection paths to your OLED-equipped microcontroller. The AI agent chooses the best method based on your description:

  1. MQTT (paho-mqtt) — Most flexible for ESP32/ESP8266. The AI subscribes to a topic where the MCU publishes display-ready data, or the AI publishes commands to a topic that the MCU parses and writes to the OLED.
  2. SSH (paramiko) — For Raspberry Pi or single-board computers running Linux. The AI connects via SSH, runs a Python script that uses the luma.oled or Adafruit_SSD1306 library to update the display.
  3. Hardware Bridge (COM port) — For Arduino or any MCU connected via USB serial. The AI sends hex-encoded data through bridge.py, which writes to the COM port; the MCU firmware interprets the data and updates the OLED.
  4. execute_python (sandbox) — The AI writes a Python script that runs in a secure cloud environment. If the OLED is connected to a Raspberry Pi accessible via SSH, the script executes remotely. If the OLED is on an ESP32 with a web server, the script calls the ESP32’s HTTP endpoint.

Real-World Scenario 1: ESP32 + DHT22 → OLED Weather Display via MQTT

Hardware Setup

  • ESP32 (any variant)
  • SSD1306 OLED 128×64, I²C (address 0x3C)
  • DHT22 temperature/humidity sensor
  • Breadboard and jumper wires
ESP32 Pin OLED Pin DHT22 Pin
3.3V VCC VCC
GND GND GND
GPIO 22 (SCL) SCL
GPIO 21 (SDA) SDA
GPIO 4 DATA

How ASI Biont Connects

You tell the AI: “Connect to an ESP32 via MQTT broker at 192.168.1.100:1883. The ESP32 publishes temperature/humidity to topic sensor/dht22. I want the OLED to show current temp and humidity, and also display a greeting like ‘Good morning’ if it’s before 12 PM. Update every 15 seconds.”

The AI generates two pieces of code:

  1. MicroPython firmware for ESP32 — reads DHT22, subscribes to MQTT topic display/text, and writes incoming strings to the OLED.
  2. Python script (runs in execute_python or on a local machine) — subscribes to sensor/dht22, fetches time-of-day greeting, formats the message, and publishes to display/text.

MicroPython Code (ESP32 side)

from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
import network
import time
from umqtt.simple import MQTTClient

# OLED setup
i2c = I2C(0, scl=Pin(22), sda=Pin(21))
oled = SSD1306_I2C(128, 64, i2c)

# Wi-Fi
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect('YourSSID', 'YourPassword')
while not wlan.isconnected():
    time.sleep(1)

# MQTT callback
def mqtt_callback(topic, msg):
    oled.fill(0)
    oled.text(msg.decode(), 0, 0, 1)
    oled.show()

# MQTT client
client = MQTTClient('esp32_oled', '192.168.1.100')
client.set_callback(mqtt_callback)
client.connect()
client.subscribe(b'display/text')

while True:
    client.check_msg()
    time.sleep(0.1)

AI-Generated Python Script (runs in ASI Biont sandbox)

import paho.mqtt.client as mqtt
import datetime
import random

BROKER = '192.168.1.100'
TOPIC_SENSOR = 'sensor/dht22'
TOPIC_DISPLAY = 'display/text'

def on_message(client, userdata, msg):
    # Simulate DHT22 data (in real setup, ESP32 publishes actual values)
    temp = round(20 + random.uniform(-5, 5), 1)
    hum = round(50 + random.uniform(-10, 10), 1)
    hour = datetime.datetime.now().hour
    if hour < 12:
        greeting = 'Good morning'
    elif hour < 18:
        greeting = 'Good afternoon'
    else:
        greeting = 'Good evening'
    display_text = f'{greeting}\nTemp: {temp}C\nHum: {hum}%'
    client.publish(TOPIC_DISPLAY, display_text)

client = mqtt.Client()
client.on_message = on_message
client.connect(BROKER)
client.subscribe(TOPIC_SENSOR)
client.loop_forever()

Result: The OLED updates every time a sensor reading arrives. The AI handles formatting, time-of-day logic, and MQTT routing — no manual coding required.

Real-World Scenario 2: Raspberry Pi + OLED → Server Status Dashboard via SSH

Hardware Setup

  • Raspberry Pi 4 (any model)
  • SH1106 OLED 128×64, SPI or I²C
  • Jumper wires (SPI: GPIO 10 (MOSI), GPIO 11 (SCLK), GPIO 8 (CE0), GPIO 25 (DC), GPIO 24 (RST))

How ASI Biont Connects

You tell the AI: “SSH into my Pi at 192.168.1.50 (user: pi, key: ~/.ssh/id_rsa). Show CPU load, free RAM, and disk usage on the OLED, refreshing every 5 seconds.”

The AI generates a Python script that runs on the Pi (via paramiko), using the luma.oled library to draw text and simple graphics.

AI-Generated Script (executed via SSH)

import paramiko
import time
from luma.core.interface.serial import spi
from luma.oled.device import sh1106
from luma.core.render import canvas
import psutil

# Connect to Pi via SSH
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('192.168.1.50', username='pi', key_filename='/home/user/.ssh/id_rsa')

# The AI will actually write the full script below to a file on the Pi and run it
# But here's the core display logic:

def update_display():
    serial = spi(device=0, port=0, gpio_DC=25, gpio_RST=24)
    device = sh1106(serial)
    while True:
        cpu = psutil.cpu_percent()
        mem = psutil.virtual_memory().percent
        disk = psutil.disk_usage('/').percent
        with canvas(device) as draw:
            draw.text((0, 0), f'CPU: {cpu}%', fill='white')
            draw.text((0, 16), f'RAM: {mem}%', fill='white')
            draw.text((0, 32), f'Disk: {disk}%', fill='white')
        time.sleep(5)

# The AI writes this to /home/pi/oled_dashboard.py and runs it via SSH

Result: A live server dashboard on a tiny OLED. The AI handles SSH connection, file writing, and process management.

Real-World Scenario 3: Arduino Uno + OLED → Serial Command Display via Hardware Bridge

Hardware Setup

  • Arduino Uno
  • SSD1306 OLED, I²C
  • USB cable to PC

How ASI Biont Connects

You tell the AI: “Connect via bridge.py on COM3, 115200 baud. Send any text I type in chat to the OLED in real time. Also, when I say ‘show bitcoin price’, fetch the current BTC/USD from CoinGecko and display it.”

The AI uses the industrial_command tool with protocol='serial' and command='serial_write_and_read' to send data. The Arduino firmware listens for incoming strings and writes them to the OLED.

Arduino Firmware (uploaded once)

#include <Wire.h>
#include <Adafruit_SSD1306.h>

Adafruit_SSD1306 display(128, 64, &Wire, -1);
String buffer = "";

void setup() {
  Serial.begin(115200);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  display.clearDisplay();
  display.display();
}

void loop() {
  while (Serial.available()) {
    char c = Serial.read();
    if (c == '\n') {
      display.clearDisplay();
      display.setTextSize(1);
      display.setTextColor(SSD1306_WHITE);
      display.setCursor(0, 0);
      display.println(buffer);
      display.display();
      buffer = "";
    } else {
      buffer += c;
    }
  }
}

AI Interaction in Chat

User: Connect to COM3 at 115200 and send "Hello OLED"
AI: (sends via bridge) serial_write_and_read(data="48656c6c6f204f4c45440a")
User: Now show bitcoin price
AI: (fetches BTC price from CoinGecko API, formats as "BTC: $67,890", sends hex to OLED)

Result: The OLED becomes a chat-driven display. The AI fetches external data and formats it on the fly.

Why ASI Biont Beats Manual Coding

Aspect Traditional Approach ASI Biont Approach
Setup time Hours to write, flash, debug Minutes: describe in chat
Adding new data sources Rewrite firmware AI fetches from any API
Changing display layout Re-flash MCU AI reformats text in chat
Multi-device coordination Custom middleware AI orchestrates via MQTT/HTTP

Advanced Tips

  • Pagination: If you have more text than the OLED can show (4–6 lines), tell the AI to scroll or switch pages every 5 seconds.
  • Graphics: The AI can generate simple bar charts or icons using pixel coordinates. For example, a battery icon for remaining charge.
  • Fallback: If the OLED is connected via I²C and the address is wrong (e.g., 0x3D instead of 0x3C), the AI can scan the bus and suggest the correct address.

Conclusion

Integrating an OLED display with ASI Biont turns a simple hardware peripheral into a dynamic, AI-controlled notification system. Whether you need a weather station, a server monitor, or a live cryptocurrency ticker, the AI agent handles all the wiring logic, data fetching, and formatting — you just describe what you want. No firmware rewrites, no dashboard configuration, no waiting for developer updates.

Try it yourself at asibiont.com — connect your OLED display today and see how fast AI can put your data on screen.

← All posts

Comments