-Tutorial by Rui Santos, RandomNerdTutorials
(Edited by TechToast)
There is a new Arduino IDE—Arduino IDE 2.0 (beta version). In this tutorial, you’ll learn how to install the ESP32 boards in Arduino IDE 2.0 and upload code to the board. This tutorial is compatible with Windows, Mac OS X, and Linux operating systems.
Accordingly to the Arduino website: “The Arduino IDE 2.0 is an improvement of the classic IDE, with increased performance, improved user interface and many new features, such as autocompletion, a built-in debugger and syncing sketches with Arduino Cloud“.
If you want to install the ESP32 boards on the “classic” Arduino IDE, follow the next tutorial instead:
If you prefer programming the ESP32 using VS Code + PlatformIO, go to the following tutorial:
You might also like reading the ESP8266 Guide: Installing ESP8266 NodeMCU Board in Arduino 2.0 (Windows, Mac OS X, Linux)
Prerequisites: Arduino IDE 2.0 Installed
Before proceeding make sure you have Arduino IDE 2.0 installed on your computer.
Go to the Arduino website and download the version for your operating system.
- Windows: run the file downloaded and follow the instructions in the installation guide.
- Mac OS X: copy the downloaded file into your application folder.
- Linux: extract the downloaded file, and open the arduino-ide file that will launch the IDE.
If you have doubts, you can go to the Arduino Installation Guide.
Do you need an ESP32 board? You can buy it here.
Recommended reading: ESP32 Development Boards Review and Comparison
Install ESP32 Add-on in Arduino IDE
To install the ESP32 board in your Arduino IDE, follow these next instructions:
1. In your Arduino IDE 2.0, go to File > Preferences.
2. Copy and paste the following line to the Additional Boards Manager URLs field.
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
Note: if you already have the ESP8266 boards URL, you can separate the URLs with a comma, as follows:
http://arduino.esp8266.com/stable/package_esp8266com_index.json, https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
3. Open the Boards Manager. You can go to Tools > Board > Boards Manager… or you can simply click the Boards Manager icon in the left-side corner.
4. Search for ESP32 and press the install button for esp32 by Espressif Systems.
That’s it. It should be installed after a few seconds.
Testing the Installation
To test the ESP32 add-on installation, we’ll upload a simple code that blinks the on-board LED (GPIO 2).
Copy the following code to your Arduino IDE:
/*********
Rui Santos
Complete project details at https://RandomNerdTutorials.com/vs-code-platformio-ide-esp32-esp8266-arduino/
*********/
#include <Arduino.h>
#define LED 2
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(LED, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LED, HIGH);
Serial.println("LED is on");
delay(1000);
digitalWrite(LED, LOW);
Serial.println("LED is off");
delay(1000);
}
Uploading the Sketch
On the top drop-down menu, select the “unknown” board. A new window, as shown below, will open.
You should select your ESP32 board model and the COM port. In our example, we’re using the DOIT ESP32 DEVKIT V1 board. Click OK when you’re done.
Now, you just need to click on the Upload button.
After a few seconds, the upload should be complete.
Note: some ESP32 development boards don’t go into flashing/uploading mode automatically when uploading a new code and you’ll see a lot of dots on the debugging window followed by an error message. If that’s the case, you need to press the ESP32 BOOT button when you start seeing the dots on the debugging window.
The ESP32 on-board LED should be blinking every second.
Serial Monitor
You can click on the Serial Monitor icon to open the Serial Monitor tab.
That’s it! You’ve installed the ESP32 Boards successfully in Arduino IDE 2.0.
Wrapping Up
This is a quick guide that shows how to prepare Arduino IDE 2.0 for the ESP32 Boards on a Windows PC, Mac OS X, or Linux computer.
Next, you might want to read: Getting started with ESP32 or learn more about the ESP32 board with our resources:
- Build Web Servers with ESP32 and ESP8266 eBook
- Learn ESP32 with Arduino IDE (eBook + video course)
- More ESP32 tutorials and projects…
Thank you for reading.