Introduction
If you have ever wired up a TFT LCD display—whether it is the ubiquitous ILI9341 (320×240) or the compact ST7789 (240×240)—you know the feeling: you finally get the rainbow test pattern scrolling, only to realize that your display is a silent island. It shows data, but it cannot think about that data. It cannot alert you when a sensor reading spikes, or pull live weather from an API, or change its screen based on a chat message from across the room.
This is where the ASI Biont AI agent changes the game. Instead of writing hundreds of lines of C++ to handle every possible display state, you simply describe what you want in natural language. The AI generates the integration code, connects to your microcontroller via Hardware Bridge (a lightweight Python application running on your PC), and controls the TFT LCD in real time. No dashboard, no plugins, no waiting for vendor support. You can connect an ESP32, an Arduino, a Raspberry Pi, or any device that speaks serial, MQTT, or HTTP.
In this guide, you will learn how to integrate an ILI9341 or ST7789 display with ASI Biont using three different methods: direct serial control with MicroPython, MQTT-driven telemetry visualization, and HTTP-based remote triggering. Every code example is tested and ready to run.
Why Connect a TFT LCD to an AI Agent?
A standalone display is a passive output device. It shows whatever the microcontroller tells it to show. When you connect that same display to an AI agent, you unlock:
- Dynamic content generation – The AI decides what to display based on sensor data, time of day, or user requests.
- Remote control – Change screens or update values from anywhere using a chat interface.
- Automatic alerts – When a temperature threshold is breached, the display flashes red and shows a warning.
- No firmware reflashing – Modify display logic by simply chatting with the agent.
How ASI Biont Connects to a TFT LCD
ASI Biont does not have a built-in TFT LCD driver. Instead, it uses Hardware Bridge—a single Python script (bridge.py) that runs on your Windows, Linux, or macOS computer. The bridge connects to the ASI Biont cloud via WebSocket (the only communication channel) and provides access to your local COM ports, I²C, SPI, or any resource you expose through serial.
When you want to update the display, you send a command through the chat. The AI calls industrial_command(protocol='serial://', command='serial_write_and_read', data="..."). The bridge receives the command, writes the data to the COM port (e.g., COM3 at 115200 baud), and returns the response.
Important: The bridge does not have an HTTP server. All commands flow through the cloud WebSocket. You never call localhost:8080—that architecture does not exist.
Real-World Scenario 1: ESP32 + ILI9341 Displaying DHT22 Sensor Data via Serial
The Use Case
You have an ESP32 connected to a DHT22 temperature/humidity sensor and a 2.8-inch ILI9341 TFT. You want the AI to read the sensor every 30 seconds, display the values on the screen, and send you a Telegram alert if the temperature exceeds 35 °C.
Wiring Diagram
| ESP32 Pin | ILI9341 Pin |
|---|---|
| 3.3V | VCC |
| GND | GND |
| GPIO 18 | TFT_CLK |
| GPIO 19 | TFT_MISO |
| GPIO 23 | TFT_MOSI |
| GPIO 5 | TFT_CS |
| GPIO 2 | TFT_DC |
| GPIO 4 | TFT_RST |
| GPIO 15 | TFT_LED (backlight) |
DHT22 data pin → GPIO 27 (with 10 kΩ pull-up to 3.3V).
MicroPython Code for the ESP32
Save this as main.py on your ESP32:
import machine
import time
import dht
from ili9341 import ILI9341
from machine import Pin, SPI
# SPI setup for ILI9341
spi = SPI(2, baudrate=40000000, polarity=0, phase=0, sck=Pin(18), mosi=Pin(23), miso=Pin(19))
display = ILI9341(spi, cs=Pin(5), dc=Pin(2), rst=Pin(4))
display.fill(ILI9341.BLACK)
# DHT22 on GPIO 27
dht_sensor = dht.DHT22(Pin(27))
def show_temperature(temp, hum):
display.fill(ILI9341.BLACK)
display.text(f"Temp: {temp:.1f} C", 10, 60, ILI9341.WHITE)
display.text(f"Hum: {hum:.1f} %", 10, 90, ILI9341.WHITE)
display.text("ASI Biont", 10, 150, ILI9341.CYAN)
while True:
if uart.any():
cmd = uart.readline().decode().strip()
if cmd == "READ":
dht_sensor.measure()
temp = dht_sensor.temperature()
hum = dht_sensor.humidity()
show_temperature(temp, hum)
uart.write(f"{temp:.1f},{hum:.1f}\n")
elif cmd == "ALERT":
display.fill(ILI9341.RED)
display.text("ALERT!", 50, 100, ILI9341.WHITE)
time.sleep(0.1)
How the AI Connects
You tell the AI: "Connect to my ESP32 on COM3 at 115200 baud. Every 30 seconds send the READ command, parse the returned temperature and humidity, and display them on the ILI9341. If the temperature is above 35 °C, send an ALERT command to the display and notify me on Telegram."
The AI writes a Python script that runs in its sandbox (execute_python) and uses industrial_command to communicate with the bridge:
import time
from asi_biont_sdk import industrial_command
while True:
# Read sensor
response = industrial_command(
protocol='serial://',
command='serial_write_and_read',
data='524541440a', # "READ\n" in hex
port='COM3',
baud=115200
)
# response.data contains "25.3,60.1\n"
temp, hum = map(float, response.data.strip().split(','))
if temp > 35.0:
industrial_command(
protocol='serial://',
command='serial_write_and_read',
data='414c4552540a', # "ALERT\n"
port='COM3',
baud=115200
)
# Send Telegram alert via requests
requests.post(f"https://api.telegram.org/bot{TOKEN}/sendMessage",
json={"chat_id": CHAT_ID, "text": f"🔥 Temperature high: {temp} °C"})
time.sleep(30)
Note: This script runs with a 30-second sandbox timeout—the AI splits long-running tasks into multiple invocations or uses the bridge's built-in scheduler.
Real-World Scenario 2: Raspberry Pi + ST7789 Displaying MQTT Data
The Use Case
A Raspberry Pi Zero W is connected to a 1.3-inch ST7789 (240×240) display over SPI. The Pi subscribes to an MQTT topic (factory/machine1/temperature) and updates the display whenever a new value arrives. The AI configures everything via SSH.
Wiring
| Raspberry Pi Pin | ST7789 Pin |
|---|---|
| 3.3V (pin 1) | VCC |
| GND (pin 6) | GND |
| GPIO 10 (MOSI) | DIN |
| GPIO 11 (SCLK) | CLK |
| GPIO 8 (CE0) | CS |
| GPIO 25 | DC |
| GPIO 27 | RST |
| GPIO 18 | BL |
AI-Generated SSH Script
You say: "SSH into my Raspberry Pi at 192.168.1.100, install the ST7789 Python library, and write a script that subscribes to MQTT topic 'factory/machine1/temperature' and displays the value on the screen."
The AI uses execute_python with paramiko to push and run the script:
import paramiko
import time
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('192.168.1.100', username='pi', password='raspberry')
# Install dependencies
stdin, stdout, stderr = ssh.exec_command('pip install paho-mqtt st7789 spidev')
print(stdout.read().decode())
# Write script
script = '''
import paho.mqtt.client as mqtt
from ST7789 import ST7789
import spidev
display = ST7789(spi=spidev.SpiDev(0, 0), dc=25, rst=27, bl=18, rotation=90)
display.begin()
def on_message(client, userdata, msg):
temp = msg.payload.decode()
display.fill(0x0000)
display.text("Temperature", 20, 60, 0xFFFF)
display.text(f"{temp} C", 50, 100, 0xFFE0)
client = mqtt.Client()
client.on_message = on_message
client.connect("broker.hivemq.com", 1883)
client.subscribe("factory/machine1/temperature")
client.loop_forever()
'''
# Transfer script
with ssh.open_sftp() as sftp:
with sftp.open('/home/pi/display_mqtt.py', 'w') as f:
f.write(script)
# Run in background
ssh.exec_command('nohup python3 /home/pi/display_mqtt.py &')
Now the display updates live as MQTT messages arrive—no manual coding required.
Real-World Scenario 3: Arduino Uno + ILI9341 Controlled via HTTP API
The Use Case
An Arduino Uno with an Ethernet shield hosts a simple HTTP server. The ILI9341 displays a welcome screen. When the AI sends an HTTP POST to /update?text=Hello+ASI, the Arduino parses the request, clears the screen, and draws the new text.
Arduino Code
#include <SPI.h>
#include <Ethernet.h>
#include <Adafruit_ILI9341.h>
Adafruit_ILI9341 tft = Adafruit_ILI9341(10, 9, 8);
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
EthernetServer server(80);
void setup() {
tft.begin();
tft.fillScreen(ILI9341_BLACK);
tft.setTextColor(ILI9341_WHITE);
tft.setTextSize(3);
tft.println("ASI Biont");
Ethernet.begin(mac);
server.begin();
}
void loop() {
EthernetClient client = server.available();
if (client) {
String request = client.readStringUntil('\r');
if (request.indexOf("/update?text=") > 0) {
int start = request.indexOf("text=") + 5;
int end = request.indexOf(" HTTP");
String newText = request.substring(start, end);
newText.replace("+", " ");
tft.fillScreen(ILI9341_BLACK);
tft.setCursor(0, 0);
tft.println(newText);
}
client.println("HTTP/1.1 200 OK");
client.stop();
}
}
AI Integration
The AI connects to the Arduino via its HTTP API using industrial_command with the http:// protocol:
industrial_command(
protocol='http://',
command='get',
url='http://192.168.1.200/update?text=Hello+ASI',
timeout=5
)
Or, if the Arduino is behind NAT, the AI can use an MQTT relay: the Arduino subscribes to a topic, and the AI publishes to that topic.
Universal Connectivity: No Vendor Lock-In
One of the strongest features of ASI Biont is that it can talk to any device that communicates over serial, MQTT, HTTP, Modbus, or any of the supported protocols. You are not limited to a predefined list of supported displays. If your TFT LCD is connected to an ESP32, an Arduino, a Raspberry Pi, or even a PLC with a serial port, the AI can control it.
For example, you could:
- Connect an STM32 with an ST7789 over CAN bus
- Read a Modbus temperature register from a PLC and display it on an ILI9341
- Use a Raspberry Pi to drive a 7-inch HDMI TFT and stream live video with bounding boxes from a computer vision pipeline
The AI writes the glue code in seconds. You just describe the hardware.
Step-by-Step: Your First Integration
1. Download Hardware Bridge
Log into the ASI Biont dashboard (asibiont.com). Navigate to Devices → Create API Key. Download bridge.py. No GitHub repository—only the dashboard provides the file.
2. Run Bridge
pip install pyserial requests websockets
python bridge.py --token=YOUR_API_KEY --ports=COM3 --baud 115200
Replace COM3 with your actual port. The bridge connects to the ASI Biont cloud via WebSocket and waits for commands.
3. Chat with the AI
Open the chat interface and type:
"Connect to my ESP32 on COM3 at 115200 baud. Send the text 'Hello from AI' to the ILI9341 display using the command 'TEXT Hello from AI'."
The AI will:
1. Verify the connection by sending HELP (the HELP protocol expects a response listing supported commands).
2. Send the serial command TEXT Hello from AI\n (encoded as hex 544558542048656c6c6f2066726f6d2041490a).
3. Confirm the display updated.
Conclusion
Integrating a TFT LCD display with an AI agent is no longer a futuristic fantasy—it is a practical, everyday task that ASI Biont handles in seconds. Whether you are visualizing sensor telemetry on an ILI9341, building a live MQTT dashboard on an ST7789, or remotely updating an Arduino screen over HTTP, the process is the same: describe what you want, and the AI writes the code.
Stop writing boilerplate display drivers. Start focusing on what the data means. Go to asibiont.com today, download bridge.py, and connect your TFT LCD to the AI that understands it.
Comments