ESP8266: Install Arduino IDE for the ESP32 – Tutorial

The ESP8266/NodeMCU is a small and inexpensive microcontroller with an integrated wireless LAN module, which is particularly popular in the field of home automation. In addition to programming using the “Lua” language, the ESP8266 can also be programmed with the classic Arduino IDE (with C ++ and other modules).

Since many published libraries for the NodeMCU were written in C ++, we need the IDE that was originally provided for the Arduino. This IDE also supports the ESP8266 thanks to an extension. This tutorial is about the exact installation and a first test. In addition, we test the ESP by writing a small program that lights up an LED and connects to a wireless LAN network.

One of the advantages of the ESP32 compared to a (mini) Arduino is the integrated wifi chip. While the Arduino can only have a lot added via a shield, the ESP8266 offers this by default and has a lower price. So overall there are some good reasons for an ESP8266.

 

Required Hardware Parts

The ESP8266 is available in different versions. All models have a built-in W-LAN adapter and the cheaper the model, the fewer programmable GPIO pins the microcontroller has. You can find an overview in this article.

So that we can easily program the NodeMCU via USB, we use an ESP32. The additional LEDs are only there if you want to run the IO pin test at the end of the tutorial.

 

Preparing the ESP8266 Arduino IDE

The basis is the official Arduino IDE, which you can download here. There are versions for Windows (from XP), Mac OS and various Linux distributions (also for ARM architecture).

So download and install the IDE. After that, it may start automatically – if not, we start it manually. This creates initial configurations and folders. Under Windows 10 this is among others “C: Users [username] Documents Arduino”. You can find this directory by opening the Arduino IDE and selecting “File” -> “Preferences” (Sketchbook location).

Then we still need a Git client. This is already pre-installed on most Linux systems. Git-SCM can be used for Windows (but also for Mac and Linux). Download and install this tool as well. Then you will see the following UI:

Install ESP8266 Arduino IDE for the ESP32 - Git SCM

Select “Clone Existing Repository”. The following must be entered in the following dialogue:

Install ESP8266 Arduino IDE for the ESP32 - Git SCM Clone

Here again to copy (replace [username] with your Windows user name. On other systems you have to adapt the path accordingly. Then press “Clone”).

https://github.com/espressif/arduino-esp32.git
C:/Users/[username]/Documents/Arduino/hardware/espressif/esp32

In the latter directory, there is a subfolder “tools”. Inside there is a file called “get.exe”. We do this with a double click:

Install ESP8266 Arduino IDE for the ESP32 - CMD

The window closes automatically after the download is complete.

Now it is time to connect the ESP32 to the PC via USB. Wait a moment until all necessary drivers have been installed and then start the Arduino IDE.

Further Installation Steps

Open the IDE and go to “File” -> “Preferences”. There you paste the following URL (Additional board administrator URLs):

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

Then you can search for “ESP8266” under “Tools” -> “Boards” -> “Boardmanager” (at the top) and install the package.

Install ESP8266 Arduino IDE for the ESP32 - Additional Installation

Under “Tools” -> “Board” select the “Generic ESP8266 Module”. If you have not connected any other devices, the COM port should have been automatically recognized correctly.

Now you can already upload a simple (empty) sketch.

 

Connection and First Test of the NodeMCU Using the Arduino IDE

Now that we have set up the ESP8266 Arduino IDE, we will write the first little C ++ code with which we will light up an LED. Now connect the ESP microcontroller to the breadboard and take a small LED with the color of your choice. This has two ends: the positive voltage (+) comes to the longer end and the shorter end is connected to ground (GND).

For larger circuits, you usually use transistors or relays, but in this case, the current from one IO pin is enough to make the LED light up. If you want, you can also add a button so that the LED only lights up when the button is pressed. But we won’t go into that in more detail for now (that could be a small additional task 😉 )

ESP8266 NodeMCU Button breadboardIt is important to note that the D3 pin is not the pin that we specify, but corresponds to this GPIO-0. Here you will also find all GPIO pins of an ESP32 Dev module:

scheme

 

Insert the following code into the Arduino IDE and press the “Upload” button.

The ESP8266 will restart automatically and the LED will start flashing.

You can find the complete log (serial output) “Tools” -> “Serial Monitor” or by pressing CTRL + Shift + M.

 

By the way: You can find many other smaller ESP8266 examples for the Arduino IDE in this Github repository.

Leave a Comment

Your email address will not be published.

Subscribe to Raspberry Pi Tutorials and don't miss any new Tutorial!