How to use NodeMCU Module having ESP8266 with Arduino Software

This blog will demonstrate how to use NodeMCU (which is having ESP8266 module on it) with Arduino Software.

I am assuming that before trying your hand on this tutorial, you might already have done the basic things on Arduino like Basics of ArduinoBlinking LED or LCD Display etc. If not, please go through those basic tutorial before moving forward.

What is NodeMCU or ESP8266 ?

The ESP8266 is a low-cost Wi-Fi chip with full TCP/IP stack and MCU (Micro Controller Unit) capability produced by Espressif Systems. This ESP8266 can be directly used with Arduino UNO or Arduino Mega or any Arduino Boards. It needs to be connected properly to the Arduino Board and Arduino needs to be programmed accordingly.

Whereas NodeMCU is an open source firmware and development kit that helps us to create IoT platform. It includes firmware which runs on the ESP8266 WiFi SoC from Espressif Systems and hardware which is based on the ESP-12 module. NodeMCU can be directly programmed using Arduino Software.

P.S: With NodeMCU in hand, you do not need to have Arduino UNO or Arduino Mega Boards. You can simply program NodeMCU board using Arduino Software using USB cable. However, Small changes in Arduino Software needs to be done so that NodeMCU Module can be programmed using Arduino Software. NodeMCU is very cheap and can be bought in less than 500 Rs. Only.  This is a very good solution for IoT application in a very cheap price. Buy it here NodeMCU WiFi Development Board.

Configuring Arduino Software to program NodeMCU module

Step 1: Connect NodeMCU development board using USB Cable with PC  as shown below

nodemcu-connection

Fig 1: NodeMCU connected to PC via USB cable

Step 2:Open Arduino Software, Click on Tools -> Board -> Board Manager

If ESP8266 is installed then you will see all the boards related to ESP8266 modules in the list, if not then click on Board Manager.

boardmanager

Fig 2: List of all the Boards on Arduino Software

Step 3: Install esp8266 libraries

After clicking on Board Manager, a new window will pop up. Search esp8266 there and install all the libraries related to esp8266, it may take few minutes in installing all libraries.

esp8266

Fig 3: Install the esp8266 libraries on Arduino Software (it may take few minutes)

Step 4:Select correct NodeMCU board and PORT number

after completing the installation, select correct board from the available esp8266 module list and also the correct port number as shown below (in my case it is NodeMCU 1.0 – ESP 12E Module and COM 6)

nodemcuconnect

Fig 4: Select correct esp8266 module and Port number

LED Blinking Program on NodeMCU Board

After following steps given above, now your NodeMCU board can be used like an Arduino board and you can program it using Arduino Software. Let us try small LED blinking program on Node MCU which we have done on Arduino UNO board.

This is a very basic program for blinking of an LED (p.s. NodeMCU board does not have LED on pin 13 like Arduino UNO Board, it has to be connected via a wire)

You can copy and paste whole program from here.

Compile it and Upload it on NodeMCU Board and observe the output on pin 13.

// Program starts here

#define LED_PIN 13
void setup() {
// put your setup code here, to run once:
pinMode( LED_PIN, OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LED_PIN, HIGH); // Turn on the LED.
delay(1000); // Wait 1 second (1000 milliseconds).
digitalWrite(LED_PIN, LOW); // Turn off the LED.
delay(1000);

}

// Program ends here

– Signing Off, Arduino Novice

Please do follow my Blog and subscribe to my Youtube Channel for more demos and videos related to Arduino.

Advertisements

One thought on “How to use NodeMCU Module having ESP8266 with Arduino Software

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s