ESP8266 – Knowing the NodeMCU GPIOs or Pinout

Where To Buy?
No.ComponentsDistributorLink To Buy
1ESP8266AmazonBuy Now

Introduction

When the subject is ESP8266, it is normal that our attention is on the Wifi module. We've already discussed some applications in previous articles, and there's still a lot of cool stuff to see in the future. We've looked at how the ESP8266 communicates with the world via wifi, and now we'll look at how it does it through its pins.

We will make a decision here. The ESP8266 is found in several modules. Each module with its pin provision. ESP-12 modules provide the most features. To make better use of these features and have a more protoboard-friendly module at hand, we will analyze the NodeMCU module with the ESP-12E.

Overview and Electrical Data

The NodeMCU pins are available in two rows with a spacing that allows them to fit on a breadboard (in particular, I find the pins a little thicker than they should be, and I think if they had more length and less width, it would be even more efficient).

  • The NodeMCU interferes just a little with ESP-12 pins. It does an untreated exposure of each of them.

It is interesting to see what NodeMCU adds or changes to the ESP-12.

Power Source

ESP8266 operates on 3.3V, ESP-12 exposes the VDC pin for direct power. The NodeMCU incorporates a voltage regulator (usually the AMS1117) that can receive a 5V to 10V input and deliver a stable 3.3V supply to the ESP-12.

But what advantage does this give us? nodeMCU is a development module. Choosing pins that fit the breadboard shows us this. Being able to receive 5V greatly increases the practicality of the power supply. 5V is the standard used on USB, so even a cell phone charger can keep everything running.

The power can be supplied directly via the USB connector (standard USB = 5V) or the Vin pin (5V to 10V). The regulator provides a maximum of 500mA.

The pins involved in the power are:

  • Vin: Positive voltage Operates with voltages from 5V to 10V.
  • GND (G): Reference voltage for voltage input and
  • 3V (3V): Output voltage with a value of 3.3V
  • VU: On some models, this pin is not connected to But Lolin's V3 model provides a 5V output provided directly by USB.

Some important considerations to keep in mind:

  • The 3V3 regulator provides a maximum of So be careful what you feed the 3V3 pins.
  • The Module can be powered by either USB or Vin But it is not recommended that it occur for both at the same time.

Serial – USB Adapter

The ESP-12 provides us with two UARTs, with UART0 (pins RXD0 and TXD0) being used in programming. The NodeMCU Module integrates a Serial-USB converter that greatly facilitates our work.

The USB connector can be used for power and data communication via Serial. For this reason, it is a sufficient condition for recording the ESP8266.

A point of attention here: The RXD0 and TXD0 pins are available as GPIO pins (respectively GPIO3 and GPIO1). But they need to be used very carefully. Enabling these pins as GPIO disables USB.

Digital Pins (GPIO)

Digital pins or GPIO (General Purpose Input Output) are pins intended for binary control. It can have a HIGH or LOW state and can operate both, as an input (for reading digital states) and as a digital control (turning on LEDs, for example).

If you take a look at the nodeMCU image, you will notice that it talks about 13 GPIOs (From GPIO0 to GPIO15). So we have 13 pins for input and output control? Not exactly.

Most microcontroller pins have more than one function, this function is defined through registers. In the case of NodeMCU, some GPIOs are already in use. And if we configure it as a digital pin, we lose some functionality.

Let's look at it on a case-by-case basis:

  • GPIO4 and GPIO5: Starting with the easiest. These two have only the GPIO function. It can operate as Input or Output.
  • GPIO0 and GPIO2: These pins play a very specific role in the ESP8266 startup. For that reason, they can only operate as
  • GPIO1 and GPIO3: As we have seen, these pins are used by USB so they are not recommended for use as GPIO in
  • GPIO9 and GPIO10: ESP8266 uses an external FLASH memory chip and communicates with it with a 4-bit SDIO interface. These two pins are on the list. By default, both are used in this But it is possible to set it to 2-bit mode and release these two pins. You gain in the number of pins, but you lose in memory access speed.
  • GPIO12, GPIO13, GPIO14, GPIO15: These pins can be used in other modes, but by default, they are free GPIOs for use as Input or

Ah, an important point to mention: ESP's GPIOs operate at 3.3V.

Analog Pinout

The Esp8266 only provides one analog input (ADC0 pin), and that's probably its biggest weakness.

Although the module operates with 3.3V, the analog input operates from 0 to 1V. Which significantly limits the resolution.

Main functions for GPIO in the Arduino IDE

To control the GPIOs, the Arduino IDE provides us with some functions. Among the main ones, times:

pinMode(pin, mode)

pinMode() defines the mode in which the pin will act. The possible modes are:

  • INPUT: The pin will be configured as a digital input
  • OUTPUT: The pin will be configured as digital output
  • INPUT_PULLUP: The pin will be configured as a digital input with a pull-up Here I leave a study recommendation for pull-up and pull-down circuits but simply put. It forces a value when nothing is connected to the pin. If it's a pull-up, it's HIGH, and if it's pull-down, it's LOW.

As an example, if we want to use gpio4 as an output, we will have:

pinMode(4, OUTPUT)

digitalWrite(pin, value)

The digitalWrite() function changes the value of the informed pin. Possible values are: HIGH or LOW.

As an example, if we want to change the value of gpio4 to HIGH, we will have:

digitalWrite(4, HIGH);

One point we need to note is that there is an expected logical sequence to control the pin. First, we define it as OUTPUT and only then send a command to change the state. But what happens if we forget to use pinMode or set it to INPUT?

For these cases, the digitalWrite() command automatically enables the INPUT_PULLUP mode. This procedure protects the microcontroller from short circuits.

digitalRead(pin)

The function reads the digital value of the selected pin, returning the HIGH or LOW value. As an example, to read the status of gpio4, we will have:

value = digitalRead(4)

Of course, the value variable needs to be declared before it can be used. And if the pin is not connected to anything, the value will vary randomly (unless pullup is enabled).

analogRead(pin)

This function reads the analog pin. Or almost. The function returns a value between 0 and 1023, with 0 being the equivalent of the GND voltage and 1023 being the value referring to the VCC.

As an example, to read the status of adc0, we will have:

value = digitalRead(A0)

Constants

There are some predefined constants to refer to the pins more practically. When using either function, you can use either the gpio number or the related constant.

Differences in other modules

Here we look at the pin arrangement of the nodeMCU Lolin V3 board. There are slight differences on other cards. In Lolin itself there are versions with the ESP-12E module and others with ESP-12F. In this case of Lolin, the most significant difference is a change of position between GPIOs 4 and 5.

ESP8266 Pinout, Datasheet, Features & Applications

Hello friends! Hope you are doing well. Today, we will have a look at the detailed Introduction to ESP8266 WiFi module. ESP8266 is a very low-cost & user-friendly WiFi module, which develops a simple TCP/IP connection and can easily be interfaced with microcontrollers via Serial Port. The first chip in this series was ESP-01 which gained sheer attention in the market. In this tutorial, we will discuss the ESP8266 WiFi module along with its pinout, features, specifications, applications and datasheet. Let's dive in and nail down everything related to this device.

ESP8266 WiFi Module

  • ESP8266 (also called ESP8266 Wireless Transceiver) is a cost-effective, easy-to-operate, compact-sized & low-powered WiFi module, designed by Espressif Systems, that supports both TCP/IP and Serial Protocol.
  • It's normally used in IOT cloud-based embedded projects and is considered the most widely used WiFi module because of its low cost and small size.
  • It runs at an operating voltage of 3V and can handle a maximum voltage of around 3.6 V, so an external logic level converter is required if you are using 5V supply.
  • ESP8266 WiFi module can easily be interfaced with microcontrollers board (i.e. Arduino UNO) via Serial Port.
  • There are numerous breakout boards available based on ESP8266 WiFi Module (i.e. ESP8266 NodeMCU V3).
  • Beause of its compact size, its mostly used in autonomous projects (i.e. Robotics).
  • Other than ESP8266, "Espressif Systems" has designed many other ESP WiFi modules, few of them are shown in below figure:
Now let's have a look at the ESP8266 Pinout, necessary for interfacing with microcontrollers.

ESP8266 Pinout

  • ESP8266 Pinout consists of 8 pins in total, which are given in below table along with their operation:
ESP8266 Pinout
No. Pin Name Working
1 RX Serial Receiver Pin
2 Vcc Power Pin (+3.3 V; can handle up to 3.6 V)
3 GPIO 0 General-purpose I/O No. 0
4 RST Reset
5 CH_PD Chip power-down
6 GPIO 2 General-purpose I/O No. 2
7 TX Serial Transmitter Pin
8 GND Ground
  • Each pin comes with a specific function associated with it where Vcc and GND are voltage source and ground respectively.
  • RX and TX are used for communication where TX is dedicated for data transmission and RX is used receiving data.

ESP8266 Datasheet

  • You can download ESP8266 Datasheet by clicking the below button:
Download ESP8266 Datasheet

ESP8266 Features

  • It is also known as a system-on-chip (SoC) and comes with a 32-bit Tensilica microcontroller, antenna switches, RF balun, power amplifier, standard digital peripheral interfaces, low noise receive amplifier, power management module and filter capability.
  • The processor is based on Tensilica Xtensa Diamond Standard 106Micro and runs at 80 MHz.
  • It incorporates 64 KiB boot ROM, 80 KiB user data RAM and 32 KiB instruction RAM.
  • It supports Wi-Fi 802.11 b/g/n around 2.4 GHz and other features including 16 GPIO, Inter-Integrated Circuit (I²C), Serial Peripheral Interface (SPI), 10-bit ADC, and I²S interfaces with DMA.
  • External QSPI flash memory is accessed through SPI and supports up to 16 MiB and 512 KiB to 4 MiB is initially included in the module.
  • It is a major development in terms of wireless communication with little circuitry. and contains onboard regulator that helps in providing 3.3V consistent power to the board.
  • It supports APSD which makes it an ideal choice for VoIP applications and Bluetooth interfaces.

How to Power Up the Module

  • You can power up the device with PC port using USB to Serial adaptor. The 2 AA  and LIPO batteries are equally handy for powering up the device.
  • It is advised to not power this device directly with 5V dev board. Doing so can severely affect the quality and overall performance of the device.

ESP8266 NodeMCU

  • There are numerous breakout boards designed by different companies, based on this ESP8266 WiFi module.
  • Among these breakout boards, ESP8266 NodeMCU is the most popular one.
  • Here's the Pinout Diagram of ESP8266 NodeMCU:

ESP8266 Projects & Applications

ESP8266 WiFi module is widely used in embedded projects and thus brings WiFi capability. Here's few ESP8266 Projects & Applications:
  • Wireless Web Server
  • Geolocation using ESP8266
  • Pressure Sensors on Railway Tracks
  • Air Pollution Meter
  • Temperature logging system
  • World’s smallest IoT project
  • Wi-Fi controlled robot
  • Humidity and temperature monitoring
  • M2M using ESP8266
That's all for today. I hope I have given you everything you needed to know regarding this WiFi module. If you are unsure or have any question, you can ask me in the comment section below. I'd love to help you in any way I can. You are most welcome to keep us updated with your suggestions so we keep providing quality work that resonates with your needs and demands. Thanks for reading the article.
Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir