Claude forgets that my ESP32 isn't a full computer. Here are my 4 fixes

Claude forgets that my ESP32 isn't a full computer. Here are my 4 fixes

Published Sep 1, 2026, 5:30 PM EDT Nick Lewis is an editor at How-To Geek. He has been using computers for 20 years --- tinkering with everything from the UI to the Windows registry to device firmware. Before How-To Geek, he used Python and C++ as a freelance programmer. In college, Nick made extensive use of Fortran while pursuing a physics degree. Nick's love of tinkering with computers extends beyond work. He has been running video game servers from home for more than 10 years using Windows, Ubuntu, or Raspberry Pi OS. He also uses Proxmox to self-host a variety of services, including a Jellyfin Media Server, an Airsonic music server, a handful of game servers, NextCloud, and two Windows virtual machines. He enjoys DIY projects, especially if they involve technology. He regularly repairs and repurposes old computers and hardware for whatever new project is at hand. He has designed crossovers for homemade speakers all the way from the basic design to the PCB. Nick enjoys the outdoors. When he isn't working on a computer or DIY project, he is most likely to be found camping, backpacking, or canoeing. Most of the vibe coding projects I encounter are written in high-level languages like C, C++, or Python. However, Claude can also write decent MicroPython—you just need to be a little careful. Claude tends to write MicroPython like regular Python, which means the code it produces is often too memory-intensive for many microcontrollers, which only have a few hundred kilobytes of RAM. I've also found that it doesn't always account for the factors that matter when you're trying to build something with a microcontroller. A blinking LED is cool; a blinking LED that prevents you from pushing buttons is really aggravating. These are a few things I've found that guide Claude towards writing more useful MicroPython for ESP32 boards. Do two things at once without freezing Ditch time.sleep() so you can push buttons If you've ever written the basic blinking LED project, you probably used time.sleep(). Claude will usually use it when you vibe code it, and in most common tutorials you'll find use it too. It is fine if you're learning to write code for the first time, but a total pain otherwise. Sleep() tells the board to stop everything for a specified duration. If you push a different button in that time, it is totally ignored. It quickly becomes a problem in real-world projects. Instead, remind Claude that tick_ms() and ticks_diff() can handle a blinking LED without tying up your board. Asyncio is another good one to point Claude towards. Even if you don't specify those commands specifically, be sure to tell Claude that you need to be able to take an input at any time. One button push should only fire once Debouncing is essential Credit: Nick Lewis / How-To Geek When you write a simple script that reads a button press, you'll often find that one push actually registers as multiple hits. That isn't a software bug precisely, it occurs because metal contacts bounce slightly when they make contact, which registers as multiple presses. In order to fix that, Claude will often simply add a sleep after the first press to ensure subsequent presses don't register. However, that can also be a problem if you have multiple buttons you want to press. Make sure to tell Claude to account for debouncing without sleeping so that you don't get any weird pauses. Get reading from your ESP32 to your phone MQTT publishing that reconnects by itself Credit: Adam Davidson / How-To Geek Message Queuing Telemetry Transport (MQTT) is the best way to get information from an ESP32 board into something like Home Assistant. It is lightweight and is easy to deploy. However, I've found that Claude tends to ignore an important part: reconnecting. Some of my devices run for months without me touching them, and in that time, the router will restart, I'll have a power outage, or something else that interrupts the connection. Some simple scripts you get out of Claude (especially Opus 5, for some reason) don't have a reconnection provision, so once they go offline, they'll stay offline until you intervene. Make sure you prompt Claude to include a retry function that gets your device back online by itself so that you don't have to fiddle with the sensor you stuffed in your attic. Umqtt.robust is a good place to start. Change settings without re-flashing the board Config.json saves you the trouble of reflashing the board Credit: Tim Brookes / How-To Geek If you provide Claude with your Wi-Fi credentials, there is every chance it'll hard code them into whatever script it is writing for your ESP32 board. If the network name or password changes, you have to change the code and then re-flash the board. Absolutely no one wants to do that. Instead, tell Claude that you want your settings to be read from a file stored in the board's flash memory. Config.json is a popular option, but realistically any plain text format will work. The script loads the file when the board boots, which means you only need to tweak your config file if you want to update a password. It also means you can share your code on the internet without providing the world with your Wi-Fi password. Warning: Never hard-code important credentials into your code and then publish it. If you use a separate config file to store credentials, make sure you don't publish that either. This happens way too much with vibe-coded programs. Run for weeks on a battery Learn to use deep sleep well Credit: Tim Brookes / How-To Geek ESP32 projects often need to run for prolonged periods on a battery. If the ESP32 board stays on for the entire time, even a modestly sized battery will be dead in a few days. If you're planning on running your ESP32 project off of a battery, make sure you tell Claude how long you want it to run, what kind of battery you're using, and whether the battery will have any input power (like from a small PV cell). Claude can change how the firmware functions so that the board goes into a deeper sleep and only consumes a few microamps while idle, and only draws a significant amount of power when it briefly powers on to collect sensor data. Note: Some dev-boards have onboard LEDs and USB chips that draw a significant amount of power, which decreases how long a board can run. If you need to maximize your run time, get a bare board. Claude can write great MicroPython, it just needs to be reminded Claude is perfectly capable of writing MicroPython for an ESP32. It just tends not to do so right out of the gate. My experiments with it have consistently found that it seems to approach writing code for microcontrollers the same way that it does code for a regular Linux PC. That can cause problems. If you have a specific use in mind, make sure you include that information in your project or prompt. If you're building for a specific board or family of boards, provide that information to Claude. And, as always, remind it that you're working with a tiny amount of RAM—it may neglect that consideration otherwise.

Original Source

Read the full article at Howtogeek →

KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.