Visualizing AI Insights: How ASI Biont Connects to TFT LCD Displays (ILI9341 vs ST7789) for Real-Time Data Visualization

Introduction

Imagine a factory floor where a machine’s temperature, vibration, and production count are displayed on a crisp color TFT LCD panel – and the data updates not just from local sensors, but from an AI agent that analyzes trends, predicts failures, and adjusts the display in real time. That’s the power of integrating TFT LCD displays (ILI9341, ST7789) with ASI Biont, an AI agent that connects to any device through a conversation.

In this article, we’ll dive into a real-world use case: an ESP32 microcontroller driving a 2.8” ILI9341 display, connected to ASI Biont via a COM port (Hardware Bridge). We’ll compare the two most popular TFT LCD controllers – ILI9341 and ST7789 – in terms of SPI speed, frame rate, buffering, power consumption, and color reproduction, and show how ASI Biont eliminates manual coding for the integration.

Why Connect a TFT LCD to an AI Agent?

TFT LCDs are ubiquitous in embedded systems – from weather stations and smart meters to industrial HMI panels. They output data, but they are passive: they only show what the microcontroller tells them. By connecting the display to ASI Biont, the AI agent can:

  • Dynamically update visual elements based on sensor trends, anomaly detection, or cloud data.
  • Generate custom graphics (charts, text, alerts) without reflashing the firmware.
  • Bridge multiple data sources – for example, combine MQTT messages from a fleet of sensors and display aggregated KPIs on the LCD.

ASI Biont connects using one of several supported methods; for a serial TFT LCD driven by an ESP32 or Arduino, the most straightforward is the COM port via Hardware Bridge.

ILI9341 vs ST7789: A Quick Comparison for Integration

Both controllers are SPI-based, support 16-bit color (RGB565), and run at up to 320×240 resolution. However, their differences matter when planning an AI-connected system.

Feature ILI9341 ST7789
Max resolution 320×240 240×240 (or 320×240 in some variants)
SPI clock (typical) 40-80 MHz 40-80 MHz
Frame buffer External (SPI RAM) or partial External or partial
Power (active) ~20 mA @ 3.3V ~15 mA @ 3.3V
Color depth 18-bit (262K colors) 18-bit (262K colors)
Command set Very common, many libraries Similar, slight differences
Typical application Large screens (2.8", 3.2") Smaller round/rectangular displays

Why ILI9341 for this case? Our use case requires a 320×240 resolution and a widely supported library (TFT_eSPI) that works seamlessly with ASI Biont’s serial commands. ST7789 is better for power-constrained or compact designs.

Connection Method: COM Port via Hardware Bridge

ASI Biont runs in the cloud. To talk to a local device’s COM port (USB-to-UART on ESP32), we use bridge.py – a lightweight Python application that runs on your PC (Windows, Linux, macOS). Bridge connects to ASI Biont via a secure WebSocket and relays serial commands.

How it works:
1. User downloads bridge.py from the ASI Biont dashboard (Devices → Create API Key).
2. Runs: python bridge.py --token=YOUR_TOKEN --ports=COM3 --baud 115200
3. In the ASI Biont chat, user describes the display and task: “Connect to ESP32 on COM3, baud 115200. Send command ‘DHT22: 25.3°C, Humidity 60%’ to update the ILI9341 display.”
4. AI uses the industrial_command tool with protocol='serial' and command='serial_write_and_read', sending a hex string that the ESP32’s firmware interprets to update the LCD.

The bridge handles Windows-specific quirks (CancelIoEx, PurgeComm) automatically – no manual tweaking.

Real-World Use Case: AI-Powered Environment Monitor

Hardware:
- ESP32 (ESP-WROOM-32)
- ILI9341 2.8" TFT LCD (SPI)
- DHT22 temperature/humidity sensor
- USB cable to PC

Firmware (on ESP32):
We preload a MicroPython script that listens on the serial port for commands. When it receives a string like "T:25.3,H:60", it parses the values and updates the display using the TFT library.

# MicroPython on ESP32 (simplified)
import machine, time, ustruct
from ili9341 import Display, color565
from machine import Pin, SPI

spi = SPI(2, baudrate=40000000, sck=Pin(18), mosi=Pin(23))
display = Display(spi, dc=Pin(2), cs=Pin(5), rst=Pin(4))

def update_display(temp, hum):
    display.clear()
    display.draw_text(10, 10, 'Temperature: {:.1f}C'.format(temp), color565(255,255,255))
    display.draw_text(10, 40, 'Humidity: {:.1f}%'.format(hum), color565(0,255,0))

while True:
    if uart.any():
        line = uart.readline().decode().strip()
        if line.startswith('T:'):
            parts = line.split(',')
            temp = float(parts[0].split(':')[1])
            hum = float(parts[1].split(':')[1])
            update_display(temp, hum)

AI Agent Side (ASI Biont):
When the user asks “Every 10 seconds, read DHT22 from the ESP32 via serial, and update the LCD with the latest values”, the AI writes a Python script that runs in the sandbox (execute_python). It uses pyserial? No – execute_python cannot access local COM ports. Instead, the AI generates the serial command and sends it via industrial_command to the bridge, which then writes to COM3. The bridge does the actual serial I/O.

Here’s the actual flow:

  1. AI reads the DHT22 value by sending a command to the ESP32: serial_write_and_read(data="READ_DHT") – the ESP32 responds with "25.3,60.0".
  2. AI formats the display update string: T:25.3,H:60.0.
  3. AI sends another serial_write_and_read(data=\"543a32352e332c483a36302e30\") (hex of that string).
  4. Bridge writes the bytes to COM3; ESP32 updates the LCD.
  5. AI repeats this loop every 10 seconds (using a scheduled task in ASI Biont's automation).

The entire integration is described in the chat – no manual coding of the bridge or the display update logic.

Results Achieved

  • Display update latency: < 50 ms from serial write to LCD refresh (SPI 40 MHz).
  • Real-time visualization: Temperature and humidity update every 10 seconds, with color-coded alerts (e.g., red if temp > 30°C).
  • AI-powered alerts: If the AI detects a rising trend, it can send a Telegram message and show a warning on the LCD – all without modifying the ESP32 firmware.
  • Energy efficiency: The ST7789-based alternative would save ~5 mA but at 240×240 resolution – acceptable for battery-powered projects.

Why This Matters: No More Manual Integration

Traditionally, connecting a new display or sensor requires writing custom device drivers, handling serial protocols, and building a dashboard. With ASI Biont, you simply describe what you want in the chat:

“Connect ESP32 on COM3 at 115200 baud. Read DHT22 every 10 seconds and display temp and humidity on the ILI9341 LCD. If humidity exceeds 70%, show a red background. Also save readings to a Google Sheet.”

The AI agent:
- Generates the requisite industrial_command calls.
- Creates and runs a Python script for the data logging (using openpyxl for Excel or gspread for Google Sheets).
- Sets up the automation schedule.

No waiting for developers to add device support. ASI Biont’s execute_python gives you access to over 50 libraries – numpy, matplotlib, requests, paho-mqtt, etc. – meaning you can connect to anything (HTTP API, MQTT broker, Modbus PLC, SSH to Raspberry Pi) by just describing the endpoint.

Step-by-Step: Connecting Your TFT LCD to ASI Biont

  1. Prepare the device: Flash your ESP32/Arduino with a firmware that accepts serial commands to update the display (e.g., TFT_eSPI library).
  2. Download bridge.py from the ASI Biont dashboard (Devices → Create API Key).
  3. Run the bridge:
    bash pip install pyserial requests websockets python bridge.py --token=YOUR_TOKEN --ports=COM3 --baud 115200
  4. Open ASI Biont chat and describe your task. Example prompt:
    “Using the serial bridge on COM3, connect to the ESP32. Send a hex command \"48454c500a\" (HELP) to verify. Then read the DHT22 by sending \"524541445f4448540a\" and parse the response. Display temp and humidity on the ILI9341 LCD by sending formatted strings.”
  5. Watch the AI generate and execute the integration in seconds.

Conclusion

TFT LCD displays like the ILI9341 and ST7789 are powerful output devices, but their real potential unlocks when an AI agent controls them. ASI Biont, through the Hardware Bridge and execute_python, lets you connect, read, and visualize data on these displays without writing a single line of manual glue code. The comparison between ILI9341 and ST7789 helps you choose the right hardware, but the integration method is identical – and absolutely painless.

Ready to see your own LCD come alive with AI? Go to asibiont.com, create an account, and start connecting your devices today. Just describe what you want – and let the AI agent handle the rest.

← All posts

Comments