- Flutter on Raspberry Pi with flutter-pi - 26 November, 2019
- ESP8266 NodeMCU pinout for Arduino IDE - 19 November, 2019
- Cross-compile and deploy Qt 5.12 for Raspberry Pi - 17 November, 2019
This short post is a cheat sheet than you can use to check the ESP8266 NodeMCU pinout (V2 and V3 ESP8266 NodeMCU boards) for your Arduino IDE programs.
NodeMCU pinout
For practical purposes ESP8266 NodeMCU V2 and V3 boards present identical pinouts. For our mechatronics projects we are mainly interested in the following pins:
- Power pins (3.3 V).
- Ground pins (GND).
- Analog pins (A0).
- Digital pins (D0 – D8, SD2, SD3, RX and TX – GPIO XX)
Most ESP8266 NodeMCU boards have one input voltage pin (Vin), three power pins (3.3v), four ground pins (GND), one analog pin (A0) and several digital pins (GPIO XX).
ESP8266 NodeMCU schematic
These are affiliate links. This means if you click on the links and purchase the promoted item, we will receive a small affiliate commission at no extra cost to you, the price of the product is the same. We would really appreciate your support to our work and website if this is fine for you.
If we want to interact with a digital pin in Arduino IDE we have to remember the GPIO number (0..16), whereas for the analog pin the alias is used (A0). Digital pins can be used as inputs or outputs, however the analog pin can only be used as an input.
Pin | Code | Arduino alias | Pin | Code | Arduino alias |
A0 | A0 | A0 | D6 | GPIO 12 | 12 |
D0 | GPIO 16 | 16 | D7 | GPIO 13 | 13 |
D1 | GPIO 5 | 5 | D8 | GPIO 15 | 15 |
D2 | GPIO 4 | 4 | SD2 | GPIO 9 | 9 |
D3 | GPIO 0 | 0 | SD3 | GPIO 10 | 10 |
D4 | GPIO 2 | 2 | RX | GPIO 3 | 3 |
D5 | GPIO 14 | 14 | TX | GPIO 1 | 1 |
For example, the following code initializes the GPIO 4 and 5 digital pins as input and output, respectively and the analog pin (A0) as input.
pinMode(4,INPUT) pinMode(5,OUTPUT) pinMode(A0,INPUT)
Read Breadboard, Pinout and Dimmable LED with Pulse-Width Modulation (PWM), to know more about how to interact with pins in Arduino IDE, particularly the ESP8266 NodeMCU pinout section.
Further Reading
Read the following interesting articles to keep learning about programming ESP8266 NodeMCU boards and Arduino IDE.
- An Introductory Guide to ESP8266, ESP-XX modules and NodeMCU pinout
- ESP8266 NodeMCU programming: First Steps
- Breadboard, Pinout and Dimmable LED with Pulse-Width Modulation (PWM)
Let us know your opinion about this short post with the starts you can find below, this gives us feedback about how we are doing. Also, share this article if you think it can help others, thanks :-).
Once we give low input to pin 16 of NodeMCU ESP8266, it remains low, see my code below which is not able to switch off led because of this issue, can’t we use pin 16 as general purpose input?
See my complete code
https://github.com/mrnams/IOT/blob/main/ESP8266/Examples/Basic/One-Led-Two-Push-Buttons
You are right. GPIO 16 doesn’t have interrupt capabilities and doesn’t support PWM.
Amongus SUSSY BAKA