Home/Tutorials/Setting Up ESP8266 with Arduino IDE

Setting Up ESP8266 with Arduino IDE

Let’s get started with the ESP8266 and Arduino!

The ESP8266 is an excellent Wi-Fi-capable module that’s great for projects that request or send information to the internet via Wi-Fi connection.

The NodeMCU microcontroller

This device is a popular ESP8266 microcontroller: the NodeMCU. With this device we can create a:

  • Datalogger that sends sensor data to the cloud

  • Switch that can be triggered wirelessly from a smartphone

  • Much more!

Let’s learn how to set up the NodeMCU with the Arduino IDE to begin writing Arduino code with it. In this post we’ll learn:

  • How to install ESP8266 based boards on Arduino IDE

  • How to upload code to the NodeMCU

How to install ESP8266 based boards on Arduino IDE

Before we actually go on about programming the ESP8266, we need to install the necessary packages to make it compatible with the Arduino IDE. Let’s begin.

Step 1

First, copy the link below:

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

Step 2

Next, open the Arduino IDE and go under File -> Preferences

Then paste that link into the “Additional Boards Manager URLs: ” textbox, then click “OK”.

Step 3

Now go to Tools -> Board -> Boards Manager…

Type in “esp8266” in the search box and hit enter. The following result by the “ESP8266 Community” will show. Install this boards package.

That’s it! That’s all it took to set up all the ESP8266 boards with Arduino IDE. Now let’s try uploading a basic Blink sketch to a NodeMCU.

How to upload code to the NodeMCU

Now let’s upload a simple Blink sketch to our NodeMCU. First, connect your NodeMCU to your computer and select “NodeMCU 1.0 (ESP-12E Module)”.

Next, select the Port of the connected NodeMCU.

The following pinout diagram shows all the pin positions of the NodeMCU.

Each digital pin has a corresponding GPIO number. Therefore, if you would like to connect a blinking LED to digital pin 0 on the NodeMCU, you can refer to it as “D0” or “16” in the Arduino IDE.

The following is a breadboard circuit of the NodeMCU performing the Blink sketch.

Here the is Blink sketch referring to the D0 pin:

Copy to Clipboard

This is exactly the same as referring to GPIO 16:

Copy to Clipboard

Now click the “Upload” button at the Arduino IDE toolbar.

And after a short while, the code will be uploaded to your NodeMCU and it will begin to blink the LED!

By |Published On: October 18th, 2021|Categories: Tutorials|

Share This Article

Leave a Comment

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments