Introduction

NodeMCU is a low cost open source IoT platform. It has firmware which runs on the inbuilt ESP8266 Wi-Fi module from Espressif Systems, and a hardware which is based on the ESP-12 module. The term “NodeMCU” refers to the firmware rather than the development kits. Lua scripting language is the programming language used to program NodeMCU. This is based on  eLua project, and built on the Espressif Non-OS SDK for ESP8266. NodeMcu can be programmed using Arduino IDE.

History of NodeMCU

NodeMCU was created after the ESP8266 WiFi module came out. On December 30, 2013, Espressif Systems started to manufacture ESP8266. The ESP8266 is a Soc with Wi-Fi  and a Tensilica Xtensa LX106 core integrated with it for  IoT applications. NodeMCU started on 13 Oct 2014, Hong submitted the first file of nodemcu-firmware to GitHub. Two months later, Huang R expanded this project as an open-hardware platform the gerber file of an ESP8266 board, named devkit v0.9. NodeMCU was able to support the MQTT IoT protocol, using Lua to access the MQTT broker.

Programming NodeMCU Using Arduino IDE:

In this blog post we will learn how to program NodeMCU module using Arduino IDE. If you’re new to NodeMCU and Arduino IDE learn some basic programming structure from here https://www.arduino.cc/ .

First of all I thank the guys who ported the ESP8266 into Arduino IDE and helping us to programming faster without much knowledge on programming. Let us begin with Installing  ESP8266 support into Arduino IDE.

Installing ESP8266 Support:

Step1: 

Install latest Arduino IDE from the arduino web site https://www.arduino.cc/en/Main/Software . The arduino IDE should be above versoin 1.6 and above.

Step2:

After installing the software open it and go to File -> Preference. Paste the following url in the Additional boards Manager

http://arduino.esp8266.com/stable/package_esp8266com_index.json

and then click OK to close the preference Tab.

Step3:

After completing the above steps, go to Tools -> Board-> Board Manager and search for esp8266 by esp8266 community and install the software for Arduino IDE.

Once all the above steps has been completed correctly. We are now read to program our esp8266 with Arduino IDE.

LED Blinking Using NodeMCU:

For this example we have used “IPCS NodeMCU Training Board v1.0” which is Embedded with LoLin NodeMCU Module ver 0.1.

Connect “IPCS NodeMCU Training Board v1.0” using USB cable into your laptop or desktop. It required CH340 driver which can be download from https://sparks.gogo.co.nz/ch340.html. Now note down the COM port assigned to the NodeMCU module in your system.

Select Tools -> Board as  NodeMCU 1.0 (ESP-12E Module) , CPU Frequency as 80MHZ, Flash size as 4M(3M SPIFFS),  Upload speed as 115200(this is default uploading speed in NodeMCU don’t confused with Serial communication baud rate) and select the correct COM port to run the program on your esp8266 device..

Connect D0 to a led in IPCS NodeMCU Training board using jumper wire.  Use the following led blink code for testing

int ledpin=D0;

void setup(){

// initialize digital pin D0 as an output.

pinMode(ledpin,OUTPUT);

}

// This loop function runs again and again forever

void loop() {

digitalWrite(ledpin,HIGH);    //Turn the LED on

delay(1000);    //wait for a second

digitalWrite(ledpin,LOW);     //Turn the LED on

delay(1000);    //wait for a second

}

 

Finally upload the program and see the results.