In the previous entry, we saw the different pins of the ESP8266 and their functionalities. But we already mentioned 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 boot process of the device. If used incorrectly, this can generate a conflict and cause our project not to boot, 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 GIPO15 are involved in the boot process, with the considerations we discussed in the previous section.
- GPIO1 and GPIO3 are used for Serial communication (UART)
More information on the hardware details of the ESP8266, especially about the configuration pins, can be found in the entry Hardware details and pins of the ESP8266
Summary of the pins
To avoid setbacks and ensure that we are using the pins appropriately, we have the following reference table. It allows us to quickly verify which pins are safe for use and which have specific functions that we need to 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 potential 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 by 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 interrupts | ⚠️No PWM ⚠️No I2C | HIGH during boot Pull-Down resistor Connect to RST for Wake-Up |
ADC0 | A0 | ⚠️Analog Input | ❌ |
In the upcoming entries, we will look at different development boards like the NodeMCU that integrate the ESP8266 and start programming it.