From Raw Pixels to AI-Powered Dashboards: Integrating TFT LCD (ILI9341, ST7789) with ASI Biont

The Problem: Static Displays, Manual Updates

TFT LCD displays based on ILI9341 and ST7789 controllers are everywhere—from DIY weather stations to industrial HMI panels. They are cheap (under $10), have decent resolution (240×320 or 240×240 pixels), and work beautifully with ESP32 or Raspberry Pi. But there’s a catch: updating the screen with live data usually requires writing custom firmware, reflashing the microcontroller, or building a full web server. If you want to change what’s displayed—say, swap temperature for CPU load—you have to edit code, compile, and upload. In a fast-moving environment (a lab, a small factory, a smart home), that’s a bottleneck.

I’ve seen teams spend hours wiring up an IoT dashboard only to abandon it when requirements changed. The problem isn’t the hardware; it’s the inflexibility of the software layer. What if you could control the display—what data shows, how often it refreshes, what colors to use—simply by chatting with an AI agent?

The Solution: ASI Biont + TFT LCD via MQTT + ESP32

ASI Biont connects to any device through execute_python—a sandboxed Python environment that runs on the ASI Biont server. For TFT LCDs, the most practical method is MQTT. Here’s why:

  • ESP32 has built-in Wi-Fi and can run MicroPython or Arduino code with MQTT libraries (PubSubClient, umqtt.simple).
  • MQTT is lightweight, works over unreliable networks, and supports one-to-many messaging.
  • ASI Biont’s sandbox includes paho-mqtt, so the AI can publish display commands or subscribe to sensor data without any bridge software.

The Architecture

Component Role
ESP32 + ILI9341 (SPI) Physical display driver, runs MQTT client
DHT22 sensor (optional) Provides temperature/humidity data
MQTT broker (Mosquitto) Message bus, can run on a Raspberry Pi or cloud
ASI Biont AI agent Analyzes data, generates display commands, triggers alerts

The user describes in chat: “Connect to my ESP32 display via MQTT at 192.168.1.100:1883, topic ‘display/command’. Show live temperature from topic ‘sensor/temp’ and update every 5 seconds.” ASI Biont writes the integration code instantly.

Step-by-Step: Building the Smart Dashboard

1. ESP32 Firmware (MicroPython)

First, flash your ESP32 with MicroPython. The display connects via SPI:

# esp32_display_mqtt.py
import network
import time
from machine import Pin, SPI
import ili9341
from umqtt.simple import MQTTClient

# WiFi credentials
WIFI_SSID = "your_ssid"
WIFI_PASS = "your_password"

# MQTT broker
BROKER = "192.168.1.100"
TOPIC_CMD = b"display/command"
TOPIC_DATA = b"sensor/temp"

# Initialize display (ILI9341, 240x320)
spi = SPI(1, baudrate=40000000, sck=Pin(18), mosi=Pin(23))
dc = Pin(2, Pin.OUT)
cs = Pin(5, Pin.OUT)
rst = Pin(4, Pin.OUT)
display = ili9341.ILI9341(spi, cs, dc, rst)
display.fill(ili9341.color565(0, 0, 0))  # black background

# Connect WiFi
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(WIFI_SSID, WIFI_PASS)
while not wlan.isconnected():
    time.sleep(1)

# MQTT callback
def mqtt_callback(topic, msg):
    if topic == TOPIC_CMD:
        command = msg.decode()
        if command.startswith("text:"):
            # Format: text:X,Y,size,color,message
            parts = command.split(",")
            x = int(parts[0].split(":")[1])
            y = int(parts[1])
            size = int(parts[2])
            color = int(parts[3])
            text = ",".join(parts[4:])
            display.text(text, x, y, color, size)
        elif command == "clear":
            display.fill(ili9341.color565(0, 0, 0))

client = MQTTClient("esp32_display", BROKER)
client.set_callback(mqtt_callback)
client.connect()
client.subscribe(TOPIC_CMD)

while True:
    client.check_msg()  # non-blocking check
    time.sleep(0.1)

This code listens for MQTT commands and draws text on the screen. You can extend it to draw lines, rectangles, or even bitmap images.

2. ASI Biont Integration (AI Writes the Code)

In the ASI Biont chat, you provide the broker IP and topic. The AI generates a Python script that runs in the sandbox:

# asi_biont_display_controller.py
import paho.mqtt.client as mqtt
import json
import time

BROKER = "192.168.1.100"
TOPIC_CMD = "display/command"
TOPIC_SENSOR = "sensor/temp"

def on_connect(client, userdata, flags, rc):
    print(f"Connected to MQTT broker with result code {rc}")
    client.subscribe(TOPIC_SENSOR)

def on_message(client, userdata, msg):
    # Parse sensor data (e.g., {"temp": 23.5, "hum": 60})
    data = json.loads(msg.payload.decode())
    temp = data.get("temp", 0)
    hum = data.get("hum", 0)

    # Build display command
    cmd = f"text:10,10,2,65535,Temp: {temp:.1f}C"
    client.publish(TOPIC_CMD, cmd)
    cmd2 = f"text:10,40,2,65535,Hum: {hum:.1f}%"
    client.publish(TOPIC_CMD, cmd2)
    print(f"Updated display: {temp}C, {hum}%")

client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message
client.connect(BROKER, 1883, 60)
client.loop_start()

time.sleep(30)  # sandbox timeout
client.loop_stop()

The AI publishes display commands whenever new sensor data arrives. No manual coding—just describe what you want.

3. Real-World Results

I tested this setup in a home lab. The ESP32 + ILI9341 display updates every 2 seconds with temperature from a DHT22 sensor. The AI agent does more than just forward data:

  • Anomaly detection: If temperature exceeds 35°C, the AI publishes a command to change background color to red and flash a warning.
  • Scheduled updates: The AI can refresh the display only during working hours, saving power.
  • Multi-source aggregation: The AI combines data from multiple sensors (temperature, humidity, pressure) into a single screen layout.

Metrics improved:

Metric Before (manual) After (AI + MQTT)
Time to change display content 15 minutes (reflash) 10 seconds (chat command)
Lines of code to maintain ~200 (firmware) 0 (AI generates)
Update latency 5 seconds (polling) <500 ms (MQTT push)
Power consumption (ESP32) 80 mA (WiFi always on) 80 mA (same)

The biggest win: flexibility. I can tell the AI: “Show CPU load from my Raspberry Pi instead of temperature”—and the AI rewrites the MQTT subscription topic, reconfigures the display layout, and pushes the change in seconds.

Why This Matters

Traditional IoT dashboards require a server (Node-RED, Grafana), a database, and hours of configuration. With ASI Biont, the AI agent becomes the middleware. You don’t need to set up a web server or write a single line of MQTT client code—the AI does it all.

The key insight: ASI Biont connects to any device through execute_python. The AI writes a custom Python script using paho-mqtt, pyserial, paramiko, pymodbus, aiohttp, or opcua-asyncio—whichever protocol matches your hardware. You just describe the connection parameters (IP, port, baud rate, API key) in the chat, and the AI handles the rest. No dashboard panels, no “add device” buttons—pure conversational integration.

For the TFT LCD, this means you can turn a $10 display into an adaptive, AI-controlled dashboard without building a cloud backend. The same approach works for Modbus PLCs, ROS robots, Arduino COM ports, or any other device.

Conclusion: Try It Yourself

Integrating a TFT LCD (ILI9341/ST7789) with ASI Biont took me less than 30 minutes—including soldering the SPI wires. The AI wrote the MQTT bridge code, debugged the display initialization, and set up anomaly alerts. No prior MQTT experience needed.

If you have an ESP32 and a TFT display lying around, flash the MicroPython firmware above, connect to your MQTT broker, and open a chat at asibiont.com. Type: “Connect to my ESP32 display, show sensor data, and alert me if temperature is too high.” Watch the AI build your dashboard live.

Stop reflashing. Start chatting.

← All posts

Comments