Skip to content

Using NODEMCU – ESP8266 Wifi with Arduino IDE for IoT Projects and Experiments.

Note: This article is nothing but my experimental/learning log.  Since it is not related to any serious research or research simulation, no further support will be provided on this area. So, please do not ask any questions through e-mail regarding this article or related to this area – simply you will not get any answers from me.

 

This article is nothing but my own learning log. For detailed information, one may follow the complete articles cited in the reference section particularly the one from[2].  This article follows the guidelines from[2] and explains the way of programming NODEMCU – ESP8266 Wifi Development Board Version.1.0 with Arduino IDE for IoT-related Projects and Experiments. We thank the authors of [2] for providing such a good tutorial on this. The images of the  NODEMCU – ESP8266 Wifi Development Board were taken from [2].

 

NODEMCU – ESP8266 Wifi Development Board

NodeMCU is a IoT Module based on ESP8266 wifi Module. NodeMCU uses Lua Scripting language and is an open-source Internet of Things (IoT) platform. This module has CH340g USB to TTL IC.

 

As shown in the following diagram from [2], this development board has a built-in WiFi module that makes this board special.

 

 

ESP8266 NodeMCU Hardware Specifications - ESP-12E Chip

 

Brief Features and Specification of Node-MCU IoT Module[1] :-

  • It is based on ESP8266, integrates GPIO, PWM, IIC, 1-Wire and ADC all in one board.
  • Powers your development in the fastest way combinating with NodeMCU Firmware
  • USB-TTL included plug&play
  • 10 GPIO, every GPIO can be PWM, I2C, 1-wire
  • Features of Node-MCU IoT Module:-
  • Open-source IoT Platform
  • Easily Programmable
  • Low cost & Simple to Implement
  • WI-FI enabled

ESP8266 NodeMCU Pinout[2]

The ESP8266 NodeMCU has total 30 pins that interface it to the outside world. The connections are described at[2] as follows:

 

ESP-12E Development Board ESP8266 NodeMCU Pinout

 

 

Installing Arduino IDE and  necessary components

Step 1: Installing Arduino IDE

First, from[3], install the latest version of Arduino IDE on your computer with respect to the operating system that you are using.

 

Step 2: Installing necessary components in Arduino IDE

Start the Arduino IDE and you may open the example “Blink”

 

 

Step 3: Set Additional Board Manager URL

From the menu File -> Preferences, set the set the Additional Board Manager URL as
http://arduino.esp8266.com/stable/package_esp8266com_index.json”

 

 

Step 4: Installing the Components needed for ESP8266

From the menu Tools -> Boards -> Board Manager, select ESP8266 by ESP8266 Community and install it.

 

 

Step 5:  Select the NodeMCU board as follows:

Select the NodeMCU 1.0 from the Menu  Tools -> Board -> ESP8266 Boards -> NodeMCU 1.0 as follows

 

 

Step 6: Set the Serial Port

Now connect the board to the computer using a suitable micro USB connector cable.

From the menu Tools -> Port, select the appropriate serial port in which the board is connected now.

 

 

Step 7: Program the Board

The following is the example program provided along with the Arduino IDE:

/*
Blink

Turns an LED on for one second, then off for one second, repeatedly.

Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
the correct LED pin independent of which board is used.
If you want to know what pin the on-board LED is connected to on your Arduino
model, check the Technical Specs of your board at:
https://www.arduino.cc/en/Main/Products

modified 8 May 2014
by Scott Fitzgerald
modified 2 Sep 2016
by Arturo Guadalupi
modified 8 Sep 2016
by Colby Newman

This example code is in the public domain.

http://www.arduino.cc/en/Tutorial/Blink
*/

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

Now you may try programming the board by selecting a simple example sketch such as “Blink”.  On successful compiling and uploading, you will end up with a screen like this :

 

On successful upload of the “Blink” example sketch, now the board will start to blink as shown in the following gif image taken from [2]

ESP8266 NodeMCU Blink Sketch Working Arduino IDE

Conclusion

NODEMCU – ESP8266 Wifi Development Board is a good board to start with our IoT-related projects and experiments. We may see the way of programming and using the on board WiFi in our another article. It is possible to implement the LoRaWAN project using a suitable, real IoT Board

It is possible to do serious research work by making these IoT devices to communicate with a running ns-3 simulation (with some emulated ns-3 nodes). This makes it possible to do sensor network-related research simulations with a lot of emulated and real nodes. In that case, researchers are advised to read the following article :

Sending ICMP Traffic From an ns-3-FdNetDevice Node to a Real Host Over a Real Channel

References

  1. https://www.electronicscomp.com/nodemcu-esp8266-wifi-development-board?gclid=Cj0KCQiAzeSdBhC4ARIsACj36uE74c0HGkBNuDAdcomKzsEE9ozera1eImMwsORM3GwR2bpUqdYxFwYaAvciEALw_wcB
  2. https://lastminuteengineers.com/esp8266-nodemcu-arduino-tutorial/
  3. https://www.arduino.cc/en/software
WhatsApp Discuss Through WhatsApp