Nodemcu ESP8266 | Setup of Arduino IDE for NodeMCU

Today we are going to see what is Nodemcu, how to use Nodemcu, how Nodemcu works, Nodemcu pin configurations, etc.
Hello guys! Welcome back to my blog today we are going to learn about Nodemcu in detail, so let’s begin.

What is Nodemcu ESP8266??

Nodemcu is an open-source development board used to build embedded & IoT-based Applications that required internet-based connectivity. Nodemcu consists of firmware that runs on the ESP8266 Wi-Fi SoC from Espressif Systems, and hardware that is based on the ESP-12 module. The ESP8266 was designed and manufactured by Espressif Systems.ESP12E has ESP8266 as a microprocessor which is 32-bit with a clock frequency of 80 MHz & in-built Wi-Fi features. Nodemcu has a flash memory of 4MB with SRAM of 128 kb & EEPROM of 512 bytes. It also has ADC analog-to-digital conversion (10-bit ADC). NodeMCU ESP8266 has control pins such as Enable pin (EN) – when pulling to low the board operates with minimum power, WAKE pin – to wake the board at the time of interrupt when the board is in sleep mode, RST pin – to reset Nodemcu board. ESP8266 has two modes station mode (STA) mode and Access point (AP) mode. In station mode, Nodemcu ESP8266 connects with the WIFI network present in the surrounding, whereas in Access point Nodemcu ESP8266 creates its own WIFI network, and surrounding devices can join or connect to this network created by ESP8266. NodeMCU ESP8266 acts as a hub to connect one or more stations.

nodemcu esp8266

Nodemcu ESP8266 development board can be programmed using C/C++ and micro python. We can make robotics, IoT-based Development, and prototyping projects easy just like Arduino boards with only the difference of network-based projects. Because of WIFI features, data transmission between devices or client-server is fast, secure, and low power-consuming. More than half of the IoT projects use NodeMCU boards and their popularity is increasing daily. “NodeMCU” combines “node” and “MCU” (micro-controller unit). 

NodeMCU is an open-source firmware and development kit based on the ESP8266 Wi-Fi module. The ESP8266 is a low-cost, Wi-Fi-enabled microcontroller that can be used in a wide range of electronics and Internet of Things (IoT) projects. NodeMCU provides a complete environment for developing applications and projects using the ESP8266, including an interactive Lua scripting environment, a built-in web server, and a range of built-in libraries for interfacing with electronic components and sensors.

NodeMCU is designed to be easy to use and accessible to beginners, while still providing advanced features and capabilities for experienced developers. It is compatible with a range of development tools and platforms, including the Arduino IDE and the Eclipse IDE, making it easy to integrate into existing workflows and projects.

NodeMCU is commonly used in DIY home automation systems, IoT devices, sensor networks, and other electronic projects that require Wi-Fi connectivity and low-level hardware control. It is also used in education and teaching environments to teach basic programming concepts and electronics.

The ESP8266 is a highly integrated Wi-Fi SoC (system on a chip) that includes a high-performance CPU, Wi-Fi radio, and other necessary components. It has low power consumption and can be powered by a variety of sources, including batteries and USB.

Overall, NodeMCU is a powerful and flexible platform for developing Wi-Fi-enabled electronics and IoT projects using the ESP8266 microcontroller. It provides a complete environment for development, including a scripting language, a built-in web server, and a range of built-in libraries and tools, making it easy to get started with electronics and IoT projects.

 

Types of development boards that consist of ESP8266
  • WEMOS D1 R2 Wi-Fi
  • WEMOS D1 MINI
  • NodeMCU
  • Mega Wi-Fi R3 Atmega2560
  • ESP8266 Thing Dev Board
Various ESP8266 versions

  • ESP-01
  • ESP-02
  • ESP-03
  • ESP-04
  • ESP-05
  • ESP-06
  • ESP-07
  • ESP-08
  • ESP-09
  • ESP-10
  • ESP-11
  • ESP-12E
Different types of ESP boards use in Internet of Things Applications

  • ESP8266 Modules (ESP-01 to ESP-14): These are the original modules based on the ESP8266 chip. They vary mainly in the number of available GPIO pins and the amount of flash memory.
  • NodeMCU: This is a development board based on the ESP-12E version of the ESP8266. It's particularly user-friendly because it can be programmed directly via USB using the Lua scripting language or the Arduino IDE.
  • WeMos D1 Mini and D1 Mini Pro: These are compact development boards based on the ESP8266. The D1 Mini Pro has an additional external antenna connector for increased range.
  • ESP32 Modules: The ESP32 is a more powerful chip than the ESP8266, and it includes Bluetooth as well as Wi-Fi. Like the ESP8266, it comes in a variety of module types, including the ESP-32S and ESP-32C.
  • NodeMCU-32S: This is a development board based on the ESP32 chip. It's similar in concept to the NodeMCU board for the ESP8266.
  • ESP32-CAM: This is a small ESP32-based board that includes a camera, making it great for projects involving taking photos or streaming video.
  • ESP32 WROVER: The ESP32-WROVER is a powerful, generic Wi-Fi+BT+BLE MCU module that targets a wide variety of applications, ranging from low-power sensor networks to the most demanding tasks, such as voice encoding, music streaming, and MP3 decoding. It features a 4 MB of SPI Flash and an additional 8 MB SPI Pseudo static RAM (PSRAM).
  • TTGO T: Display ESP32: This development board features a built-in 1.14-inch TFT display, in addition to Wi-Fi and Bluetooth, making it suitable for applications that need a simple user interface.

Nodemcu ESP8266 Pin configuration 

esp8266 nodemcu

Nodemcu has 16 general-purpose input-output (GPIO) pins & 1 Analog pin to measure analog voltage in the range of 0-3.3v means Nodemcu has a power consumption of 3.3 volts. Nodemcu has a reset button to restart the Nodemcu & flash button to program the esp8266 chip but usually, we don’t need a flash button as we have a micro USB to program esp8266 also Nodemcu board contains an onboard USB TTL Converter IC to program esp8266 & Power on the board. The Nodemcu board has a Voltage regulator to main 3.3 voltage across the Nodemcu board.

Nodemcu ESP8266 has a built-in LED connected to the D4 pin of the board along with a Wake pin which is a D0 pin that is used to wake the Nodemcu board from deep-sleep Mode.  Nodemcu uses various communication protocols such as four pins for SPI communication (Serial Peripheral Interface), two UART (Universal Asynchronous Receiver/Transmitter) Interfaces UART0 (RXD0 & TXD0) and UART1 (RXD1 & TXD1). Nodemcu also provides I2C communication functionality. For I2C communication Nodemcu has GPIO 5 (D1) for SCL and GPIO 4 (D3) for SDA pins, for SPI communication we have GPIO 14 for SCLK.

The VIN pin in Nodemcu can be used to directly supply the ESP8266 to power the ON board.  NodeMCU can be powered or turned ON using a Micro USB jack and VIN pin (External Supply Pin) such as a 9v battery. Nodemcu has an operating voltage of 3.3v & a current consumption between 15 µA to 400 mA. Under deep sleep conditions, Nodemcu has a very low current consumption of 0.5 µA.

Nodemcu has three sleep modes which are modem sleep, light sleep, and deep sleep. In simple terms sleep mode means a configuration in which Nodemcu consumes less power to carry out its operations. If your project uses a battery or power bank for driving or to provide power to the NodeMCU board then you will notice the battery is draining faster because of WIFI. So we use different sleep modes to maximize the life of the battery. It reduces the power consumption of the battery. In deep sleep mode, NodeMCU sleeps and wakes up due to interrupts or timers.

Nodemcu ESP8266 Sleep Modes:

  •  Active mode

It is a default mode or normal mode. In this mode NodeMCU ESP8266 is powered ON, the CPU is functioning, and WIFI is enabled it can receive, and transmit the data. This mode consumes more.

  • Modem-sleep mode: 

In this mode, the CPU is operational state means the CPU is ON and the Wi-Fi is disabled. This mode is used in applications where data transfer only takes place through digital pins in CPU ON condition only and no WIFI is needed. It makes the Wi-Fi station mode disable while connected with the Wi-Fi AP (Access Point) with no data transmission to optimize power consumption.

  • Light-sleep mode: 

In this mode, the CPU, its clock, and all peripherals are terminated means it is not operational conditional. NodeMCU ESP8266 will wake up at the time of external interrupts since it cannot respond to signals and interrupts from internal peripherals because of CPU stoppage. Without data transmission, the Wi-Fi Modem circuit can be turned off and the CPU suspended to save power consumption.

  • Deep-sleep mode:

 It is the lowest power consumption mode. In this mode only the RTC is functional and all other components of the chip are powered off. CPU, Clock, Peripherals, and Wi-Fi all are terminated to achieve minimum power consumption. This mode is useful when the data is transmitted after long time intervals. Data transfer is not very frequent and the CPU is idle most of the time. For Example, NodeMCU wakes for some time within a certain time interval sends the data over Wi-Fi then again goes into deep sleep mode.

Parameters Modem-sleep Light-sleep Deep-sleep
Wi-Fi OFF OFF OFF
Clock ON OFF OFF
CPU ON OFF OFF
RTC ON ON ON
Power Consumption 15 mA 0.9 mA ~20 µA

Features of Nodemcu esp8266

  • Fast Processor & Memory
  •  On board WIFI feature
  • Inexpensive board
  • Smaller in Size
  • Low power consumption
  • Use in Network projects
  • Works with existing Arduino IDE
  • Simple, smart & interactive board

Nodemcu ESP8266 Specifications

  • Microcontroller: ESP8266
  • Operating Voltage: 3.3V
  • Input Voltage: 7-12V
  • Digital I/O Pins (DIO): 16
  • Analog Input Pins (ADC): 1
  • Flash Memory: 4 MB
  • SRAM: 64 KB
  • Clock Speed: 80 MHz
  • UARTs: 1
  • SPIs: 2
  • I2Cs: 1
  • USB-TTL based on CP2102 is included onboard, Enabling Plug n Play
  • PCB Antenna
  • Dimensions: 4.8 x 2.5 cm
  • Micro USB: Present
  • WIFI onboard
  • 10-bit ADC (successive approximation ADC)

Advantages of Nodemcu over Arduino

  • Fast Processor & Memory
  •  On board WIFI feature
  • Smaller in Size
  • Low power consumption
  • Use in Network projects
  • Low Cost

Disadvantages of Nodemcu

  • Less number of Analog pins
  • Lower output voltage difficult to drive multiple sensor modules
  • Fewer GPIO Pins

Application of Nodemcu

  • Home automation
  • Smart plugs and lights
  • Industrial wireless control
  • Baby monitors
  • IP cameras
  • Sensor networks
  • Wearable electronics
  • Wi-Fi location-aware devices
  • Security ID tags
  • Wi-Fi position system beacons             
  • Fish & pet feeder


Arduino VS NodeMCU

Parameters Arduino Nodemcu
Microcontroller ATmega328p ESP8266
No of bits 8 bit 32 bit
Digital pins 14 16
Analog pins 6 1
Digital pin with PWM 6 16
Operating Voltage 5v 3.3v
Current Consumptions 45 mA – 80 mA 15 µA – 400 mA
Current consumption in Deep Sleep mode 35 mA 0.5 µA
Clock Speed 16 MHz 80 MHz
WIFI Absent Present
Power jack Present Absent
Micro USB Absent Present
SPI 1 2
I2C 1 1
UART 1 1
EEPROM 1024 bytes 512 bytes
SRAM 2 KB 64KB
Flash Memory 32 KB 4MB
Size Larger than Nodemcu Smaller in size
Dimensions 6.8 cm × 5.3 cm 4.8 x 2.5 cm


How to use Nodemcu with Arduino IDE (ESP 8266 setup)

1) Download Arduino IDE.

2) Open your IDE and click on File -> Preferences.


3) In Additional Boards Manager URLs add this line and click on ok

esp8266 Arduino ide

4) Go to Tools -> Board -> Boards Manager type “ESP8266” and install it.

           


5)  Go again to Tools -> Board and select NodeMCU 1.0 (ESP-12E Module)

Getting started with Nodemcu ESP 8266 using LED blink Example

D0 has an onboard LED, now we will write our first program to blink the LED, code uploading is the same as Arduino.

Code -  

void setup()
{
                    pinMode(D0, OUTPUT);
}
void loop()
{
                   digitalWrite(D0, HIGH);
                    delay(500);
                    digitalWrite(D0, LOW);
                    delay(500);
}

 

Once the code is uploaded you can see the LED is blinking with a delay of 500 milliseconds.


Conclusion –

Today we learn what NodeMCU ESP8266, types of ESP8266 development boards, Nodemcu ESP8266 pins configurations, Nodemcu specifications, Nodemcu Advantages, Nodemcu Application & features, we also learn how to configure NodeMCU ESP8266 board with Arduino IDE and write our first program to blink on-board LED.

"I hope you understand the basics of Nodemcu. In the next chapter, we will learn more about the Nodemcu board and many ESP8266-related projects in the future till then bye, see you in my next blog."

Close Menu