IoT & Node MCU Introduction
IoT & Node MCU Introduction
The Internet of things (IoT) is the extension of Internet connectivity into physical devices and everyday
objects. Embedded with electronics, Internet connectivity, and other forms of hardware (such as sensors),
these devices can communicate and interact with others over the Internet, and they can be remotely
monitored and controlled.
NodeMCU
NodeMCU is an eLua based firmware for the ESP8266 WiFi SOC from Espressif. The firmware is based on
the Espressif NON-OS SDK and uses a file system based on spiffs. The code repository consists of 98.1%
C-code.
The NodeMCU firmware is a companion project to the popular NodeMCU dev kits, ready-made open
source development boards with ESP8266-12E chips
ESP8266
The ESP8266 is a low-cost Wi-Fi microchip with full TCP/IP stack and microcontroller capability produced by
manufacturer Espressif Systems in Shanghai, China.
The chip first came to the attention of western makers in August 2014 with the ESP-01 module, made by a
third-party manufacturer Ai-Thinker. The successor to these microcontroller chips is the ESP32, released in 2016.
This small module allows microcontrollers to connect to a Wi-Fi network and make simple TCP/IP
connections using Hayes-style commands (also called the AT commands: "AT" meaning 'attention').
The NodeMCU programming can be as easy as in Arduino. The main difference is in the pinning of the board,
described below:
Getting Started with NodeMCU
First open the Arduino IDE
http://arduino.esp8266.com/stable/package_esp8266com_index.json
Pin Names on NodeMCU Development Kit ESP8266 Internal GPIO Pin number
D0 GPIO16
D1 GPIO5
D2 GPIO4
D3 GPIO0
D4 GPIO2
D5 GPIO14
D6 GPIO12
D7 GPIO13
D8 GPIO15
D9/RX GPIO3
D10/TX GPIO1
D11/SD2 GPIO9
D12/SD3 GPIO10
• ESP8266 is a system on a chip (SoC) design with components like the processor chip. The processor
has around 16 GPIO lines, some of which are used internally to interface with other components of
the SoC, like flash memory.
• Since several lines are used internally within the ESP8266 SoC, we have about 11 GPIO pins
remaining for GPIO purpose.
• Now again 2 pins out of 11 are generally reserved for RX and TX in order to communicate with a host
PC from which compiled object code is downloaded.
• Hence finally, this leaves just 9 general purpose I/O pins i.e. D0 to D8.
• As shown in above figure of NodeMCU Dev Kit. We can see RX, TX, SD2, SD3 pins are not mostly
used as GPIOs since they are used for other internal process. But we can try with SD3 (D12) pin
which mostly like to respond for GPIO/PWM/interrupt like functions.
Example
Let’s write an Arduino sketch for LED blinking on pin D4 of NodeMCU Dev Kit.