Reviving the CRT: How to Drive a VGA Monitor from an ESP32 DAC and Control It with the ASI Biont AI Agent

Introduction

You have an old VGA monitor gathering dust in the corner. Or maybe you are building a retro-style data dashboard for your workshop, and you want it to display real-time sensor values, AI-generated alerts, or even a simple animated gauge — without writing a single line of code for the graphics logic. That is exactly what this guide is about: connecting an ESP32 with a simple resistor-ladder DAC to a standard VGA monitor, and then handing over the control of that display to the ASI Biont AI agent. No web dashboard, no cloud portal, no bloated framework — just a chat conversation with an AI that writes the integration code for you.

By the end of this article, you will know:
- What hardware you need (ESP32, resistors, VGA connector)
- How to wire the DAC to generate VGA signals (yes, it works at 640×480@60Hz)
- How to flash a MicroPython firmware that turns the ESP32 into a VGA framebuffer
- How to connect that ESP32 to ASI Biont via MQTT, so the AI can push text, numbers, and even simple graphics to the screen
- Real-world use cases: temperature alerts, production counters, AI-generated motivational quotes on a retro monitor

Let us dive into the bits.

Why VGA + ESP32 + AI?

The ESP32 is a capable little chip, but its native video output is limited to parallel RGB (with external RAM) or composite video. VGA requires five signals: R, G, B (analog, 0–0.7 V), and two sync lines (HSYNC, VSYNC). The trick is to use two of the ESP32’s built-in DACs (Digital-to-Analog Converters) to generate the red and blue channels, while the green channel is derived from a third GPIO via a simple resistor voltage divider. The sync signals are generated by bit-banging the GPIOs in an interrupt routine.

Several open-source projects have proven this works — ESP32-VGA by bitluni and MicroVGA by robertc99 are two solid starting points. The maximum achievable resolution is 640×480 at 60 Hz with 8 colors (3 bits, one per channel). That is enough for a teletype-style terminal, a digital clock, or a minimalist status display.

Now, why bring ASI Biont into the picture? Because writing the logic to render sensor data, format text, handle scrolling, and respond to changing conditions is tedious. With ASI Biont, you just describe what you want to see on the screen, and the AI generates the MicroPython code, sends it to the ESP32 via MQTT, and even updates the display in real time based on chat commands. You get a live, AI-controlled display without touching the graphics pipeline.

Hardware Setup

Bill of Materials

Component Quantity Notes
ESP32 development board (ESP32-WROOM-32) 1 Any variant with 2 DAC pins (GPIO25, GPIO26)
VGA female connector (DB15) 1 Standard DE-15
Resistors: 1 kΩ, 470 Ω, 220 Ω 2 each For R-2R ladder on green channel
Resistor: 470 Ω 3 For current limiting on R, G, B lines
Breadboard and jumper wires 1 set
VGA monitor (or VGA-to-HDMI adapter) 1 Must accept 640×480@60Hz

Wiring Diagram

Connect the ESP32 to the VGA connector as follows:

ESP32 Pin VGA Pin Signal
GPIO25 (DAC1) Pin 1 Red (via 470 Ω resistor)
GPIO26 (DAC2) Pin 2 Green (via R-2R ladder: GPIO26 → 1 kΩ → 470 Ω → 220 Ω → GND, tap after 470 Ω to VGA)
GPIO27 Pin 3 Blue (via 470 Ω resistor)
GPIO32 Pin 13 HSYNC
GPIO33 Pin 14 VSYNC
GND Pins 5, 6, 7, 8, 10 Ground

Important: The VGA red, green, and blue lines are analog with 75 Ω input impedance. The 470 Ω resistors create a voltage divider that limits the DAC output (0–3.3 V) to approximately 0–0.7 V. The green channel uses a 3-bit R-2R ladder because the ESP32 has only two DACs; this gives 8 levels for green, while red and blue get 256 levels each (from the 8-bit DACs). In practice, you will use only a few colors, so the green resolution is sufficient.

Firmware: MicroPython with VGA Driver

Flash MicroPython (latest stable, e.g., v1.24.0) to your ESP32 using esptool.py. Then upload the following files:
- vga.py — the VGA framebuffer driver (adapted from bitluni’s C code or robertc99’s MicroPython port)
- main.py — the main script that initializes the display, connects to Wi-Fi, subscribes to MQTT, and listens for commands

A minimal main.py skeleton:

import network
import time
from umqtt.simple import MQTTClient
from machine import Pin, DAC
from vga import VGA

# Initialize VGA at 640x480, 8 colors
vga = VGA(640, 480)
vga.clear(0)  # black background
vga.print("ASI Biont ready", 10, 10, 7)  # white text

# Connect to Wi-Fi
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect("your_SSID", "your_password")
while not wlan.isconnected():
    time.sleep(0.5)

# MQTT callback
def mqtt_callback(topic, msg):
    # Parse command: e.g., b"TEXT:Hello World" or b"CLEAR"
    payload = msg.decode()
    if payload.startswith("TEXT:"):
        text = payload[5:]
        vga.clear(0)
        vga.print(text, 10, 10, 2)  # green
    elif payload == "CLEAR":
        vga.clear(0)
    elif payload.startswith("LINE:"):
        # LINE:x1,y1,x2,y2,color
        parts = payload[5:].split(',')
        x1,y1,x2,y2,color = map(int, parts)
        vga.line(x1,y1,x2,y2,color)

client = MQTTClient("esp32_vga", "broker.hivemq.com", port=1883)
client.set_callback(mqtt_callback)
client.connect()
client.subscribe(b"asi/vga/command")

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

This script runs a tight loop that polls MQTT messages. You can extend it to draw bar charts, scrolling text, or even a simple graph — all controlled by the AI.

Integration with ASI Biont: How the AI Takes Over

ASI Biont connects to your ESP32 through MQTT. You do not need any dashboard or “add device” wizard. Instead, you simply tell the AI in the chat:

“Connect to my ESP32 VGA display via MQTT. Broker: broker.hivemq.com, topic to publish: asi/vga/command. The display is 640x480, 8 colors. Show the current temperature read from the DHT22 sensor connected to GPIO14, update every 5 seconds.”

The AI will then write a Python script that runs in the ASI Biont sandbox (using execute_python). The script uses the paho-mqtt library to publish formatted commands to the ESP32. A simplified version looks like this:

import paho.mqtt.client as mqtt
import time
import random

broker = "broker.hivemq.com"
topic = "asi/vga/command"
client = mqtt.Client()
client.connect(broker, 1883, 60)

for _ in range(10):
    # Simulate temperature reading
    temp = 20 + random.uniform(-2, 2)
    text = f"TEMP:{temp:.1f}C"
    client.publish(topic, f"TEXT:{text}")
    time.sleep(5)

client.disconnect()

After executing this script, the ESP32 will display the temperature on the VGA monitor. The AI can also respond to your chat commands in real time — for example, you can type “change color to red” and the AI will publish a new command to repaint the text.

Real-World Use Cases

1. Workshop Production Counter

An ESP32 reads a limit switch on a conveyor belt. Every time a part passes, the counter increments. The AI subscribes to a topic where the ESP32 publishes the count, then formats it as TEXT:Count: 142 and publishes to the VGA command topic. The result: a live tally on a big retro screen visible across the shop floor.

2. AI-Generated Motivational Quotes

You ask the AI: “Every hour, display a random motivational quote from your knowledge base on the VGA screen.” The AI writes a script that uses a timer and publishes a new quote each hour. The ESP32 shows it in scrolling text.

3. Multi-Sensor Dashboard

With a DHT22 (temperature/humidity) and a BH1750 (light sensor) connected to the ESP32, the AI can create a script that reads sensor values via MQTT, formats them into a two-line display, and updates every 2 seconds. You can instruct the AI to highlight values in red if they exceed a threshold.

Why This Approach Wins

  • No coding required from you — the AI writes and executes the integration code.
  • No proprietary hardware — standard ESP32, standard VGA monitor, standard MQTT broker.
  • No dashboard to configure — everything happens through a natural language chat.
  • Extensible — you can add any sensor or actuator to the ESP32 and the AI will adapt the display logic.

Conclusion

Connecting a VGA monitor to an ESP32 via a few resistors is a satisfying hardware hack that breathes new life into old displays. But the real magic happens when you let an AI agent control that display. ASI Biont transforms your chat into a live, visual interface — no web server, no front-end code, just pure AI-driven automation.

Whether you want a retro terminal for your home lab, a production counter for your workshop, or a live AI-generated art piece, the combination of ESP32 VGA + ASI Biont is the fastest way to get there.

Try it yourself: Head over to asibiont.com, start a chat with the AI agent, and describe your VGA display project. Watch as the AI writes the code, connects to your hardware, and puts your data on screen — all in seconds.

← All posts

Comments