Introduction
In today’s article, we will be discussing the ESP 12E board which is one of the most used Espressif systems boards. After the introduction of this board, it revolutionized the IoT segment.
The ESP 12E board by AI thinker is a Wi-Fi module which is based on the ESP8266EX SoC which is the Wi-Fi chip that supports TCP IP protocol and is based on Tensilica L106 diamond 32-bit processor and an integrated Wi-Fi MAC. It is the baseboard for NodeMCU.
In today’s articles, we will be discussing the pin out of ESP 12E, its pinout description, and the programming of the board.
Board Components
- Microprocessor – As mentioned earlier the ESP-12E is based on the Tensilica L106 diamond 32-bit processor.
- ESP8266EX SoC – ESP8266EX SoC is a wifi chip that is available on the board and can go up to 80 – 240 MHz of frequency.
- Antenna – ESP 12E has an in-built antenna that is used for connecting the board to wifi connectivity. The presence of an inbuilt antenna helps in simplifying the design by eliminating the need for an external antenna.
- Memory – The ESP 12E board comes with 4 MB of embedded SPI flash memory which is needed for storing the program and firmware.
- Power LED – There is an inbuilt power led present in the ESP 12E module which is red in color and it will start blinking when the board is connected to a power supply.
- Interfaces – The ESP 12E has several communication and data transfer interfaces available which are UART, SPI, I2C, I2S etc.
Board Features
Board | Arduino ESP 12E |
Microcontroller | NodeMCU ESP8266 |
Antenna | 1 |
Flash memory | 4MB |
Board Dimension | 16mm x 24mm x 3mm |
Weight of the board | 1.72 gm |
I/O port | 17 |
ADC channels | 1 |
Interfaces | SDIO 2.0, SPI and UART |
PWM Pins | 4 |
Power Consumption OF ESP 12E
Power Supply | 2.2-3.6v |
Current Consumption | 70.5 mA |
I/O Voltage | 0-3.3v |
I/O Source Current | 12 mA |
Modem Sleep | 15uA |
Light Sleep | 0.9uA |
Deep Sleep | <10uA |
Pinout OF ESP 12E
Pin | Function OF The Pin |
RST | Reset the Module |
EN | Active High Chip Enable Pin |
VCC | 3.3V Power Supply (max 3.6V) |
GPIO16 | Waking board from deep sleep mode |
GPIO14 | GPIO14 pin (CLK) |
GPIO12 | GPIO12 pin (MISO) |
GPIO13 | GPIO13 pin (MOSI) |
GPIO15 | GPIO15 pin (HSPI_CS) |
SDCMD | SDIO CMD (GPIO11) |
SDD0 | SDIO Data 0 (GPIO7) |
SDD2 | SDIO Data 2 (GPIO9) |
SDD3 | SDIO Data 3 (GPIO10) |
SDD1 | SDIO Data 1 (GPIO8) |
SCCLK | SDIO CLK (GPIO6) |
GND | Ground Pin |
ADC0 | ADC Pin with 10-bit resolution |
GPIO2 | GPIO2 pin (TXD1) |
Flash | Flash Pin (GPIO0) |
GPIO4 | GPIO4 pin (SDA – I2C) |
GPIO5 | GPIO5 pin (SCL – I2C) |
RXD0 | UART0 RXD pin (GPIO3) |
TXD0 | UART0 TXD (GPIO1) |
NodeMCU
The ESP8266 SoC is a cheap Wi-Fi Microcontroller with full TCP/IP Stack developed by Espressif Systems. NodeMCU is a firmware for ESP8266 which is developed using C Programming Language, Espressif NON-OS SDK and Lua scripting language.
Normally, we write code for Microcontrollers either in C or C++ programming languages and compile it to generate a binary file. The binary file is then uploaded into the flash memory of the microcontroller and it gets executed but NodeMCU firmware works as an interpreter for Lua Scripts so it will interpret the bytecode and executes the commands. There is no need of compilation, no binary file etc. We only have to write a script and run it.
Board Components OF NodeMCU
- 3.3 Voltage Regulator – There is an inbuilt voltage regulator available on the board which regulates the input voltage which is being supplied to the board.
- Boot/Flash Button – Boot/Flash button is required for entering the boot or flash mode.
- Micro USB connector – It is required for connecting the board to the 5v power supply.
- RESET Button – A RESET button is available on the board which is used to reset the board.
- USB to TTL Converter IC – The USB to TTL Converter IC is a cost-effective way to convert TTL signal a USB interface so that the board can be connected to the computer.
Pinout OF NodeMCU
Pin | Description | Alternate function | Default |
ADC0 | Analog Input | ADC0 | |
Reserved | |||
Reserved | |||
SDD3 | SDIO Data 3 | GPIO10 | SDD3 |
SDD2 | SDIO Data 2 | GPIO 9 | SDD2 |
SDD1 | SDIO Data 1 | GPIO 8 | SDD1 |
SDDCMD | SDIO CMD | GPIO 11 | SDDCMD |
SDD0 | SDIO Data 0 | GPIO 7 | SDD0 |
SDCLK | SDIO CLK | GPIO 6 | SDCLK |
GND | Ground | ||
3.3V | 3.3V output | ||
EN | Chip Enable (Active HIGH) | ||
RST | Reset (Active LOW) | ||
GND | Ground | ||
VIN | 5V Input to 3.3V Regulator | ||
3.3V | 3.3V Output | ||
GND | Ground | ||
TXD0 | UART0 TXD | GPIO 1 | TXD0 |
RXD0 | UART0 RXD | GPIO 3 | RXD0 |
GPIO15 | GPIO15 | HSPI_CS / RTS0 | GPIO15 |
GPIO13 | GPIO13 | HSPI_MOSI / CTS0 | GPIO13 |
GPIO12 | GPIO12 | HSPI_MISO | GPIO12 |
GPIO14 | GPIO14 | HSPI_SCK | GPIO14 |
GND | Ground | ||
3.3V | 3.3V output | ||
GPIO2 | GPIO2 | UART1 TXD | GPIO2 |
Flash | Flash | GPIO0 | Flash |
GPIO4 | GPIO 4 | Software SDA (I2C) | GPIO4 |
GPIO5 | GPIO 5 | Software SCL (I2C) | GPIO5 |
GPIO16 | GPIO 16 | Wake (deep sleep) | GPIO16 |
Power Pins
There are two ways available which are used for powering up the board. At first, there is the micro USB port and the Vin pin. There are three 3V3 pins available. The board gets enabled when a supply of 5v is transmitted to the Vin.
The ESP8266EX SoC is only compatible with 3.3v so there is a 3.3v regulator which is available in NodeMCU.
Enable Pin
The EN pin is the enabled pin for the board. When this pin is pulled high the EN chip is enabled and when this pin is pulled low the chip is disabled.
GPIO Pins
There are a total of 17 pins available on the board however all of them are not available for the users. Some of them are connected to SPI Flash and UART.
SPI Pins
In ESP8266EX SoC there are 2 SPI interfaces available which are SPI and HSPI. Both of the SPI interfaces perform the slave and master operations. The clock speed of slave operation is limited to 20MHz while the speed of the clock in master operation is about 80MHz.
The following table shows the pin mapping of SPI interfaces
For SPI
SCLK | GPIO 6 |
MISO | GPIO 7 |
MOSI | GPIO 8 |
CS | GPIO 11 |
For HSPI
HSPI_CLK | GPIO 14 |
HSPI_MISO | GPIO 12 |
HSPI_MOSI | GPIO 13 |
HSPI_CS | GPIO 15 |
UART Interface
There are two UART hardware available on the ESP8266EX SoC which supports the baud rates up to 115200. The two UART hardware are UART0 and UART1. The UART0 can be used for communication and it also provides data flow control.
The UART1 has only a TX pin as its RX pin is being used by SDD1. The UART1 is used for data logging. The following table shows information about the UART pin mapping
UART0 TX | GPIO3 |
UART0 RX | GPIO1 |
UART0 RTS | GPIO15 |
UART0 CTS | GPIO13 |
UART1 TX | GPIO2 |
UART1 RX | GPIO8(Not available) |
Boot Mode Selection Pins
Boot mode selection pins are listed below
GPIO 0 | GPIO 2 | GPIO 15 | Boot Mode |
Low | High | Low | UART Bootloader |
High | High | Low | Boot from SPI Flash |
× | × | High | Boot from SDIO |
Analog Input Pin
ESP8266EX SoC supports analog input in one GPIO only which is ADC0. The ADC pin is required for converting the analog signal to a digital signal. The maximum input voltage of ADC0 is 0 – 3.3v if we are using an ESP8266 12-E NodeMCU kit.
RST Pin
The function of the RST pin is the same as the onboard RESET button. If the RST pin is pulled low the ESP8266 will get reset.
GPIO0 Pin
The GPIO0 pin is used for entering bootloader mode. If the GPIO0 pin is pulled low then it will set the ESP8266 in bootloader mode. Its function is the same as the onboard Flash/Boot button.
GPIO16 Pin
GPIO16 is used for waking up the ESP8266 from deep sleep. For this purpose, GPIO16 should be connected to the RST pin.
PWM Pins
ESP8266 allows software PWM in all I/O pins: GPIO0 to GPIO15. The PWM signals on ESP8266 have a 10-bit resolution.
Interrupt Pins
The ESP8266 supports interrupts in any GPIO, except GPIO16.
How To Program NodeMCU
For programming NodeMCU click on the link given – How to program NodeMCU.
Uploading The Blinky Sketch
The code is as follows
#define ledPin1 2 /* LED connected to GPIO 2 */
#define ledPin2 16 /* LED connected to GPIO 16 */
void setup()
{
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
}
void loop()
{
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, HIGH);
delay(1000);
digitalWrite(ledPin1, HIGH);
digitalWrite(ledPin2, LOW);
delay(1000);
}
Now, click on upload and your code will be uploaded.
Frequently Asked Questions
Q1-Is NodeMCU the same as Arduino?
Ans-NodeMCU is different from Arduino as NodeMCU functions as a development board while Arduino functions as a microcontroller board.
Q2-Does NODEMCU work with wifi?
Ans-Yes, NodeMCU can work with wifi.
Q3-Can we use AT commands in NodeMCU?
Ans-NodeMCU was developed for replacing the AT commands with Lua scripting so we can not use AT commands in NodeMCU.
Q4-Can we multiplex 2 analog inputs in NodeMCU?
Ans-Yes, we can multiplex 2 analog inputs in NodeMCU using the DPDT relay.