ESP8266 Pinout Reference

One of the great things about the ESP8266 is that it has pretty fair amount of GPIO pins to work with. You won’t have to juggle or multiplex your IO pins. There are a few things to watch out for so please read the pinout carefully.

Please note that the following pinout reference is for the popular ESP8266 NodeMCU development board with 30 pins.

esp8266 nodemcu dev board.webp

Not all pins are broken out in all ESP8266 development boards, but each specific pin works the same way regardless of the development board you are using.

ESP8266 Peripherals and I/O

The ESP8266 NodeMCU has total 17 GPIO pins broken out to the pin headers on both sides of the development board. These pins can be assigned to all sorts of peripheral duties, including:

1 ADC channel1 channel of 10-bit precision SAR ADC.
2 UART interfacesUART0 can be used for communication. Since UART1 features only data transmit signal (TX), it is usually used for printing log.
4 PWM outputs4 channels of PWM pins for dimming LEDs or controlling motors.
2 SPI and 1 I2C interfacesThere are 2 SPI and 1 I2C interfaces to hook up all sorts of sensors and peripherals.
I2S interface1 I2S interface if you want to add sound to your project.

Thanks to the ESP8266’s pin multiplexing feature (Multiple peripherals multiplexed on a single GPIO pin). Meaning a single GPIO pin can act as PWM/UART/SPI.

You can get extensive information about ESP8266 from the datasheet.

ESP8266 Pinout

The ESP8266 development board has a total of 30 pins that connect it to the outside world. For simplicity, pins with similar functionality are grouped together. The pinout is as follows:

esp8266 pinout nodemcu

Let us analyze the ESP8266 pins and their functions one by one in more detail.

ESP8266 GPIO Pins

ESP8266 development board has 17 GPIO pins which can be assigned to various functions programmatically. Each GPIO can be configured to internal pull-up or pull-down, or set to high impedance.

esp8266 gpio pins

Which ESP8266 GPIOs are safe to use?

Because the ESP8266 has many pins with specific functions, they may not be suitable for your projects. The following table shows which pins are safe to use and which pins require more attention before using them.

  • – Your first priority pins. They are perfectly fine to use.
  • – Pay attention as their behavior can be unpredictable, mainly during boot. Don’t use them unless you absolutely need to.
  • – It is not recommended to use these pins. So avoid them.
  Label    GPIO    Safe to use?  Reason
D0GPIO16HIGH at boot, used to wake up from deep sleep
D3GPIO0connected to FLASH button, boot fails if pulled LOW
D4GPIO2HIGH at boot, boot fails if pulled LOW
D8GPIO15Required for boot, boot fails if pulled HIGH
RXGPIO3Rx pin, used for flashing and debugging
TXGPIO1Tx pin, used for flashing and debugging
CLKGPIO6Connected to Flash memory
SDOGPIO7Connected to Flash memory
CMDGPIO11Connected to Flash memory
SD1GPIO8Connected to Flash memory
SD2GPIO9Connected to Flash memory
SD3GPIO10Connected to Flash memory
A0ADC0Analog input pin, cannot be configured as output

For your convenience, here is an image showing which GPIO pins are safe to use.

esp8266 gpio pins that are safe to use

ESP8266 ADC Pins

The ESP8266 is embedded with a 10-bit precision SAR ADC.

The ADC on the ESP8266 is a 10-bit ADC meaning it has the ability to detect 1024 (210) discrete analog levels. In other words, it will map input voltages between 0 and the operating voltage 3.3V into integer values between 0 and 1024. For example, this yields a resolution between readings of: 3.3 volts / 1024 units or, 0.0032 volts (3.2 mV) per unit.

esp8266 adc pins

The following two measurements can be implemented using ADC. However, they cannot be implemented at the same time.

  • Measure the power supply voltage of VDD3P3 (Pin3 and Pin4).
  • Measure the input voltage of A0.

ESP8266 SPI Pins

ESP8266 features two SPIs (SPI and HSPI) in slave and master modes. These SPIs also support the following general-purpose SPI features:

  • 4 timing modes of the SPI format transfer
  • Up to 80 MHz and the divided clocks of 80 MHz
  • Up to 64-Byte FIFO
esp8266 spi pins

Actually you can use any GPIO pins as SPI pins by ‘bitbanging’, but if you end up using ‘hardware SPI’ you will want to use the HSPI pins (GPIO12-15).

Usually standard libraries also use HSPI pins between the two.

ESP8266 I2C Pins

The ESP8266 doesn’t have hardware I2C pins, but it can be done by ‘bitbanging’. It works quite well and the ESP8266 is fast enough to match ‘Arduino level’ speed.

GPIO4 (SDA) and GPIO5 (SCL) are used as I2C pins by default, to make it easier for people using existing Arduino code, libraries and sketches.

However, you can use any other two GPIO pins as I2C pins by calling wire.begin(SDA, SCL) in the Arduino IDE.

esp8266 i2c pins

ESP8266 UART Pins

ESP8266 has 2 UART interfaces, i.e. UART0 and UART1, which provide asynchronous communication (RS232 and RS485), and communicate at up to 4.5 Mbps.

  • UART0 (TXD0, RXD0, RST0 & CTS0 pins) is used for communication.
  • UART1 (TXD1 pin), on the other hand, features only data transmit signal, so it is usually used for printing logs.
esp8266 uart pins

TXD0 and RXD0 are serial control and bootloading pins. These are connected via a USB-to-serial converter, so you should be careful when using them as you will also get USB traffic on them.

ESP8266 PWM Pins

In ESP8266 Pulse width modulation (PWM) output can be implemented programmatically on all GPIO pins: GPIO0 to GPIO15.

esp8266 pwm pins

The PWM signal on the ESP8266 has 10-bit resolution. Also the PWM frequency range is adjustable from 1000 µs to 10000 µs, i.e. between 100 Hz and 1 kHz.

ESP8266 SDIO Pins

The ESP8266 has Secure Digital Input/Output Interface (SDIO) which is used to directly interface the SD card. 4-bit 25 MHz SDIO v1.1 and 4-bit 50 MHz SDIO v2.0 are supported.

esp8266 sdio pins

ESP8266 Power Pins

The VIN pin can be used to supply power to the ESP8266 when you are not delivering power through USB.

The 3V3 pins are output from the on-board 3.3V regulator, they can supply 500mA peak.

The GND pin is the common ground for all power and logic.

esp8266 power pins

ESP8266 Interrupt Pins

All GPIOs can be configured as interrupts, except GPIO16.

ESP8266 Control Pins

RST is the reset pin for the ESP8266, pulled high by default. When pulled low momentarily it will reset the ESP8266 system. It’s the same as pressing the on-board RST button.

The FLASH pin is used by the ESP8266 to determine when to boot into the bootloader. If the pin is held low during power-up it will start bootloading! It’s the same as pressing the on-board FLASH button.

The EN (sometimes labeled CH_PD or Chip Power Down) pin is used to enable ESP8266. The chip is enabled when pulled HIGH. When pulled LOW the chip works at minimum power.

The WAKE pin is used to wake the ESP8266 from deep sleep, you will need to connect it to the RST pin.

esp8266 control pins