MCU Interfaces

ESP32 Auto-Reset & Boot Flashing Circuit

Dual-transistor auto-download circuit driving ESP32 EN and IO0 boot strapping pins via USB-to-UART DTR and RTS lines.

Operating Logic Level
3.3 V (VDD33 on the DevKitC V4)
Components
8
Formulas
3
Gotchas
4
Open in Web CAD
Verified source

Schematic workbench

ESP32 Auto-Reset and Boot CircuitExported from CircuitBaseR110kΩR210kΩQ12N3904Q22N3904R310kΩC11µFSW2ENSW1BOOTDTRRTS+3.3VGNDGNDENGNDIO0

Circuit overview

Operating Logic Level
3.3 V (VDD33 on the DevKitC V4)
Components
8
Formulas
3
Gotchas
4

Click any component in the schematic above to inspect its electrical ratings, function, and connections.

Circuit overview

This is the "auto program" block of the Espressif ESP32-DevKitC V4 schematic, redrawn with its EN delay network and the BOOT and EN buttons. The ESP32 starts its serial bootloader when IO0 is low at the moment it comes out of reset. A USB-to-UART bridge such as the CP2102N on the DevKitC or a CH340G has two spare modem control outputs, DTR and RTS, and flashing tools toggle them to drive EN and IO0. The two NPN transistors are cross-coupled so that each one conducts only when its two control lines differ: when DTR and RTS are both high or both low nothing happens, so a terminal program that sets both lines together does not reset the chip. The reference board uses SS8050 transistors; the general-purpose 2N3904 drawn here does the same job at these currents. The EN pull-up and capacitor follow the 10 kΩ and 1 µF that Espressif recommends; the DevKitC V4 fits 0.1 µF. GPIO0 has an internal weak pull-up, so the circuit needs no resistor on IO0.

Key Technical Specifications

Operating Logic Level3.3 V (VDD33 on the DevKitC V4)
Control Truth Table (pin levels)DTR 1, RTS 0 → EN 0; DTR 0, RTS 1 → IO0 0; equal levels → EN 1, IO0 1 (DevKitC V4 schematic)
Reset ConditionCHIP_PU below 0.6 V for at least 50 µs (Espressif Hardware Design Guidelines)
EN Delay Network10 kΩ and 1 µF recommended by Espressif, τ = 10 ms (calculated); DevKitC V4 fits 0.1 µF
Bootloader ConditionIO0 low at reset release; GPIO2 low or unconnected (esptool documentation)
TransistorsSS8050 on the DevKitC V4; 2N3904 drawn here
Base Current≈ 0.26 mA per transistor with 10 kΩ base resistors (calculated, VBE ≈ 0.7 V assumed)

Theory of Operation & Working Principle

01

DTR and RTS from the USB-to-UART bridge

DTR and RTS are active-low outputs: when the software asserts a line, the pin goes to 0 V; when it releases the line, the pin returns to 3.3 V. Everything below is described in pin levels, as in the truth table printed on the DevKitC V4 schematic.

02

Cross-coupled transistors

Q1 has its base on DTR through R1 and its emitter on RTS; its collector pulls EN. Q2 is the mirror image: base on RTS through R2, emitter on DTR, collector on IO0. A transistor conducts only when its base side is high and its emitter side is low:

DTR = 1, RTS = 1: both transistors off, EN = 1, IO0 = 1.

DTR = 0, RTS = 0: both transistors off, EN = 1, IO0 = 1.

DTR = 1, RTS = 0: Q1 on, EN = 0 (chip in reset), IO0 = 1.

DTR = 0, RTS = 1: Q2 on, EN = 1, IO0 = 0.

Because equal levels switch nothing, opening a port that asserts both lines together does not reset the chip. When a transistor is off with its emitter high and its base low, its base-emitter junction is reverse-biased by 3.3 V, well inside the 6 V minimum V(BR)EBO of the 2N3904.

03

Reset

esptool first sets DTR = 1, RTS = 0. Q1 saturates, pulls EN to ground and discharges C1. The ESP32 resets when CHIP_PU stays below 0.6 V for at least 50 µs; esptool holds this state for 100 ms. With R1 = 10 kΩ the base current of Q1 is about:

FORMULA & CALCULATION
IB = (VDTR - VBE) / (R1) ≈ (3.3 V - 0.7 V) / (10 kΩ) = 0.26 mA

which saturates the transistor against the 0.33 mA that R3 supplies.

04

Release with IO0 held low

esptool then sets DTR = 0 and RTS = 1 in two back-to-back calls. Between them both lines are briefly low and both transistors off; C1 slows the rise of EN across that gap, so the chip is still held in reset when Q2 turns on and pulls IO0 low. EN then rises through R3 into C1:

FORMULA & CALCULATION
\tau = R3 × C1 = 10 kΩ × 1\,µF = 10 ms

The chip samples its strapping pins as it comes out of reset. Finding IO0 low, it starts the serial bootloader instead of the program in flash. GPIO2 must also be low or unconnected for the bootloader to start.

05

Back to idle

After 50 ms esptool releases DTR, so both lines are high, both transistors are off and IO0 returns high through its internal pull-up. The bootloader keeps running and the upload continues over TXD0 and RXD0. To run the new firmware, esptool pulses RTS alone (DTR = 1, RTS = 0) for a plain hardware reset with IO0 high.

Design Equations & Calculations

EN Delay Time Constant

τ = R3 · C1

Time constant of the rise of EN after Q1 or SW2 releases it.

SymbolParameterTypical value
R3EN pull-up resistor10kΩ
C1EN delay capacitor1µF
τTime constant (calculated)10ms

EN Voltage During Release

VEN(t) = VDD(1 − e − t/τ)

EN reaches 63% of the supply after one time constant and about 99% after five (50 ms with the values drawn).

SymbolParameterTypical value
VDDSupply voltage3.3V
τTime constant10ms

Transistor Base Current

IB = VDD − VBER1

Base current of the conducting transistor when its control line is high and the other is low.

SymbolParameterTypical value
VDDControl line high level3.3V
VBEBase-emitter voltage (assumed)0.7V
R1Base resistor10kΩ
IBBase current (calculated)0.26mA

Bill of Materials (BOM)

Every part needed to build this circuit. Select a reference designator to inspect it on the schematic.

RefDesComponentValue / ratingPackageRole in circuitReference
NPN Small-Signal Transistor

SS8050-G on the DevKitC V4. Any small NPN switch works at these currents.

2N3904TO-92Pulls EN lowNPN Small-Signal Transistor pinout & datasheet
NPN Small-Signal Transistor

SS8050-G on the DevKitC V4.

2N3904TO-92Pulls IO0 lowNPN Small-Signal Transistor pinout & datasheet
Resistor

R21 on the DevKitC V4.

10kΩ0603 / 0805 / axialQ1 base resistor—
Resistor

R22 on the DevKitC V4.

10kΩ0603 / 0805 / axialQ2 base resistor—
Resistor

R11 on the DevKitC V4.

10kΩ0603 / 0805 / axialEN pull-up—
Ceramic Capacitor

Espressif-recommended value. The DevKitC V4 fits 0.1 µF (C9), plus 0.1 µF across the EN button (C14).

1µF0603 / 0805EN delay—
Tactile Switch

The DevKitC V4 adds 0.1 µF across it (C15).

BOOTSMD / THTManual IO0 low—
Tactile SwitchENSMD / THTManual reset—

Practical Applications & Target Domains

USB-to-UART programming on ESP32 development boards
Custom ESP32 boards that should flash from Arduino IDE, PlatformIO or ESP-IDF without buttons
USB-to-serial programming adapters for ESP32 modules
Test fixtures that reflash boards automatically

Critical Design Traps & Engineering Gotchas

Traps found in real builds, with the fix for each.

Critical

Too Little Capacitance on EN

Without a capacitor from EN to GND, or with a very small one, automatic reset is unreliable and esptool may fail to connect to the chip, most often on Windows.

Mitigation

Fit 1 µF to 10 µF from EN to GND, as the esptool documentation recommends; 1 µF with 10 kΩ matches the Espressif hardware design guidelines.

Warning

Serial Monitor Resets or Holds the Board

Some terminal programs and drivers set RTS or DTR on their own when they open the port, and RTS/CTS hardware flow control drives RTS. Depending on the levels the board resets, or stays in reset or in the bootloader. On Linux an idle port may assert RTS by default.

Mitigation

Disable RTS/CTS hardware flow control in the terminal program. On Linux, clear HUPCL on the port (stty -F /dev/ttyUSB0 -hupcl) as the esptool documentation describes.

Warning

Load on GPIO2 Blocks the Bootloader

The ESP32 enters the serial bootloader only when GPIO2 is low or unconnected as well as IO0 low. A pull-up or another circuit holding GPIO2 high keeps the auto-reset from working even though the transistors switch correctly.

Mitigation

Leave GPIO2 unconnected or make sure it is low at reset; do not put a pull-up on it.

Note

Large Capacitor on IO0

A large capacitor on IO0 keeps the pin low for a while after power-up, and the chip may start the bootloader instead of its program.

Mitigation

Do not add high-value capacitors to IO0, as the Espressif hardware design guidelines warn; the internal weak pull-up is the only pull-up this circuit relies on.

Primary sources

Help keep this page accurate

Built, simulated or reviewed this circuit? Confirm it, or report a part, value or connection that is wrong.

Opens a public form on GitHub with this page already filled in; a free GitHub account is needed. How reports and confirmations work

HTML snippet

<iframe src="https://circuitbase.tech/embed/schematic/esp32-auto-reset-flashing-circuit?theme=paper" width="100%" height="500" frameborder="0" loading="lazy" style="border: 1px solid #e5e7eb; border-radius: 6px; max-width: 100%;" title="ESP32 Auto-Reset and Boot Circuit (DTR/RTS) — CircuitBase Interactive Schematic"></iframe>