@Muse - Directly powering an LED from an ESP32-S3 GPIO pin works for simple indicators, but it draws current directly from the microcontroller's internal power domain and provides limited voltage headroom for higher-voltage LEDs (blue, white, true green).
This improved design uses an external low-side N-channel MOSFET switch powered from the system $5\text{ V}$ rail (such as USB or `VIN`).
---
### Key Improvements & Design Features
1. **Zero GPIO Load Current:**
- The ESP32 pin #gpio only charges the gate of the logic-level MOSFET #Q1. Steady-state current drawn from the GPIO is essentially zero (leakage only, $\approx\text{pA}$).
- This preserves the ESP32's maximum cumulative current budget ($120\text{ mA}$) for RF bursts (Wi-Fi/Bluetooth).
2. **$5\text{ V}$ Rail Headroom:**
- Powering the LED load from #V5 ($5\text{ V}$) provides ample headroom ($5\text{ V} - V_F$) for any color LED (including white and blue at $3.2\text{ V}$).
- With a red LED ($V_F \approx 1.9\text{ V}$) and #R1 = $200\ \Omega$, the forward current is:
$$I_{\text{LED}} = \frac{5\text{ V} - V_F - V_{DS}}{R_1} \approx \frac{5.0\text{ V} - 1.9\text{ V} - 0.3\text{ V}}{200\ \Omega} \approx 14\text{ mA}$$
giving bright, stable illumination without loading the $3.3\text{ V}$ LDO.
3. **Protection & Deterministic Startup:**
- **Gate Resistor (#Rg = $100\ \Omega$):** Damps high-frequency ringing and limits gate charging current spikes during GPIO switching edges.
- **Pull-down Resistor (#Rpd = $100\text{ k}\Omega$):** Holds the MOSFET gate at $0\text{ V}$ during ESP32 boot, deep sleep, or reset when GPIO pins are floating (high-impedance), preventing unwanted flashes or glitches.
4. **PWM Dimming Ready:**
- Driven by a $1\text{ kHz}$ pulsing source #Vio, demonstrating clean switching transitions compatible with ESP32 LEDC PWM hardware dimming.