NodeMCU 101 - Things You Need to Know

NodeMCU is an open-source platform that enables users to create IoT devices using Lua scripting. NodeMCU has a WiFi module and allows users to program the device using the Lua scripting language. NodeMCU devices are popular among hobbyists and makers due to their low cost and easy programming.
featured image
profile_image
Tasnim Zotder
Feb 5, 2022
⏱️ 3 Minutes

About NodeMCU

NodeMCU is an open-source platform that enables users to create IoT devices using Lua scripting. NodeMCU devices are based on the ESP8266 microcontroller, which features a WiFi module and allows users to program the device using the Lua scripting language. NodeMCU devices are popular among hobbyists and makers due to their low cost and easy programming.

Applications of NodeMCU

  1. IoT applications
  2. Home automation
  3. Robotics
  4. Wearable devices
  5. Smart cars
  6. Remote monitoring
  7. Smart cities

Types of NodeMCU

There are two types of NodeMCU board.

  1. NodeMCU v0.9
  • Color: Blue
  • Chip: ESP-12
  • Pins: 16

2. NodeMCU v1.0

  • Color: Black
  • Chip: ESP-12E
  • Pins: 22

Hardware of NodeMCU

Specifications of NodeMCU

πŸ’‘
NodeMCU is a 32-bit microcontroller.
Name Value
Microcontroller Tensilica 32-bit RISC CPU Xtensa LX106
Input Voltage 7-12V
Operating Voltage 3.3V
Flash Memory 4 MB
SRAM 64 KB
Clock Speed 80 MHz
GPIO Pins 16
Analog Input (ADC) Pins 1 (10-bit)
UART Pins 1
SPI Pins 1
I2C Pins 1

Components of NodeMCU

The main components in NodeMCU are πŸ‘‰

  • ESP-12E Chip
  • 2.4 GHz Antenna
  • Micro USB Connector
  • 3.3V LDO Voltage Regulator
  • Reset Button
  • Flash Button
  • USB to TTL Converter (CP2102)

Software Specifications of NodeMCU

Name Value
Programming Languages Used Lua, C++ Toolchain, Micropython, Arduino Programming Language
Popular IDEs Arduino IDE, PlatformIO, VS Code
  1. Lua: Programming in Lua for NodeMCU is like Node.js. Lua is asynchronous and event driven.
-- LED blink --

local pin = 4 -- D4
local delay = 500 -- 500 ms
local status = gpio.LOW

-- initializa pin --
gpio.mode(pin, gpio.OUTPUT)
gpio.write(pin, status)

-- led blink --
tmr.alarm(0, delay, 1, function ()
	if status == gpio.LOW then
    	status = gpio.HIGH
    else
    	status = gpio.LOW
    end
    
    gpio.write(pin, status)
end)

2. Micropython: Micropython is a software implementation of Python3. It's written on C and optimized to run on a microcontroller.

import mchine
import time

pin = 4
led = machine.Pin(4, machine.Pin.OUT)

while True:
  led.high()
  time.sleed(0.5)
  led.low()
  time.sleep(0.5)

3. Arduino Programming Language: It's similar to C++.

const int LED_PIN = 4;
const int LED_DELAY = 500;  // 500ms

void setup() {
	pinMode(LED_PIN, OUTPUT);
}

void loop() {
	digitalWrite(LED_PIN, 1);
    delay(LED_DELAY);
	digitalWrite(LED_PIN, 0);
    delay(LED_DELAY);
}

NodeMCU Setup

In Arduino IDE

Arduino IDE is an open-source IDE developed by Arduino. The Arduino IDE can be used to write programs for lots of microcontrollers including Arduino Boards, ESP8266, ESP32, Adafruit Boards, and Pi Pico Boards.

The setup process of Arduino IDE for NodeMCU is described in the following article πŸ‘‰

How to Setup Arduino IDE for NodeMCU? - Tasnim Zotder
The steps to set up Arduino IDE for NodeMCU. The sketches written for Arduino can also be used for NodeMCU with a minor modification.

Comparison Between NodeMCU and Arduino UNO

Although both NodeMCU and Arduino UNO can be used in IoT development, they have lots of differences. Some of their similarities and differences are as following πŸ‘‰

Similarities between NodeMCU Β and Arduino UNO

There are a few similarities between the NodeMCU and Arduino Uno. Both boards use a microcontroller, which is a programmable chip that can be used to control electronic devices. They also both use the Arduino IDE (Integrated Development Environment) for programming. The Arduino Uno has a few more capabilities than the NodeMCU, such as the ability to use shields, which are add-on boards that can provide additional functions, such as motor control or wireless communication. The Arduino Uno also has more input and output pins than the NodeMCU.

Differences Between NodeMCU and Arduino UNO

Field NodeMCU Arduino UNO
Creator Espressif Systems Arduino
Microcontroller ESP8266 ATmega328p
Processor 32-bit 8-bit
Processor Speed 80MHz 16MHz
SRAM 64KB 2KB
Flash Memory 4MB 32KB
Operating Voltage 3.3V 5V
Input Voltage 7-12V 7-12V
Digital I/O Pins 16 14
PWM Pins 4 6
Analog Input Pins 1 6
Wireless Communication ESP8266 SoC None
Serial Communication UART/I2C/SPI UART/I2C/SPI

References πŸ“ƒ

;
Contents
  • Blog
  • YouTube
Personal
  • Portfolio

github
twitter
linkedin
youtube
Β© Tasnim Zotder | 2022
🏑
Home
πŸ“
Blog
πŸ’‘
Portfolio