ESP8266 pinout reference and how to use GPIO pins (original) (raw)

This tutorial is about pinout reference of ESP8266 and different types of ESP8266 boards like Nodemcu, ESP01 , ESP12. First, I will give the overview of ESP8266 IC and its pinout and after that I will provide pinout reference of most popular ESP8266 boards.

Esp8266 is a microchip in QFN package having capabilities of both TCP/IP suite and microcontroller. Esp8266 delivers highly integrated WiFi solution that meets the needs of the Internet of Things industries such as low cost, efficient power usage, trustworthy performance, and compact design. It is manufactured by Espressif Systems in Shanghai, China.

Having complete WiFi networking capabilities it can perform as a slave to a host microcontroller or as a standalone application. When we say the slave to a host microcontroller it means it can use as WiFi adaptor to any microcontroller using SPI or UART interfaces. While using as a standalone it can perform the capabilities of microcontroller and WiFi networking.

Functional Block Diagram Esp8266

Esp8266 is based around Tensilica’s L106 Diamond series which is 32-bit processor and have on-chip SRAM. Also integrates power modules, RF balun, RF receiver and transmitter, analog receiver and transmitter, digital baseband, amplifier, filters, and some other minimal components.

Specifications of ESP8266

Esp8266 specification divides into three parts: Hardware, Software, and Wi-Fi. In hardware specification, its package size is QFN 32pins with a dimension of 5mm x 5mm. Operating voltages range from 2.5V to 3.6V. The chip consumes 80mA of current on average. Its CPU is Tensilica L106 which is a 32bit processor with on-chip SRAM. The peripheral interface contains UART, SDIO, SPI, I2C, I2S, IR remote control, GIPO’s, ADC, PWM, LED Light and button.

Its firmware can be updated using OTA and UART. It uses IPv4, TCP, UDP, and HTTP as network protocols. User can configure using AT commands set, Cloud Server and using a mobile application.

Wi-Fi frequency ranges from 2.4G to 2.5G. It uses standard Wi-Fi protocol IEEE 802.11 b/g/n. Esp6266 Wi-Fi capabilities are certified by Wi-Fi Alliance.

ESP8266 Chip Pinout and Descriptions

Pin layout of 32-pin QFN Package esp8266

Pin layout of 32-pin QFN Package.

All GPIO’s can be used as Input and Output pin but they also have their specific function.

Schematic

ESP8266 schematics include the following components:

So far we cover Esp8266 preamble, functional block diagram, pins layout, description, and schematics.

In August 2014 Espressif Systems launched their first raw module which is manufactured by third part AI-Thinker and module referred as ESP-01 module. Since then Ai-Thinker developed a series of modules based around ESP8266, this series referred as ESP-xx modules ranges from 01 to 14.

Pinout of different types of ESP8266 Modules

In this section of article, we will talk about pinout of different versions of ESP8266 module starting from ESP-01 to ESP-12.

ESP8266 Modules

Espressif Systems released their first official software development kit to program the chip directly without interfacing with an external microcontroller. Since then there are many official SDKs but Espressif maintain only two SDKs stable one is based on FreeRTOS and other based on callbacks. There is also a variety of open source SDK’s for ESP8266.

Arduino: is the most commonly used SDK due to its popularity. It is a C++ based SDK. ESP6266 is easy programmed as Arduino boards. The core files are available on GitHub.

NodeMCU: is a Lua Based software development kit.

MicroPython: is the use of python language for embedded devices.

Espruino, Mongoose OS, uLisp, Sming, Platform IO, ESP Easy, Smick, ESP Open RTOS are some other open source SDK’s.The need for these development boards is required due to ESP-xx modules series lacks on-board a voltage regulator, USB to UART Bridge like CH340G and Silicon Lab’s CP2102 and micro USB connector. Before we had to buy voltage regulator and USB to UART bridge separately and then wired them up with ESP-xx modules to flash it.

Here we will discuss mostly development board based around ESP-12E module.

ESP8266 12E Module Pinout

Esp8266 12E module has a total 22 pins which include

ESP8266 12E Module Pinout

No. of Pins Pin Label Description
17 GPIO GPIO pins range from GPIO0 to GPIO16 includes SPI, I2C, SDIO, UART interface pins.
1 ADC 10 bit Analog to Digital Converter.
1 VCC Supply Voltage 3.3V
1 GND Ground pin
1 RST Rest Pin
1 Enable Chip Enable Pin

ESP8266 12E Wemos D1 Mini pinout

ESP8266 12E Wemos D1 Mini pinout

Wemos D1 Mini development board has a total 16 pins in which 12 pins are active, uses ESP-12 module, onboard reset button, 3.3 voltage regulator, Micro USB, USB to UART bridge and some other components.

No. of Pin Label Description
1 3.3V 3.3 volts pin
1 5.0 Input 5V voltage pin
1 GND Ground pin
1 ADC 10 bit Analog to Digital Converter
1 RST Reset Pin
9 D0 to D8, Input/output pins also used for SPI and I2C, Flash.
2 RX,TX UART interface.

ESP8266 01 Module pinout

ESP8266 01 Module pinout

ESP8266 01 Module is different but commonly as used as the above development boards. This board is not breadboard friendly often separate programming module is used for programming. It has a total 8 pins in which 6 pins are active.

No. of Pin Label Description
1 3.3V Supply 3.3 volts pin
1 GND Ground pin
1 RST Reset Pin
1 CH_PD/EN Chip Power and Enable pin
4 GPIO 0 to 3 UART interface and input/output pins

ESP8266 12E NodeMCU Development Board pinout

ESP8266 12E NodeMCU Development Board pinout

NodeMCU development board has a total 30 pins in which 14 pins are active, uses ESP-12 module, onboard reset and flash button, 3.3 voltage regulator, Micro USB, USB to UART Bridge and some other components.

No. of Pin Label Description
3 3.3V 3.3 volts pins
1 Vin Input 5V voltage pin
4 GND Ground pins
1 ADC 10 bit Analog to Digital Converter
1 RST Reset Pin
1 EN Chip Enable pin
1 CLK CLK pin for SPI and SDIO interface
1 SD0 Data pin 0 for SDIO and MISO pin for SPI Interface.
1 CMD Command pin for SDIO interface and Chip select pin for SPI interface.
1 SD1 Data pin 1 for SDIO interface and MOSI pin for SPI Interface.
1 SD2 Data pin 0 for SDIO interface and also used as GPIO9.
1 SD3 Data pin3 for SDIO interface and also used as GPIO10.
2 RSV Reserved pins.
11 D0 to D8, RX, TX Input/output pins also used for UART, SPI, I2C, Flash and wake pin.

ESP8266 Peripherals

The ESP8266 have the following peripherals:

Analog Input

ESP8266 have an only one 10-bit analog to digital converter that referred as ADC0 and labels as A0. But this is also its one of the biggest disadvantage because mostly user have to connect two sensors so we have to buy separate ADC modules, IC and multiplexing circuit to interface two or more sensors but this is a topic of another article.

Input analog voltage of ESP-01 module ranges from 0 to 1V. Development board based around ESP-12E module have input analog voltage ranges from 0 to 3.3V. So we have to keep in mind while writing a sketch to use A0 pin.

PWM Pins

The ESP8266 allows PWM in all input/output pin from GPIO0 to GPIO16. PWM signals have 10-bit resolutions.

SPI Pins

A Serial Programming interface (SPI) has following pins in ESP8266

I2C pins

ESP8266 provide only software I2C interface it means we can use any two pins for I2C but following pins mostly used.

GPIO5 for Serial Clock Line (SCL)

GPIO4 for Serial Data Line (SDA)

Interrupt Pins

We can use any GPIO pin for interrupts except GPIO16.

Wake Up

To wake up ESP8266 from deep sleep using GPIO16 by connecting it to RST pin. This is a topic for another article.

On board LED

NodeMCU on board LED

Mostly development boards have one or more built-in LEDs. The LED built on the ESP8266 module is connected to GPIO2 and the LED built on development board connected to GPIO16.

Reset and Flash Button

Reset and Flash Button NodeMcu

Pressing the reset button or pulling RST pin low resets the ESP8266 chip. Pressing the Flash button or pulled the GPIO0 low sets the ESP8266 chip into bootloader mode.

Which pin of ESP8266 to use

Always keep in mind that GPIO label does not match the label on the silkscreen. For example GPIO0 corresponds to D3 and D0 corresponds to GPIO16. The GPIOs with a green tick is best to use.

Label GPIO Input Output Description
A0 ADC0 Analog Input No For analog input from 0 to 3.3v and no output.
RX GPIO3 Yes RX pin only High at Boot.
TX GPIO1 Tx pin only Yes High at Boot.
D0 GPIO16 No interrupt No I2C, PWM Used to wake up chip from deep sleep, High at Boot.
D1 GPIO5 Yes Yes Often used as SCL
D2 GPIO4 Yes Yes Often used as SDA
D3 GPIO0 Pulled up Yes Connected to Flash button
D4 GPIO2 Pulled up Yes Connected to built-in LED, High at Boot.
D5 GPIO14 Yes Yes SCLK pin for SPI interface
D6 GPIO12 Yes Yes MISO pin for SPI interface
D7 GPIO13 Yes Yes MOSI pin for SPI interface
D8 GPIO15 Pulled to ground Yes CS pin for SPI interface

ESP8266 pin High and Low-voltage signal at Boot

While booting ESP8266 the following pins provide 3.3v signal on specified pins so connecting relays, transistor or any other peripheral devices can misbehave. The following pin output 3.3v signal on Boot:

All other GPIOs pin provide low voltage single on Boot except GPIO4 and GPIO5. So the GPIO4 and GPIO5 are the best pins to connect relays, transistor and other peripheral devices to stable results.

Pins Configuration during Boot

To boot the ESP8266 successfully we have to disallow the specified pins to get HIGH or LOW.

Applications of ESP8266

You may also like to have a look into other ESP8266 tutorials: