From this blog, I am starting a series of blogs related to NodeMCU. In this series of blogs, I shall try to cover everything which an IoT, automation or robotics-related hobbyist or professional need to know. This first blog will be about the general introduction of “NodeMCU pinout” and then the next upcoming blog will be about controlling different devices with this module. At a more advanced level, I shall teach you how to used NodeMCU pinout with different modes and then controlling load with your home WiFi using NodeMCU. There are different models available but here I shall use “38pins NODE MCU 32 S”.
Let’s start our journey in this exciting world.
First thing you will notice when you see a “NODEMCU ESP 32S” is that it has a total of 38 pins and the board does not have a pin label on the front side. Instead, it has a pin label on the backside. The manufacturer did not print the pin label on the front side due to the small size and more pins on the board. Most other ESP board has pin labels on the front or upper side.
How to Power up Board
The first step in any electronics circuit working is to turn it ON. There are four basic techniques to power up your Board.
5 V Pin
You can power up ESP 32 by providing 5V DC to Pin labeled as 5V. This pin is adjacent to enable button (Check pin diagram above). Please keep in mind that this module is operated on 3.3V but it has a built-in voltage regulator which converts 5V to 3.3V.
3.3 V Pin
3.3 V can be applied to a pin labeled 3.3V (Check pin diagram above). You can use a separate power supply like “YwRobot Power MB V2” to provide independent 5V or 3.3 V. You can use the following link to learn how to use it.
Now, the most useful and easy technique during project development is through Computer or Mobile phone charger mini USB. Again built-in voltage regulator will convert it to 3.3V.
There are three dedicated ground pins in the “38pins NODE MCU 32 S Module”.
GPIO Current and Voltage Parameter
NodeMCU operates on 3.3V and absolute maximum current per GPIO Pin is 40mA.
GPIO Pin Detail
Now, there are 36 General Purpose Input / Output pins but all pins cannot be used for every purpose. Some pins are specific for some particular tasks which are given below in detail.
It is by default a pulled-up pin. If you connect it to the ground 3.3 V regulator will be disabled, due to this you can connect it to the push button to restart the module.
There is a total of 18 Channels for 12 bits of Analog to Digital Converter. These are used to measure 0 to 3.3V DC. These ADC can measure voltages even during the sleep mode of the system. Detail along with pins is given below
- Pin # 36 (CH0-ADC1)
- Pin # 37 (CH1-ADC1)
- Pin # 38 (CH2-ADC1)
- Pin # 39 (CH3-ADC1)
- Pin # 32 (CH4-ADC1)
- Pin # 33 (CH5-ADC1)
- Pin # 34 (CH6-ADC1)
- Pin # 35 (CH7-ADC1)
- Pin # 4 (CH0-ADC2)
- Pin # 0 (CH1-ADC2)
- Pin # 2 (CH2-ADC2)
- Pin # 15 (CH3-ADC2)
- Pin # 13 (CH4-ADC2)
- Pin # 12 (CH5-ADC2)
- Pin # 14 (CH6-ADC2)
- Pin # 27 (CH7-ADC2)
- Pin # 25 (CH8-ADC2)
- Pin # 26 (CH9-ADC2)
DAC (Digital to Analog Convertor) Channels.
This is one of the most prominent features of Node MCU ESP32S. There are two DAC channels with 8 bits resolution, which can be used to convert the analog signal into digital output.
- Pin # 25 (DAC1)
- Pin # 26 (DAC2)
Non-Out Put or Only Input Pins
There are a total of 4 pins without any pull-up or pull-down register so you cannot use them as output pins. These are GPIO 34, 35,36, and 39 and are called input-only pins.
Pins not recommended to Use
Pin #6 to 11 are internally connected to SPI flash memory so it is highly not recommended for use. Pin # 1, 3, 5, 14 and 15 change their states to high or output signal PWM during booting or resetting of the Board. So if you use these as output unexpected results can be obtained.
Pulse width modulation (PWM) Pins
There are 16 pins capable of generating a PWM signal. Any pin which can be used as an output pin can generate a PWM signal except Pin # 34 to 39.
These are 6 GPIO pins used to program the module in flashing or bootloader mode. If you use any peripheral device like a mouse etc with these pins, there can be issues in uploading new code. These pins are Pin # 0, 2, 4, 5, 12, 15.
Capacitive Touch Pins
This module has 10 internal capacitive touch sensors. These can be integrated with touchpads to replace push buttons etc. Pin detail is given below
- Pin # 4 (T0)
- Pin # 0 (T1)
- Pin # 2 (T2)
- Pin # 15 (T3)
- Pin # 13(T4)
- Pin # 12 (T5)
- Pin # 14 (T6)
- Pin # 27 (T7)
- Pin # 33 (T8)
- Pin #32 (T9).
There are 16 GPIO pins which can be used to wake up the module from deep sleep mode. These pins are numbered 0, 3, 4, 5, 9, 8, 6, 7, 17, 16, 15, 14 ,13, 12, 11 and 10.
Communication Techniques and Pins
This module supports the following types of communication protocols.
SPI: This 32S module support two SPI sets, each containing 4 pins.
Set1 (VSPI): Pin# 23(MOSI), Pin# 19(MISO), Pin# 18(CLK), Pin# 5(CS).
Set2 (HSPI): Pin# 13(MOSI), Pin# 12(MISO), Pin# 14(CLK), Pin# 15(CS).
I2C: There are 2 Channels available. Default Pins used for it are Pin# 21 (SDA) and Pin# 22 (SCL). You can also use any other pin for I2C using wire library by calling the below function
Hall Effect Sensor
This module also has a built-in “Hall Effect Sensor”, which can be used to measure any magnetic field nearby.
Any GPIO (General Purpose Input Output pin) can serve as an interrupt through programming.
Built in Bluetooth, Built in WiFi, On board antenna, Frequency range up to 2.5 GHz, 32Mbit built in flash etc
This is the end of this introduction blog. Hope you fully understand the function and utilization of different pins of NodeMCU. From the above properties, anyone can conclude that NodeMCU is the most versatile and economically feasible solution of automation. Please do comment to encourage me for writing more on NodeMCU and ESP8266 etc.