In the previous post, we saw the different pins of the ESP8266 and their functionalities. But we already commented that not all pins are safe to use in our projects.
This is because some pins have specific functions or play a crucial role in the device boot process. If not used correctly, this can generate a conflict and cause our project not to start, or even break something.
Of the 17 GPIO (0 to 16):
- 6 GPIO (GPIO6 to GPIO11) are used to connect via SPI with the flash memory, so we cannot use them.
- GPIO0, GPIO2, and GPIO15 are involved in the boot process, with the considerations we have seen in the previous section.
- GPIO1 and GPIO3 are used for Serial communication (UART)
More information about ESP8266 hardware details, especially about the configuration pins in the post Hardware details and pins of the ESP8266
Summary of the pins
To avoid setbacks and ensure that we use the pins properly, we have the following reference table. It allows us to quickly check which pins are safe for use and which have specific functions that we must take into account.
Before starting any project with the ESP8266, it is highly recommended to consult this reference table and familiarize yourself with the characteristics of each pin. This will allow us to make informed decisions and avoid possible inconveniences in the development of our projects.
GPIO | Pin | Input | Output | Comments |
---|---|---|---|---|
GPIO0 | D3 | ⚠️Pulled Up | ✔️ | Boot fails if pulled LOW Connected to FLASH button |
GPIO1 | TX | ⚠️TX | ✔️ | HIGH during Boot fails if pulled LOW Debug output on boot Not usable if UART is used |
GPIO2 | D4 | ⚠️Pulled Up | ✔️ | HIGH during boot Boot fails if pulled LOW Built-in LED TX1 |
GPIO3 | RX | ✔️ | ⚠️RX | HIGH during boot Not usable if UART is used |
GPIO4 | D2 | ✔️ | ✔️ | SDA (I2c) (frequently) |
GPIO5 | D1 | ✔️ | ✔️ | SCL (I2C) (frequently) |
GPIO6-11 | - | ❌ | ❌ | Used for flash memory |
GPIO12 | D6 | ✔️ | ✔️ | MISO (SPI) |
GPIO13 | D7 | ✔️ | ✔️ | MOSI (SPI) |
GPIO14 | D5 | ✔️ | ✔️ | SLCK (SPI) |
GPIO15 | D8 | ⚠️Pulled to GND | ✔️ | CS (SPI) LOW during boot Boot fails if pulled HIGH No Pull-Up |
GPIO16 | D0 | ⚠️No interruptions | ⚠️No PWM ⚠️No I2C | HIGH during boot Pull-Down resistance Connect to RST for Wake-Up |
ADC0 | A0 | ⚠️Analog Input | ❌ |
In the next posts, we will be looking at different development boards such as the NodeMCU that integrate the ESP8266 and start their programming.