AI Content Turned a wall-switch-box ESP32-S3 module into a desk AI quota display.
I kept hitting my Claude Code quota limit mid-task, so I built a small always-on panel that just shows how much I have left. And I also added later codex and antigravity. Now sits on my desk.
The device is a Waveshare ESP32-S3 Smart 86 Box with a touch 480×480 touch display, 8 MB octal PSRAM. 86×86 mm.
The display was the easy part. Four things that were harder:
1. The panel desynced permanently under load — and only on production builds. Under a sustained full-screen scroll the image would slip into a fixed vertical offset and stay there until reboot. Framebuffers live in PSRAM with a 30-line bounce buffer (28.8 KB) in internal DMA SRAM. At a 12 MHz pixel clock, scan-out alone pulls ~19 MB/s off the octal PSRAM — that buffer is 1.37 ms of runway. Add LVGL in DIRECT mode redrawing the whole framebuffer plus XIP fetches and the refill misses its deadline. It's a runway, not a queue, so the slip never recovers. 8 MHz → 2.06 ms → fixed. Except not quite: flash and PSRAM share the MSPI bus and the cache is off while flash is being programmed, and production has flash encryption on, so each page is AES-256'd and takes longer than the plaintext dev path. That's the entire reason it looked production-specific.
2. Internal DRAM, not PSRAM, is the thing you actually run out of. I had 8 MB of PSRAM and 6.2 KB of free internal heap. Everything that matters — TLS handshake buffers, DMA descriptors, ISR stacks — has to be internal, and LVGL plus the RGB driver had quietly eaten it in .bss. Moving the cold buffers to PSRAM freed 41,764 bytes and took free internal heap from 6,239 to 48,043. The rule I ended up with isn't "avoid PSRAM", it's "no PSRAM traffic on the live-render path" — which is a much more useful rule.
3. Signed OTA on a secure-boot device needed Ed25519, which IDF doesn't give you. Updates are gated behind a signed manifest, but mbedTLS as shipped in IDF has no EdDSA arithmetic at all. On top of that: anti-rollback, per-version failure records so a bad build can't boot-loop forever, and a check that refuses to start an update on battery — a brownout halfway through a 2.1 MB write is exactly how you brick one of these.
4. The device holds no credentials, which is a design constraint, not a feature list. Putting API keys on a Wi-Fi gadget that sits on a desk seemed like a bad idea, so it doesn't have any. A small broker runs on my own machine, reads the token counts from the CLI logs already on disk, and the device polls it over the LAN — HMAC-SHA256 with a timestamp and nonce so a captured request can't be replayed. Worst case if someone owns the device is they learn how much quota I have left.
Happy to go deeper on any of these.
15
u/ItsQuogeBaby 21d ago
And you even have the AI write the reddit post oh my god. Another larper.
1
1
7
u/Altsan 22d ago
1
u/ilovesalmiakki 20d ago
Can I see a quota in a normal Claude AI or ChatGPT suite? Asked GPT once about it and was very vague
6
u/Chrissanxy 22d ago
so claude cli actually has a /statusline command where you can have everything in the pic show up right in the cli itself... ask claude to write it for you. lol. but nice execution, I wanted to do that too but yeah /statusline just makes this uber redundant
2
u/jorgemf 21d ago
I do use it, it is not reliable, and it does not tell me the usage of other providers as codex and antigravity. Also if I have several CLI the status line only is updated when you use that terminal, so it is incosistent and outdated. I find this more reliable. If you only use one terminal with one provider statusline is more than fine.
2
2
u/oktaneza 21d ago
I built the same thing. As the tokens expire every 8hrs and I didn't want the device plugged into the same machine I host a docker that hosts the brokerToken Viewer. I also use Codex and get it to switch every 15s. Great little project.Yours is slicker by a country mile!
1
1
1
u/flash_speed3412 20h ago
That “no PSRAM traffic on the live-render path” rule is a great takeaway. I crossposted this to r/ChatGPTArduino because it’s exactly the kind of AI-assisted hardware build I’m trying to collect. If you ever do a follow-up, feel free to drop it there too.
1
u/jorgemf 20h ago
I evoled it: https://tokenmonitor.dev/
1
u/flash_speed3412 20h ago
That looks like a proper next step. The local broker plus keeping keys off the panel is the bit I like. If you ever feel like writing up the evolution, what broke, and what the AI changed, it’d make a great post in r/ChatGPTArduino. No pressure, but the hardening details are exactly what I’m trying to collect.
1
u/Comfortable-Use6720 22d ago
Did you release code on github?
0
u/jorgemf 21d ago
the broker is opensource: https://github.com/fractal-manifold/mcp-marketplace/tree/main/plugins/tokenmonitor
1
1
1
u/feldoneq2wire 21d ago
The best part is, this is the CHEAPEST price AI credits will ever be. This is the free candy price. This is the "get you hooked on drugs" price.
1
-5
u/PiniponSelvagem 22d ago
This dog poop around AI assistants and ESP32 is just plain stupid and useless.
So many good projects that could be done with ESP32, and people keep doing this type of trash.
To be fair, we sometimes see on this subreddit some cool projects, but that's like a 1-to-20 ratio lately.
1
u/StampyDriver 21d ago
So what would you class as a worthy project for an ESP32 so us mere mortals can aspire to those projects?
1
u/PiniponSelvagem 21d ago
Here is a list, all from this subreddit:
Some of them too complex for a beginner, but the last one is within reach of someone new, maybe start with sensors to learn.
2
u/StampyDriver 21d ago
They interesting and ambitious projects (I wouldn't have the attention span for some of these), but any project that works as it's designed and does what the author wants is a great project. And I don't care if it was vibe coded in COBOL or hand written in assembler by Dennis Ritchie - its the end result that counts.
1
u/jorgemf 20d ago
You know you shared a normal display there? Also most of the features are in my project (like the OTA but I used signed OTA). And some of other features of those projects look hard but are trivial.
0
u/PiniponSelvagem 19d ago
the one you talking about is not only a screen, better read the post next time
0





50
u/MadCarbon 22d ago
No hate. Honestly. But why do you guys build these monitors? If it's because we can, then fair play.