Introduction
TFT LCD displays based on ILI9341 (320×240) and ST7789 (240×240, 135×240) controllers are ubiquitous in embedded systems — from weather stations and smart home panels to industrial HMI and IoT dashboards. These SPI-driven color screens offer rich graphical output but traditionally require manual firmware coding for every new use case. With ASI Biont, an AI agent that connects to any device through a conversational chat, you can automate display content, react to sensor data, and build adaptive visual interfaces — without writing a single line of C++ yourself. This article explains how to integrate ILI9341/ST7789 displays with ASI Biont, the supported connection methods, and practical scenarios that become possible.
Why Connect a TFT LCD to an AI Agent?
A standalone TFT LCD shows static data: temperature, time, or a fixed image. When paired with ASI Biont, the display becomes a dynamic output device that the AI agent updates based on external triggers — weather forecasts, sensor alarms, machine status, or even natural language commands. The AI handles all logic: parsing data, generating graphics (as bitmaps or commands), and sending updates to the display. This eliminates the need to reflash the microcontroller every time the display logic changes.
Connection Methods for TFT LCD (ILI9341, ST7789) with ASI Biont
ASI Biont supports multiple protocols to talk to embedded displays. The exact method depends on the host microcontroller (ESP32, Arduino, Raspberry Pi) and the display interface (SPI, parallel, or I2C). Below is a summary of the most relevant options:
| Connection Method | Best For | How It Works |
|---|---|---|
| COM Port (Hardware Bridge) | Arduino/ESP32 with serial interface | User runs bridge.py locally, ASI Biont sends hex commands (e.g., draw pixel, fill screen) via industrial_command serial_write_and_read. |
| MQTT | ESP32 with Wi-Fi + TFT | ESP32 subscribes to MQTT topics; ASI Biont publishes display commands (JSON payloads) to update text, draw shapes, or show images. |
| SSH | Raspberry Pi + TFT (directly connected via GPIO) | ASI Biont writes and executes Python scripts via paramiko on the Pi, using libraries like luma.lcd or Pillow to render frames. |
| HTTP API | Any device with a web server (ESP32 with AsyncWebServer) | ESP32 exposes endpoints (e.g., /draw?text=Hello), ASI Biont calls them via aiohttp inside execute_python. |
| execute_python | All of the above | AI generates a Python script that uses one of the libraries above to connect and control the display. |
Concrete Use Case: ESP32 + ST7789 Display + MQTT Weather Dashboard
Scenario: You have an ESP32 with a 1.3-inch ST7789 (240×240) display. You want to show live weather data (temperature, humidity, icon) fetched from OpenWeatherMap, updated every 5 minutes. Without ASI Biont, you would need to write firmware that handles Wi-Fi, JSON parsing, and display rendering. With ASI Biont, you describe the setup in chat, and the AI agent does the rest.
Step-by-Step Integration
- Hardware Setup
- ESP32 (e.g., ESP32-DevKitC)
- ST7789 display connected over SPI (CS, DC, RST, SCLK, MOSI)
-
Wi-Fi credentials and MQTT broker (e.g., Mosquitto on a local server or cloud)
-
ESP32 Firmware (written once, by user or AI)
- MicroPython or Arduino code that connects to MQTT, subscribes to topic
asi/display/command, and parses JSON payloads like{"type":"text","x":10,"y":20,"value":"23.5°C"}. - The firmware uses the
st7789orTFT_eSPIlibrary to render text, shapes, and bitmaps. -
Example snippet (Arduino):
cpp void callback(char* topic, byte* payload, unsigned int length) { String msg = String((char*)payload); // Parse JSON and update display drawTemperature(msg); } -
ASI Biont Integration via Chat
- User writes in the chat: “Connect to my ESP32 ST7789 display via MQTT at broker mqtt://192.168.1.100:1883. Subscribe to topic
asi/display/status. Every 5 minutes, fetch weather from OpenWeatherMap API and publish a JSON command toasi/display/commandwith temperature, humidity, and a weather icon as a bitmap.” -
ASI Biont generates a Python script that uses
paho-mqttandrequests(insideexecute_python) to:- Subscribe to
asi/display/statusfor acknowledgment. - Fetch weather data from OpenWeatherMap (API key provided by user).
- Convert weather icon code to a small monochrome bitmap (e.g., sun, rain).
- Publish to
asi/display/command:
```python
import paho.mqtt.client as mqtt
import requests
import json
import time
def on_connect(client, userdata, flags, rc):
client.subscribe("asi/display/status")def fetch_weather(api_key, city):
url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
r = requests.get(url)
data = r.json()
return {
"temp": round(data["main"]["temp"], 1),
"humidity": data["main"]["humidity"],
"icon": data["weather"][0]["icon"]
}def publish_weather(client, weather):
payload = {
"type": "weather_update",
"temp": weather["temp"],
"humidity": weather["humidity"],
"icon": weather["icon"]
}
client.publish("asi/display/command", json.dumps(payload))client = mqtt.Client()
client.on_connect = on_connect
client.connect("192.168.1.100", 1883, 60)
client.loop_start()
while True:
weather = fetch_weather("your_api_key", "London")
publish_weather(client, weather)
time.sleep(300) # 5 minutes
``` - Subscribe to
-
AI Agent Monitoring
- The AI agent can also listen to the
asi/display/statustopic to verify updates were received. If the ESP32 reports an error (e.g., “WiFi disconnected”), the AI can adjust parameters or notify the user.
Result
- Display updates automatically every 5 minutes with live weather.
- User can ask ASI Biont: “Show tomorrow’s forecast instead” — the AI immediately publishes a new command with forecast data.
- No need to reflash the ESP32; all logic changes happen in the cloud.
Alternative: Raspberry Pi + ST7789 via SSH
If the display is connected directly to a Raspberry Pi (e.g., via GPIO), ASI Biont can use SSH. The user provides the Pi’s IP and credentials. The AI writes a Python script that uses luma.lcd (which supports ST7789) to draw text and images. Example:
from luma.core.interface.serial import spi
from luma.core.render import canvas
from luma.lcd.device import st7789
import requests
serial = spi(port=0, device=0, gpio_DC=25, gpio_RST=27)
device = st7789(serial)
weather = requests.get("https://api.openweathermap.org/data/2.5/weather?q=London&appid=API_KEY&units=metric").json()
temp = str(round(weather["main"]["temp"], 1)) + "C"
with canvas(device) as draw:
draw.text((10, 10), f"Temp: {temp}", fill="white")
The AI can schedule this script via cron inside the SSH session, or run it on demand.
How ASI Biont Connects to Any Device Without Waiting for Updates
One of the most powerful features of ASI Biont is that it does not require a pre-built driver for every device. Instead, the AI agent generates custom integration code on the fly using execute_python. This Python sandbox (running on ASI Biont’s server — Railway) has access to dozens of libraries: pyserial, paho-mqtt, paramiko, pymodbus, aiohttp, opcua-asyncio, and more. The user simply describes the device and connection parameters in the chat:
- “Connect to my TFT display via COM3 at 115200 baud. Send command ‘HELLO’ and then update the screen with temperature every minute.”
- “I have an ESP32 with ST7789 on my local network, IP 192.168.1.42. Use MQTT to display CPU load from my server.”
The AI writes the Python script, executes it in the sandbox (or via Hardware Bridge for COM port access), and the device starts responding. No dashboard panels, no “add device” buttons — just a conversation.
Benefits of AI-Powered Display Control
- Zero code changes for new logic — The AI agent updates the display logic without touching the microcontroller firmware.
- Multimodal data sources — The display can show data from databases, cloud APIs, industrial PLCs, or other IoT devices that ASI Biont also controls.
- Natural language interface — You can say “Show a red warning if the temperature exceeds 40°C” and the AI implements the rule instantly.
- Scalability — One AI agent can manage dozens of displays across different locations, each with its own content.
Conclusion
Integrating TFT LCD displays (ILI9341, ST7789) with the ASI Biont AI agent transforms a passive screen into an intelligent, adaptive output device. Whether you use a simple Arduino with a serial connection, an ESP32 with MQTT, or a Raspberry Pi with SSH, the AI agent handles all the integration logic through a chat conversation. You describe what you want — the AI writes the code, connects to the device, and controls it. No firmware reflash, no waiting for driver updates.
Ready to make your display smarter? Try the integration yourself at asibiont.com. Just open a chat with the AI agent, describe your TFT LCD setup and what you want to show, and watch the AI connect, configure, and automate your display in seconds.
Comments