ESP-12F Pin Overview
The ESP-12F module, based on the ESP8266EX, breaks out 22 pins. However, only 17 GPIO-related pins are practically usable, and several of them have important restrictions.
Title in Other Languages
- German: ESP-12F Pinout-Referenz: Wie man es in eigenen Designs verwendet
- French: Référence du brochage de l’ESP-12F : Comment l’utiliser dans vos conceptions
- Spanish: Referencia de pines del ESP-12F: Cómo usarlo en tus diseños
- Italian: Guida ai pin di ESP-12F: Come usarlo nei tuoi progetti
- Portuguese (Brazil): Referência de pinagem do ESP-12F: Como usar em seus projetos
Tip: Right-click anywhere on this page and choose “Translate to your language”.
Complete Pin Reference Table
| Pin Label | GPIO | Type | Boot/Strapping Function | Notes |
|---|---|---|---|---|
| ADC | ADC0 | Analog Input | — | 0–1.0V range only, no GPIO function |
| EN (CH_PD) | — | Enable | Must be HIGH to run | Pull-up required (10kΩ) |
| RST | — | Reset | Active LOW | Pull-up internally, can leave floating |
| GPIO16 (XPD_DCDC) | 16 | I/O | No pull-up/down, no interrupt support | Used for deep-sleep wake-up (connect to RST) |
| GPIO14 | 14 | I/O | HSCLK | General purpose |
| GPIO12 | 12 | I/O | HMISO | General purpose |
| GPIO13 | 13 | I/O | HMOSI | General purpose |
| GPIO15 | 15 | I/O | Strapping pin – must be LOW at boot | HSPICS, has internal pull-down |
| GPIO2 | 2 | I/O | Strapping pin – must be HIGH at boot | UART1 TXD, internal pull-up |
| GPIO0 | 0 | I/O | Strapping pin – boot mode select | HIGH = normal boot, LOW = flash/programming mode |
| GPIO4 | 4 | I/O | — | Recommended for I2C SDA |
| GPIO5 | 5 | I/O | — | Recommended for I2C SCL |
| GPIO9 (SD2) | 9 | I/O | Used by SPI flash (in some modes) | Avoid unless not using QIO flash mode |
| GPIO10 (SD3) | 10 | I/O | Used by SPI flash (in some modes) | Avoid unless not using QIO flash mode |
| RXD (GPIO3) | 3 | Input mostly | UART0 RX | Can be used as input-only GPIO if UART is not needed |
| TXD (GPIO1) | 1 | I/O | Strapping pin – must be HIGH at boot | UART0 TX, affected by boot messages |
| VCC | — | Power | 3.3V only | Not 5V tolerant |
| GND | — | Ground | — | Multiple GND pins for thermal and RF performance |
Critical Design Considerations
1. Strapping Pins (Boot Mode Selection)
These pins are sampled at reset/boot and determine boot behavior:
| Pin | Must Be at Boot | If Violated |
|---|---|---|
| GPIO0 | HIGH = run mode, LOW = flash mode | Wrong boot mode |
| GPIO2 | HIGH | Boot failure if pulled LOW |
| GPIO15 | LOW | Boot failure if pulled HIGH or left floating |
Design rule: Avoid connecting these pins to devices that force them LOW or HIGH during power-up, such as LEDs, buttons, or external peripherals without proper pull resistors.
2. Input-Only / Restricted Pins
- GPIO3 (U0RXD): Mostly input-only when not used for UART0. This is the default UART0 receive pin for programming and debugging. If UART0 is inactive or remapped, GPIO3 can serve as a general input, but it is not a good choice for general output use.
- GPIO16: No pull-up/pull-down resistor, no interrupt support, and not suitable for PWM or I2C. It is mainly used for deep-sleep wake-up by connecting it to RST.
- ADC0: Analog input only, not a GPIO pin. Maximum input voltage is 1.0V. It is a 10-bit ADC, so the reading range is 0 to 1024.
3. Pins to Avoid for General GPIO Use
- GPIO6–GPIO11: Internally connected to the SPI flash memory. Do not use them unless you fully understand your flash mode configuration.
- GPIO9 and GPIO10: Especially risky in QIO flash mode and generally best avoided.
- GPIO1 (TX) and GPIO3 (RX): Usable as GPIO only if you do not need serial communication or debug output.
4. Power Considerations
- Requires a stable 3.3V supply.
- Peak current can reach approximately 300mA during Wi-Fi transmit bursts.
- Add decoupling capacitors close to the VCC pin, typically 100µF + 100nF.
- EN (CH_PD) must have a pull-up resistor, typically 10kΩ. If EN floats, the module may not boot.
5. Reset Behavior
- RST is active LOW.
- Add a pull-up resistor and, if needed, a small capacitor to GND for better noise immunity.
- Automatic reset circuits for auto-flashing often use RTS and DTR from a USB-to-serial converter through transistors or diodes.
SPI and HSPI on ESP-12F
The ESP8266 has two SPI controllers:
- SPI: Usually reserved for internal flash memory. According to datasheet these pin are internally connected to SPI flash chip and they are not available from outside.
- HSPI: Available for user applications such as displays, sensors, and SD cards
ESP-12F HSPI Pin Mapping
| HSPI Function | ESP8266 GPIO | ESP-12F Physical Pin Name | Description |
|---|---|---|---|
| HSPI_MISO (Master In Slave Out) | GPIO12 | MISO / IO12 | Data input to the ESP8266 |
| HSPI_MOSI (Master Out Slave In) | GPIO13 | MOSI / IO13 | Data output from the ESP8266 |
| HSPI_CLK (Serial Clock) | GPIO14 | SCLK / IO14 | Clock signal |
| HSPI_CS (Chip Select) | GPIO15 | CS / IO15 / TXD2 | Slave select / chip select |
Important Hardware Considerations for HSPI
- GPIO15 (HSPI_CS) Boot Strap Pin:
GPIO15 is a boot strapping pin. For the ESP8266 to boot successfully from SPI flash, GPIO15 must be pulled LOW during boot, usually with a 10kΩ pull-down resistor.Design tip: If you connect a peripheral’s chip select pin to GPIO15, make sure the peripheral does not pull the line HIGH during startup, or the ESP-12F may fail to boot.
- GPIO12 (HSPI_MISO) Consideration:
Depending on the flash configuration, GPIO12 can sometimes affect startup behavior if it is forced HIGH during boot. In most designs, it is safest to leave it floating or ensure it is not strongly driven during reset.
Is I2C on the ESP8266/ESP-12F Hardware or Software?
On the ESP8266, I2C is implemented as a software (bit-banged) peripheral.
Unlike the ESP32, which has dedicated hardware I2C controllers, the ESP8266 does not expose a true hardware I2C peripheral on its standard GPIOs. Instead, the SDK and environments such as MicroPython typically implement I2C in software.
Because it is software-based:
- You can use almost any two GPIO pins for SDA and SCL.
- It uses more CPU time than hardware I2C, but for most sensors, EEPROMs, and small displays, it works very well.
Recommended I2C Pins
For most tutorials and practical projects, the cleanest default choice is:
| Signal | ESP8266 GPIO | ESP-12F Pin Label | NodeMCU Label | Recommendation | Notes |
|---|---|---|---|---|---|
| SDA (Data) | GPIO4 | IO4 | D2 | Recommended default | Safe pin, no boot-strap conflicts |
| SCL (Clock) | GPIO5 | IO5 | D1 | Recommended default | Safe pin, no boot-strap conflicts |
This GPIO4/GPIO5 pair is usually the best recommendation for tutorials because both pins are general-purpose GPIOs and do not create boot-mode complications.
Alternative I2C Pin Pair When GPIO Count Is Limited
If you are short on available pins, a common alternative is to keep GPIO4 as SDA and use GPIO2 as SCL.
| Signal | ESP8266 GPIO | ESP-12F Pin Label | NodeMCU Label | When to Use | Notes |
|---|---|---|---|---|---|
| SDA (Data) | GPIO4 | IO4 | D2 | Alternative option | Safe pin, commonly used for SDA |
| SCL (Clock) | GPIO2 | IO2 | D4 | Use when pin availability is restricted | Boot strap pin: must remain HIGH at boot |
Why Use GPIO2 as an Alternative SCL Pin?
GPIO2 is a boot strap pin and must be pulled HIGH during startup for the ESP8266 to boot correctly.
- I2C lines require external pull-up resistors, typically 4.7kΩ to 10kΩ connected to 3.3V.
- Because SCL already needs a pull-up resistor, GPIO2 can work well in this role when pin usage is constrained.
- However, GPIO5 remains the cleaner default recommendation because it avoids boot-related sensitivity.