---
title: "My Grok Chat Lives on a Cheap Yellow Display | Carlos Lastres"
description: "A 2.8 inch ESP32 board on my desk shows my Grok Bot chat as it streams, and Kenko reacts to every reply. How to flash it, put it on Wi-Fi, open Grok Bot in debug mode and run the s"
url: https://lastres.ai/blog/grok-chat-esp32-yellow-display/
lang: en
---

Carlos Lastres 20 November 20261,481 words

# My Grok Chat Lives on a Cheap Yellow Display

In the reel, a little yellow board on my desk shows my Grok chat as it happens. The reply appears on the board while Grok is still writing it, Kenko moves along with it, and when the answer is done she giggles. Five quiet minutes later the screen goes dark.

It looks like a gadget that talks to an AI. What it really does is much simpler: it shows text that is already on my Mac. Here is the long version, in the same four steps as the video, with code you can start from. At the end you will have a board that mirrors whatever chat is open in the Grok Bot app on your Mac, with no API key involved.

![The Cheap Yellow Display on my desk: Kenko's portrait on the left and a Grok Bot reply in white text on a blue background on the right](https://lastres.ai/blog/grok-chat-esp32-yellow-display/kenko-on-the-board.jpg)

## The board

The board is the ESP32-2432S028R, which everyone calls the Cheap Yellow Display. It has an ESP32 with Wi-Fi, a 2.8 inch 320 by 240 screen with resistive touch, a microSD slot and a USB port, all on one yellow circuit board. The [community repo for the CYD](https://github.com/witnessmenow/ESP32-Cheap-Yellow-Display) is the best manual it has.

Check the revision before you buy. The original uses an ILI9341 screen driver, and the version with two USB ports uses an ST7789 that needs inverted colors, according to [atomic14's board notes](https://www.atomic14.com/esp32/boards/esp32-2432s028r/). If your screen stays black or the colors look wrong, you have a different panel, and the community repo has a guide to work out which one.

## Step 1. Flash the firmware

Plug the board into the Mac with USB. I used PlatformIO, either as the VS Code extension or from the terminal with `brew install platformio`. The board talks through a CH340 USB chip. If no new serial port shows up, install the CH340 driver, as the community setup guide notes.

The project needs two libraries: TFT\_eSPI for the screen and WiFiManager for the setup hotspot. The pin numbers below come from the community repo's display config:

```
[env:cyd]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
  bodmer/TFT_eSPI
  tzapu/WiFiManager
build_flags =
  -DUSER_SETUP_LOADED=1 -DILI9341_2_DRIVER=1
  -DTFT_WIDTH=240 -DTFT_HEIGHT=320
  -DTFT_MISO=12 -DTFT_MOSI=13 -DTFT_SCLK=14
  -DTFT_CS=15 -DTFT_DC=2 -DTFT_RST=-1
  -DTFT_BL=21 -DTFT_BACKLIGHT_ON=HIGH
  -DUSE_HSPI_PORT=1 -DLOAD_GLCD=1 -DLOAD_FONT2=1 -DLOAD_FONT4=1
```

Then `pio run -t upload` builds it and flashes it. If the upload fails partway, lower the upload speed; the setup guide suggests 115200.

## Step 2. Connect it to Wi-Fi

The first time it boots, the board has no network saved, so it creates its own hotspot and shows the password on its screen. You join that hotspot from your phone, a setup page opens, and you pick your home Wi-Fi. The board remembers it and goes straight to it on every boot after that. The ESP32 only speaks 2.4 GHz, so pick that network if your router has two.

[WiFiManager](https://github.com/tzapu/WiFiManager) does all of that in one call. I make a new password on every boot, so nothing is printed on the case or saved in the code:

```
char pass[9];
snprintf(pass, sizeof(pass), "%08lu", (unsigned long)(esp_random() % 100000000UL));
WiFiManager wm;
wm.setAPCallback([&](WiFiManager *m) {
  tft.drawString("Join " + m->getConfigPortalSSID(), 10, 20, 4);
  tft.drawString(String("Password ") + pass, 10, 60, 4);
});
wm.autoConnect("CYD-Setup", pass);
```

Once it is online, the board shows its IP address and waits. It runs a tiny web server with one door, and that is the only thing the Mac ever talks to:

```
server.on("/msg", HTTP_POST, [] {
  lastText = server.arg("text");
  state = server.arg("state");   // talking or done
  lastMessage = millis();
  digitalWrite(TFT_BL, HIGH);    // wake the screen
  drawChat();
  server.send(200, "text/plain", "ok");
});
```

## Step 3. Open Grok Bot in debug mode

The [Grok Bot](https://x.ai/bot) desktop app is built with Electron, which means it is a Chromium window underneath. Electron apps accept Chromium's [remote debugging switch](https://www.electronjs.org/docs/latest/api/command-line-switches), the same one web developers use to inspect a page. Quit the app, then open it from the terminal with the switch:

```
open -a "Grok Bot" --args --remote-debugging-port=9222
```

Check that it worked with `curl http://127.0.0.1:9222/json/list`. You should see the app's window listed as a page. The port only listens on 127.0.0.1, your own Mac, so nothing else on your network can reach it.

The same port has a cost. Any program running on your Mac can use it to read and click anything in the app while it is open. Open it this way when you want the board, and normally the rest of the time.

Now find where the messages live. In Chrome, go to `chrome://inspect` and inspect the Grok Bot page. If it does not show up, add `localhost:9222` under Configure. Right click a reply, choose Inspect, and look for a class or attribute that every message bubble shares. That selector is the only thing the script needs to know about the app.

## Step 4. A small script sends the chat over

The script runs on the Mac. Every half second it asks the app for the text of the last message, and sends it to the board when it changes. If the text is still growing, Grok is writing, so the state is talking. If it has not changed for two seconds, the reply is done. It needs Node 22 or newer and no packages:

```
const BOARD = process.env.BOARD;        // the address the board shows
const SELECTOR = process.env.SELECTOR;  // what every message bubble shares
const list = await (await fetch("http://127.0.0.1:9222/json/list")).json();
const ws = new WebSocket(list.find(t => t.type === "page").webSocketDebuggerUrl);
await new Promise(r => ws.addEventListener("open", r, { once: true }));

let id = 0;
const read = () => new Promise(resolve => {
  const me = ++id;
  ws.addEventListener("message", function on(e) {
    const m = JSON.parse(e.data);
    if (m.id !== me) return;
    ws.removeEventListener("message", on);
    resolve(m.result?.result?.value ?? "");
  });
  ws.send(JSON.stringify({ id: me, method: "Runtime.evaluate", params: {
    expression: `[...document.querySelectorAll(${JSON.stringify(SELECTOR)})].at(-1)?.innerText`,
    returnByValue: true } }));
});

let last = "", changedAt = Date.now(), sent = "";
setInterval(async () => {
  const text = await read();
  if (text !== last) { last = text; changedAt = Date.now(); }
  const state = Date.now() > changedAt + 2000 ? "done" : "talking";
  if (!text || state + text === sent) return;
  sent = state + text;
  fetch(`${BOARD}/msg`, { method: "POST", body: new URLSearchParams({ text, state }) })
    .catch(() => {});
}, 500);
```

Save it as `bridge.mjs` and run it with the board's address and your selector:

```
BOARD=http://192.168.1.50 SELECTOR='[data-message]' node bridge.mjs
```

You can try it before touching the app. Start Chrome with the same switch and a spare profile, open any page where text changes, and point the selector at it. The board should get the text a few words at a time, marked talking, and one last message marked done two seconds after it stops.

## Meet Kenko

Kenko is a character from my manga, and on the board she is just a few images. Let the firmware pick one by the state the script sends: a talking loop while the text grows, a giggle when it switches to done, then a resting face. Use your own character here. TFT\_eSPI can push small images stored in the firmware, and that is all a character needs.

Sleep takes a few lines in the loop. If five minutes pass with no new message, the firmware turns the backlight off on GPIO 21. The next message turns it back on.

I almost missed the fonts. The built-in ones only cover plain ASCII, so accents and Japanese come out as boxes. TFT\_eSPI supports [smooth fonts in its vlw format](https://github.com/Bodmer/TFT_eSPI) with any Unicode character you include, so convert a font once and replies in any language read properly.

## Why it costs nothing extra

There is no API call anywhere in this. The script reads text that the app has already put on my screen, so there are no tokens to pay for and no key to keep safe. It only mirrors the app I already pay for.

## The catch

When Grok Bot updates itself, it restarts without the switch, and the board stops getting messages. I quit it and run the open command again.

The bigger catch is the selector. The app's markup is not a public interface, and any update can rename the classes. When the board goes quiet after an update and the port still answers, that is the first place to look.

Grok Bot is a paid service with its own rules, and [xAI's consumer terms](https://x.ai/legal/terms-of-service) forbid scraping or reselling what goes in and comes out of Grok. I read this setup as staying on the right side of that: it is my own account, on my own Mac, showing my own chat on my desk, with nothing stored or sent anywhere else. Keep yours the same way, and do not use the port to send messages or run the app for you. If you would rather not depend on an app at all, the board does not care where the text comes from. Point the script at Grok in a browser instead, and note that Chrome now needs a separate profile with `--user-data-dir` for the debug port to work, as [Chrome's own post](https://developer.chrome.com/blog/remote-debugging-port) explains.

[← All posts](https://lastres.ai/blog/)

---

Source: https://lastres.ai/blog/grok-chat-esp32-yellow-display/
Site index for agents: https://lastres.ai/llms.txt
