Introduction: Getting Started W/ NodeMCU ESP8266 on Arduino IDE
In this tutorial, you will learn how to use NodeMCU on Arduino IDE.
What You Will Learn
- General information about NodeMCU
- How to install ESP8266 based boards on Arduino IDE
- How to program NodeMCU on Arduino IDE
- Introducing boards that can be used instead of NodeMCU
Step 1: What Is NodeMCU?
Today, IOT applications are on the rise, and connecting objects are getting more and more important. There are several ways to connect objects such as Wi-Fi protocol.
NodeMCU is an open source platform based on ESP8266 which can connect objects and let data transfer using the Wi-Fi protocol. In addition, by providing some of the most important features of microcontrollers such as GPIO, PWM, ADC, and etc, it can solve many of the project’s needs alone.
The general features of this board are as follows:
- Easy to use
- Programmability with Arduino IDE or IUA languages
- Available as an access point or station
- practicable in Event-driven API applications
- Having an internal antenna
- Containing 13 GPIO pins, 10 PWM channels, I2C, SPI, ADC, UART, and 1-Wire
Step 2: How to Program NodeMCU Using Arduino IDE
In order to use Arduino IDE to program the NodeMCU, you have to introduce it to the software at first.
To do this copy the following code and follow the steps below:
step1. Choose Preferences in the File menu and enter the copied code in Additional Board Manager URLs part. Then press OK.
Step2. Search the word ESP8266 in Boards>boards manager from Tools menu. Then install ESP8266 boards. After complete installation, you will see the INSTALLED label on ESP8266 boards.
After these two steps, you can see ESP8266 based boards such as NodeMCU in your Arduino IDE boards list, and you can choose your desired board to upload the code.
In order to use digital pins, you should select GPIO numbers. For example, the D7 pin is defined as GPIO13. So you should set up the pin number 13 whenever you want to use D7 in your program. Also, you can use pin D2(GPIO4) as SDA and pin D1(GPIO5) as SCL
Step 3: Controlling LED Through an HTTP Page Using NodeMCU
You can connect the internet through Wi-Fi using NodeMCU, and apply your desired commands by creating an HTTP page.
In this example, you can control an LED by pressing the ON and OFF key. Enter your modems SSID and password in the provided part and upload it on your NodeMCU board using Arduino IDE. (Leave other settings to the default)
Step 4: Code
After opening the Serial Monitor, if the Internet connection is established, you will be given the IP address of the page you have created (for example 192.168.1.18).copy and paste it in your browser to open the HTTP page.
Step 5: What Other Boards Can I Use Instead of NodeMCU?
There are various important factors for choosing the type of board for an IOT system, such as the number of GPIO pins, communicating protocols, including an antenna, and etc.
Also, there are different boards and platforms, each has its specific features.
Here we have compared them based on the most important required features for IOT projects.
Step 6: Example Projects:
- Smart Door Lock w/ WiFi Login Page by Arduino & ESP8266
- Speak to your Arduino & Control It by Google Assistant
- Play with Fire Over WIFI! ESP8266 & Neopixels (Including Android App)
- nstagram Likes Speedometer by Arduino & ESP8266
If you find this tutorial helpful and interesting please like us on facebook.