From ce4e313cf7a7b918c97f934e44f8a7cb64e82e0d Mon Sep 17 00:00:00 2001 From: tungnguyentu Date: Fri, 15 May 2026 02:00:27 +0700 Subject: [PATCH 1/2] docs: add ESP32 module circuit design tutorial MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Step-by-step schematic tutorial for the ESP32-WROOM-32 module covering LDO power supply, CH340C USB-to-UART bridge with auto-reset transistors, boot/reset buttons, and a status LED — all as runnable tscircuit JSX. Co-Authored-By: Claude Sonnet 4.6 --- docs/tutorials/esp32-module-circuit.mdx | 750 ++++++++++++++++++++++++ 1 file changed, 750 insertions(+) create mode 100644 docs/tutorials/esp32-module-circuit.mdx diff --git a/docs/tutorials/esp32-module-circuit.mdx b/docs/tutorials/esp32-module-circuit.mdx new file mode 100644 index 0000000..f1bdb23 --- /dev/null +++ b/docs/tutorials/esp32-module-circuit.mdx @@ -0,0 +1,750 @@ +--- +title: "ESP32 Module Circuit: Designing a Custom ESP32 Development Board" +description: Learn how to design a complete ESP32-WROOM-32 module circuit in tscircuit, including power supply, USB-to-UART programming interface, boot/reset buttons, and a status LED. +--- + +import TscircuitIframe from "@site/src/components/TscircuitIframe" + +The ESP32-WROOM-32 is one of the most popular Wi-Fi + Bluetooth modules for IoT projects. Unlike bare chips, it already contains the RF circuitry, antenna, and flash memory — so your schematic focuses on the support electronics: power, programming, and I/O. + +In this tutorial we'll build the schematic step by step using tscircuit: + +1. The ESP32-WROOM-32 module +2. AMS1117-3.3 LDO power supply +3. CH340C USB-to-UART programming circuit +4. Boot and Reset buttons +5. Status LED +6. Complete schematic + +## The ESP32-WROOM-32 at a Glance + +The WROOM-32 module exposes 38 castellated pads. The key groups are: + +- **Power**: 3V3, GND, EN (chip enable, active-high) +- **Strapping pins**: IO0 (boot mode select), IO2, IO12 +- **UART0**: TX0/RX0 for programming and serial debug +- **GPIO**: IO2 through IO39 for general use (some input-only) + +A commercial dev board (like the ESP32 DevKit) adds exactly the support circuitry we're about to build. + +## Step 1 — The ESP32-WROOM-32 Module + +We define the module as a `` with pins split left and right to match the physical pad layout. + + ( + + + + + + +) +`} /> + +:::tip Strapping Pins +IO0, IO2, and IO12 are sampled at reset to choose the boot mode. IO0 = LOW forces +bootloader mode (used for programming). IO0 = HIGH (pulled up) = normal boot. +::: + +## Step 2 — 5 V to 3.3 V Power Supply + +The ESP32 runs at 3.3 V. A USB connection supplies 5 V (VBUS). We use an +AMS1117-3.3 LDO regulator (SOT-223 package) to step down the voltage. + +The AMS1117-3.3 has a fixed 3.3 V output. Two bulk capacitors on the input and +output filter noise and ensure stability. + + ( + + {/* AMS1117-3.3 LDO — SOT-223 + pin1 = ADJ/GND, pin2 = OUTPUT, pin3 = INPUT, pin4 = OUTPUT (tab) */} + + + {/* Input bulk cap: 10 µF filters VBUS spikes */} + + {/* Input bypass cap: 100 nF high-frequency decoupling */} + + + {/* Output bulk cap: 10 µF stabilises LDO output */} + + {/* Output bypass cap */} + + + + + + + + + + + + + + + + +) +`} /> + +The AMS1117 can source up to 800 mA — enough for the ESP32 (peaks around 250 mA +during Wi-Fi transmit) plus peripherals. + +## Step 3 — USB-to-UART Programming Circuit + +To upload firmware from a PC we need a USB-to-UART bridge. The CH340C (SOP-16) +is the same chip found on most cheap Arduino clones and ESP32 dev boards. It +needs no external crystal because it uses an internal oscillator. + +We also add auto-reset circuitry so the Arduino IDE or `esptool` can reset the +ESP32 into bootloader mode without pressing buttons manually. Two NPN transistors +(Q1 and Q2) are controlled by the CH340C's RTS# and DTR# signals: + +- Q1 drives EN low to reset the chip +- Q2 drives IO0 low to enter bootloader mode + +The specific pulse sequence esptool sends on RTS/DTR triggers Q1 and Q2 in the +correct order. + + ( + + {/* CH340C USB-to-UART bridge + Real SOP-16 pinout (16 pins): + 1=GND 2=TXD 3=RXD 4=V3 5=UD+ 6=UD- 7=XI 8=XO + 9=CTS# 10=DSR# 11=RI# 12=DCD# 13=DTR# 14=RTS# 15=R232 16=VCC */} + + + {/* 100 nF decoupling on VCC */} + + {/* 100 nF on V3 (internal 3.3 V reference output) */} + .V3", pin2: "net.GND" }} + /> + + {/* Auto-reset NPN Q1 — controls EN (reset) */} + + + {/* Auto-reset NPN Q2 — controls IO0 (boot mode) */} + + + {/* Base resistors — limit base current from CH340C outputs */} + .RTS", pin2: ".Q1 > .base" }} + /> + .DTR", pin2: ".Q2 > .base" }} + /> + + {/* EN and IO0 pulled up to 3V3; collectors pull them low when transistors fire */} + + + + + + {/* USB D+ / D- connect to USB connector */} + + + + {/* UART crossover: CH340C TX → ESP32 RX, CH340C RX ← ESP32 TX */} + + + + + + + + + +) +`} /> + +:::note Auto-reset Explained +`esptool` toggles RTS low → Q1 pulls EN low (resets ESP32). Then DTR goes low → Q2 pulls IO0 low (selects bootloader). Then RTS returns high → EN rises (ESP32 starts in bootloader). This all happens automatically in under a second. +::: + +## Step 4 — Boot and Reset Buttons + +Even with auto-reset, manual buttons are useful for debugging. Two momentary +switches connect key strapping pins to GND: + +- **RESET (SW1)**: momentarily pulls EN low, resetting the module. +- **BOOT (SW2)**: momentarily pulls IO0 low while pressing RESET forces bootloader mode. + +Pull-up resistors keep EN and IO0 high during normal operation. + + ( + + {/* EN pull-up — keeps EN high (module running) */} + + + + + {/* IO0 pull-up — keeps IO0 high (normal boot) */} + + + + + {/* RESET button */} + + + + + {/* BOOT button */} + + + + +) +`} /> + +:::tip Bootloader Entry Without Auto-Reset +Hold **BOOT** (IO0 = LOW), press and release **RESET** (EN pulse), then release +**BOOT**. The ESP32 starts in download mode. +::: + +## Step 5 — Status LED + +A blue LED on IO2 gives visual feedback. IO2 is also a strapping pin: it must be +HIGH at boot for normal operation — so we use it as an output-only LED. The +1 kΩ resistor limits current to ~3 mA which is easy on the GPIO driver. + + ( + + {/* 1 kΩ current-limiting resistor for LED */} + .pos" }} + /> + + + {/* Blue status LED */} + .pin2", neg: "net.GND" }} + /> + + +) +`} /> + +For a 5 mm blue LED (Vf ≈ 3.2 V) at 3.3 V the forward voltage exceeds the +supply — so on a 3.3 V rail only the bottom segment of the LED glows faintly. +In practice, a low-current 0402 LED rated for 1–2 mA is a better fit. + +## Complete Schematic + +All five sections assembled into a single board. The ESP32 module occupies the +centre; the LDO and USB bridge are to the left, buttons and LED to the right. + + ( + + + {/* ── ESP32-WROOM-32 Module ───────────────────────────────────────── */} + + + + + + + + + + + {/* ── AMS1117-3.3 LDO Power Supply ───────────────────────────────── */} + + + + + + + + + + + + + + + + + + + + {/* ── CH340C USB-to-UART Bridge ───────────────────────────────────── */} + + + + + + + + + + .V3", pin2: "net.GND" }} + /> + + + + + {/* Auto-reset transistors */} + + + .RTS", pin2: ".Q1 > .base" }} + /> + .DTR", pin2: ".Q2 > .base" }} + /> + + + + + + {/* ── Boot & Reset Buttons ────────────────────────────────────────── */} + + + + + + + + + + + + + + + + + {/* ── Status LED ──────────────────────────────────────────────────── */} + .pos" }} + /> + + + .pin2", neg: "net.GND" }} + /> + + + +) +`} /> + +## Key Takeaways + +| Section | Purpose | Key Components | +|---------|---------|----------------| +| ESP32 module | Wi-Fi + BT SoC with flash and antenna | U1 (ESP32-WROOM-32) | +| LDO power | 5 V → 3.3 V regulation | U2 (AMS1117-3.3), C1–C4 | +| USB-UART bridge | Firmware upload via USB | U3 (CH340C), C5–C6 | +| Auto-reset | Hands-free bootloader entry | Q1, Q2, R1, R2 | +| Buttons | Manual boot / reset override | SW1 (RESET), SW2 (BOOT), R3, R4 | +| Status LED | IO2 activity indicator | LED1, R5 | + +## Going Further + +- **Wi-Fi antenna clearance**: If you move the ESP32 module to a custom PCB, + keep a copper-free keepout zone under the on-board PCB antenna (marked on the + module datasheet). +- **Deep sleep current**: Add a 10 µF bulk capacitor close to the module's + 3V3 pin to absorb the current spike when waking from deep sleep (~50 µA → ~250 mA + in microseconds). +- **JTAG debugging**: IO12, IO13, IO14, IO15 form the JTAG interface for + hardware-level debugging with OpenOCD. +- **USB-C connector**: Connect USB_DP/USB_DM to a USB-C connector with the + two CC pins each pulled to GND through 5.1 kΩ resistors — this identifies + the device as a USB 2.0 peripheral to the host. + +The ESP32-WROOM-32 datasheet and reference design are available on the +[Espressif documentation portal](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/hw-reference/). From 45e46128e2ce0c7f449340bba1a985221d1bfcb7 Mon Sep 17 00:00:00 2001 From: tungnguyentu Date: Fri, 15 May 2026 23:17:54 +0700 Subject: [PATCH 2/2] docs: add components BOM table and cost estimate Co-Authored-By: Claude Sonnet 4.6 --- docs/tutorials/esp32-module-circuit.mdx | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/tutorials/esp32-module-circuit.mdx b/docs/tutorials/esp32-module-circuit.mdx index f1bdb23..26a7809 100644 --- a/docs/tutorials/esp32-module-circuit.mdx +++ b/docs/tutorials/esp32-module-circuit.mdx @@ -16,6 +16,42 @@ In this tutorial we'll build the schematic step by step using tscircuit: 5. Status LED 6. Complete schematic +## Components + +| Ref | Part | Value / Part # | Footprint | +|-----|------|----------------|-----------| +| U1 | ESP32-WROOM-32 | Wi-Fi + BT module | Stamp receiver 18 mm | +| U2 | AMS1117-3.3 | 3.3 V LDO regulator | SOT-223 | +| U3 | CH340C | USB-to-UART bridge | SOP-16 | +| J1 | USB-C receptacle | 5 V power + programming | SMD USB-C | +| Q1, Q2 | MMBT3904 | NPN auto-reset transistors | SOT-23 | +| SW1 | Pushbutton | RESET (EN) | THT tactile | +| SW2 | Pushbutton | BOOT (IO0) | THT tactile | +| R1, R2 | Resistor | 10 kΩ (auto-reset base) | 0402 | +| R3, R4 | Resistor | 10 kΩ (EN / IO0 pull-up) | 0402 | +| R5 | Resistor | 470 Ω (LED current limit) | 0402 | +| C1–C4 | Capacitor | 10 µF / 100 nF (power decoupling) | 0805 / 0402 | +| C5, C6 | Capacitor | 100 nF (CH340C bypass) | 0402 | +| LED1 | LED | Green (IO2 status) | 0402 | + +## Cost Estimate + +| Component | Unit Cost | Qty | Total | +|-----------|-----------|-----|-------| +| ESP32-WROOM-32 | $2.20 | 1 | $2.20 | +| AMS1117-3.3 (SOT-223) | $0.10 | 1 | $0.10 | +| CH340C (SOP-16) | $0.25 | 1 | $0.25 | +| USB-C receptacle | $0.15 | 1 | $0.15 | +| MMBT3904 (SOT-23) | $0.03 | 2 | $0.06 | +| Tactile pushbuttons | $0.05 | 2 | $0.10 | +| Resistors 0402 (×5) | $0.01 | 5 | $0.05 | +| Capacitors 0402/0805 (×6) | $0.03 | 6 | $0.18 | +| Green LED 0402 | $0.03 | 1 | $0.03 | +| PCB (2-layer, 5 pcs) | $0.50 | 1 | $0.50 | +| **Total** | | | **~$3.62** | + +*Prices based on LCSC/JLCPCB quantities of 10.* + ## The ESP32-WROOM-32 at a Glance The WROOM-32 module exposes 38 castellated pads. The key groups are: