@wquguru: https://x.com/wquguru/status/2110601298488021452
Summary
An ESP32 primer sparked by the incident of a 97-yuan recording device (XIAO ESP32-S3 Sense) found in OpenAI's office, covering chip architecture in detail, the firmware flashing process, how to use AI to assist development, and five low-cost hands-on projects.
View Cached Full Text
Cached at: 10/15/26, 02:14 PM
Everyone Can Be a Microcontroller Engineer: A Complete Guide to ESP32
On September 30, during a routine security check, OpenAI’s safety team discovered a “sophisticated recording device” wrapped in toilet paper plugged into a USB port behind the TV in an executive conference room. In reality, it was a development board priced at just 97 RMB — a common sight in the maker community.
This article uses that very board to introduce the fundamentals of ESP32, and how — with the help of AI — you can build practical and fun devices with it.
WquGuru@wquguru·Oct 14Translated from ChineseShow originalESP32 has completely gone viral. During OpenAI’s internal security check, they shockingly discovered a hidden precision recording device, specifically the Seeed XIAO ESP32-S3 Sense model, priced at just 97 RMB 😅
This device features an ESP32-S3 chip, digital microphone,Show moreQuoteOpenAI Newsroom@OpenAINewsroom·Oct 14We discovered a sophisticated recording device that was hidden inside one of our offices. We used our models to understand the device and where it had come from, identifying that a specific employee had planted it a few days earlier. We referred the matter to the FBI, and we’re3475580113K
Complete Teardown: XIAO ESP32-S3 Sense
The XIAO ESP32-S3 Sense consists of two circuit boards stacked together, connected via board-to-board connectors. The top expansion board handles capture and storage, while the bottom main board handles computing, communication, and power.
Recording only uses three of these components: the microphone captures sound, the ESP32-S3 processes the data, and the SD card stores the files. When continuously recording and writing to the SD card, the board draws an average current of about 55 mA — more than enough to be powered by a TV’s USB port. Rearrange these same components slightly, and you can build a voice assistant or a photo-recognition camera, as covered in the projects below.
What’s Inside the ESP32-S3 Chip
The ESP32 is a microcontroller — a miniature computer that integrates a processor, memory, wireless communication, and various interfaces into a single chip, executing firmware flashed onto it as soon as it powers on.
The ESP32-S3’s internals can be broadly divided into four parts:
Compute Two 240 MHz processor cores, with performance roughly equivalent to a late-1990s home computer. The S3 also supports 128-bit vector instructions, which can accelerate small AI models like voice wake-word detection and face detection.
Memory The chip has 512 KB of built-in RAM, which is clearly insufficient for camera or voice applications — you’ll need a model with external PSRAM. The “R8” in the model name indicates 8 MB of PSRAM, and “N16” means 16 MB of Flash. When shopping online, a model labeled N16R8 has exactly this configuration.
Wireless Both the Wi-Fi and Bluetooth 5 radio circuits are integrated into the chip — all you need is an external antenna. Functions that once required a separate microcontroller plus a Wi-Fi module can now be done with a single chip.
Interfaces This is the biggest difference between a microcontroller and a phone SoC. The ESP32-S3 has 45 GPIO pins and can connect to a wide variety of peripherals using different communication protocols:
| Interface | Common Uses |
|---|---|
| I2C | Temperature/humidity, barometric pressure, accelerometer sensors; small OLED screens |
| SPI | Color displays, e-ink screens, SD cards |
| UART | GPS, fingerprint modules, other development boards |
| I2S | Digital microphones, amplifiers and speakers |
| ADC | Soil moisture, light sensors, potentiometers, and other analog signals |
| PWM | Dimming, servos, buzzers |
| RMT | WS2812 RGB LED strips, infrared remote control |
| Touch | Trigger actions with a touch instead of a physical button |
| USB OTG | Emulate a keyboard or network adapter, or act as a host to read USB flash drives |
| Camera / LCD | Parallel cameras, large color displays |
In addition, the ESP32 supports a GPIO matrix — most peripheral functions can be mapped to any pin. When the wiring doesn’t work out, it’s often just a one-line code change to reassign a pin, no resoldering needed.
From Code to Chip
Programs that run on the ESP32 are called firmware (written directly to the chip, to distinguish them from software). The journey from writing code to running it involves three steps: writing, compiling, and flashing.
There are five development approaches, ranging from one-click flashing of ready-made firmware in a web browser to using Espressif’s official ESP-IDF framework — the lower you go, the more flexibility you get. They’re not mutually exclusive: Arduino itself is built on top of ESP-IDF, and you can go deeper once you’re comfortable. For editors, VS Code with the PlatformIO plugin is recommended — each project maps to its own folder, which also makes it easy to hand off to AI later.
Flashing relies on two buttons on the board. When the chip powers up, the built-in bootloader checks the level on GPIO0: if it’s low, it enters download mode and waits for the computer to write new firmware; otherwise, it boots normally. The BOOT button’s job is to ground GPIO0. So when flashing fails, the common trick is to hold BOOT and then press RST.
Once the program is running, the same USB cable also handles serial communication — logs printed by the program appear in real time on your computer. In the next section on AI-assisted debugging, the serial log is the most important source of information.
Additionally, Flash can be partitioned into two program slots that alternate — this is OTA (over-the-air) updating. The device downloads new firmware over Wi-Fi, writes it to the idle partition, and reboots to switch. If the new firmware fails, it automatically rolls back to the old version. Devices installed inside walls or otherwise hard to access rely on this method for updates.
Writing Firmware with AI
In the past, when you ran into problems developing for a microcontroller, your only options were reading datasheets and browsing forums. Now you can simply hand the error message to an AI for analysis. If you use tools that can operate the terminal — like Claude Code or Cursor — the AI can compile, flash, and read serial logs on its own, iterating until the program runs correctly.
Here’s a template for your first prompt:
Hardware: ESP32-S3-DevKitC-1, N16R8 (with 8MB PSRAM).
Wiring: SHT40 SDA → GPIO8, SCL → GPIO9; 0.96" OLED shares the same I2C bus.
Toolchain: PlatformIO + Arduino framework (core 3.x).
Goal: Read temperature and humidity every 10 seconds, display on OLED, and send to my server over Wi-Fi.
Constraints: No blocking delay(); auto-reconnect Wi-Fi on disconnect;
store credentials in a separate secrets.h; print serial logs at key steps.
Start with just reading and serial-printing. Confirm the data is correct before adding the display.
The constraints in the template correspond to the six common error categories listed in the figure above. The hardest to detect is using outdated APIs: when Arduino-ESP32 upgraded from 2.x to 3.x, many interfaces changed, and since old-style code is more prevalent in AI training data, the AI may generate functions that no longer exist. So always specify the version number in your prompt.
When it comes to wiring, don’t rely entirely on AI. Code errors won’t damage hardware, but wiring errors can fry components. Always double-check power and ground against the pinout diagram yourself.
Practice Projects: Five You Can Finish in a Weekend
Your first project should ideally meet two criteria: minimal wiring, and it solves a real problem. The following five projects are listed in order of difficulty, with approximate prices based on Chinese e-commerce. More projects can be found in the project map below.
Soil Moisture Alert (Difficulty 1, ~¥30)
Push a watering reminder to your phone when the soil gets too dry.
- Materials: ESP32-C3 SuperMini board (under ¥20), capacitive soil moisture sensor. Avoid resistive sensors with two metal probes — they corrode within weeks in soil.
- Prompt: Use ESPHome and have the AI generate the YAML config: “Read soil moisture on GPIO3 of the C3 — 2.8V when dry, 1.2V when wet. Convert to percentage, report every 30 minutes, then enter deep sleep.”
- Common issues: You’ll need to measure the dry and wet voltage values yourself — each sensor varies. When the device is in deep sleep it can’t be reached remotely, so wake it via USB before changing the config.
Bluetooth Shortcut Box (Difficulty 1–2, ~¥50)
Map a few buttons to common actions like page-turning, muting in meetings, or submitting code.
- Materials: Any ESP32-S3 board, a few mechanical key switches or a rotary knob. The device is recognized by the computer as a Bluetooth keyboard — no drivers needed.
- Prompt: “Three buttons connected to GPIO4, 5, and 6. Use BLE HID to send the Right Arrow key, Cmd+Shift+M, and Cmd+Enter. Include button debouncing.”
- Common issues: If Bluetooth won’t connect after a config change, remove the old device on the computer first, then re-pair.
E-Ink Weather Calendar (Difficulty 2, ~¥250–350)
Mount a 7.5-inch e-ink display at your door showing the day’s weather, schedule, and a reminder before you head out.
- Materials: Low-power ESP32 board, e-ink display with matching driver board, high-capacity lithium battery.
- AI’s role: Besides writing code, you can have the device call a large language model once each morning: “Based on today’s weather and schedule, write a reminder in under 20 characters.”
- Common issues: E-ink displays come in multiple hardware revisions; selecting the wrong driver will corrupt the display. Before buying, have the AI confirm that the screen model is compatible with the driver library.
Photo-Recognition Camera (Difficulty 2–3, ~¥100)
This uses the XIAO ESP32-S3 Sense introduced at the beginning. Press a button to take a photo, send it to a vision LLM, and display or read aloud the recognition result. Great for identifying plants, translating menus, or helping parents read medicine labels.
- Materials: XIAO ESP32-S3 Sense, one button.
- Prompt: “When the button on GPIO1 is pressed, capture a JPEG photo, convert to base64, POST it to a vision model API, and output the returned text to serial. Enable PSRAM and handle HTTPS certificates properly.”
- Common issues: If camera initialization fails, first check whether PSRAM is enabled in the build options.
AI Voice Assistant (Difficulty 2–4, ~¥80–150)
Wake it with a wake word, then have a conversation with a large language model — or control the lights in your home. This is the most popular ESP32 application in China over the past two years, and the open-source project Xiaozhi has already adapted to over a hundred development boards.
- Materials: ESP32-S3 N16R8 board, INMP441 digital microphone, MAX98357A amplifier module and a small speaker; optionally a small display. If you don’t want to wire it up yourself, you can buy an already-adapted ready-made board.
- AI’s role: The wake word is recognized locally on the chip; audio is uploaded to the cloud, transcribed to text, sent to the LLM to generate a response, and then synthesized back into speech. The LLM can also call device functions via MCP — adjusting volume, controlling relays, and more.
- Getting started: First flash the ready-made firmware with one click in the browser, then pick a model and persona in the console. Once you’re comfortable, have AI help you modify the source code.
- Common issues: Leaving the INMP441’s L/R pin floating results in no audio being recorded — it must be grounded.
Bonus: Board Selection & Pinout
The ESP32 is a product family, not a single model. The model prefixes can be roughly distinguished as follows: S-series for full-featured, C-series for low cost and small size, H-series for smart home protocols, and P-series for displays and multimedia.
If you’re only buying one board, the ESP32-S3 N16R8 is the recommended choice. It has plenty of memory, a full set of interfaces, the most tutorials available, and can handle all five projects above. When purchasing, opt for a version with two USB-C ports: one goes through a USB-to-serial chip for flashing and log viewing, and the other connects directly to the chip’s native USB.
Once you get the board, familiarize yourself with the pinout. Red pins are already taken by PSRAM — don’t use them. Yellow pins are boot configuration, USB, and serial — confirm they won’t affect bootstrapping before use. The remaining green pins are safe to use; when connecting analog sensors, prefer GPIO1–10.
Finally, here are the five most common issues beginners encounter — when something goes wrong, check them in order:
-
Computer can’t detect the board In most cases it’s the cable. Many USB cables are charge-only and lack data lines. Next most common cause: CH340 or CP210x serial drivers not installed.
-
Random restarts during operation If the serial output shows “Brownout detector was triggered,” it means voltage is sagging when Wi-Fi transmits. This usually isn’t a code problem — try a shorter cable or a different USB port.
-
Connecting 5V signals The ESP32’s logic level is 3.3V; the pins can’t tolerate 5V. When connecting 5V modules, you need a level shifter.
-
Driving motors or relays directly from a pin A single pin can only source a few tens of millimeters of current — motors and relays need to be connected through a driver module.
-
Can’t connect to Wi-Fi Except for the C5, all ESP32 chips only support the 2.4 GHz band — they can’t connect if your router only has 5 GHz enabled. Combined dual-band routers can also cause unstable connections.
Closing Thoughts
Over a decade ago, getting a small device online required understanding circuits, writing C, and reading English datasheets — microcontrollers were the near-exclusive domain of electronics engineers. Today, an ESP32 development board costs just a few tens of yuan, and from writing code to debugging errors, an AI agent can lend a hand.
The possibilities are endless: monitor the moisture in your flower pot, the CO₂ levels in your living room, or simply hear you say “Hey, turn off the lights.”
Becoming a microcontroller engineer now requires nothing more than a development board and an idea.
Recommended Reading
-
Claude Subscription Plans for Regular People (Complete 0-to-1 Guide, Including Payment and Identity Verification)https://x.com/wquguru/status/2106041666922783181
-
Deploying Qwen-Image 2.1 Locally on macOS: Nearly 5x Speedup! How?https://x.com/wquguru/status/2109605714796970004
-
Illustrated Guide to KV Cache — The Winning Secret of DS V4.1-Flashhttps://x.com/wquguru/article/2099119760248389730
-
Illustrated Guide to ASR and TTS: HuggingFace Open-Source Model Evaluationhttps://x.com/wquguru/status/2096013016429211791
-
Illustrated Guide to Large Language Model Deploymenthttps://x.com/wquguru/status/2093634146082152683
-
Agent Memory Architecture Panorama: From Rule Files and Session Retrieval to Reflection and Skill Consolidationhttps://x.com/wquguru/status/2069641926752780384
-
Addicted: Pornography, Gambling, and Vibe Codinghttps://x.com/wquguru/status/2022173077329871138
If this tutorial helped you, please follow + bookmark + share 👏🏻
Continuously sharing beginner-friendly AI Agent tutorials and AI tool tips. Follow
@wquguru
Similar Articles
@xiangxiang103: https://x.com/xiangxiang103/status/2110948324543193560
With zero commands and zero model costs, the author used DSH (DeepSeek Harness) along with the free DeepSeek V4.1 Flash model to flash a ¥128 Lichuang ESP32-S3 dev board into a XiaoZhi AI speaker. The entire process — looking up the docs, verifying, and flashing the firmware — was handled automatically by the Agent.
@alin_zone: https://x.com/alin_zone/status/2112143993941442843
A beginner-friendly, step-by-step Chinese tutorial showing readers how to use Claude Code or Codex to flash the open-source xiaozhi-esp32 firmware onto an ESP32-S3 development board, then set it up via phone Wi-Fi configuration, bind it to a backend dashboard, authenticate with GitHub, and upgrade the language model for free — turning the board into a desktop AI voice assistant.
@hylarucoder: The new video really is a full-stack engineer: ESP32 hardware + frontend + backend + voice agent + editing + AI music composition. The AI era is too wild...
A tech video showcasing a full-stack project using ESP32 hardware, frontend, backend, voice agent, and AI music composition, reflecting the comprehensive development capabilities in the AI era.
@cgnot996: I've been wanting to write this post for a while now—ESP32 is just so damn charming. That night, I was scrolling throug…
作者分享购买 ESP32 桌面机器人并用 AI 辅助开发的体验,感慨如今只需连接 Type-C 就能让 AI 完成代码迭代,做各种有趣的智能小装置。
@grapeot: A complete machine vision project, from collecting image data from scratch, labeling, neural network training, quantization, building a system on a microcontroller (ESP32), firmware flashing and deployment. After deployment, the results turned out poor, so I retrained from scratch, then optimized performance and energy consumption, and finally deployed. If a senior scientist were to do it, it would take...
The author used GPT-5.6 to complete a garage door recognition project on ESP32-CAM within 10 hours, covering data collection, labeling, training, quantization, and deployment, demonstrating AI's autonomous capabilities in hardware development, and sharing insights on human-machine collaboration.