I will show you how to install ESP32 Arduino Core in the Arduino IDE. You can install the ESP32 core in minutes.
By the end of this tutorial, you will be able to connect the ESP32 device to your PC and start testing the code.
Components Needed
Hardware Components
- ESP32S Wroom-32 x 1
- Arduino USB cable (for powering and programming) x 1
Software
What is the Arduino IDE, and why is it useful?
Arduino IDE is an Integrated Development Environment. It contains a text editor, a console window, a status message window, and a set of menu options.
You can use Arduino IDE to program the Arduino Boards (such as Arduino UNO, Mega, Nano, etc.) and ESP32 boards.
ESP32 Boards have wireless options making them a favourite choice for connectivity and IoT projects. ESP32 boards are also cheaper and more powerful.
However, since Arduino is very popular and many people are using it, you will find many examples for ESP32 built on Arduino core.
Hence, having ESP32 support on Arduino IDE helps you work with several examples.
-> Also, check out our Beginner’s Guide to ESP32 Programming
Step-By-Step Instructions To Install ESP32 on Arduino IDE
I will provide the installation steps sequentially. If you have not installed the latest Arduino IDE already, follow the below steps.
You can skip the below steps and hop on to the next section if you have the newest IDE already installed.
There is a chance that you might have one or more versions of the Arduino IDE installed.
Please follow the steps below to ensure the ESP32 installation works without any issues.
1. Uninstall all the Arduino IDE versions and Restart your PC if necessary
2. Go to the Arduino website to download the latest Arduino IDE version
3. Click on the download option after choosing the suitable download options (Windows / macOS / Linux)
4. Once you download, run the exe file. It will ask you to accept the agreement, terms, and conditions. Once you select the installation folder, click next. The installation takes a few minutes.
Click on the below icon to launch the Arduino IDE.
In the next section, you will install the ESP32 on the Arduino IDE.
Step 1: Step-By-Step ESP32 Installation On Arduino IDE
1) Start The Arduino Application And Open Preferences
Click on the File option and select Preferences.
Once you click on the Preferences option, you will see the below window.
Notice the Additional boards manager URLs option.
Next, you will add the ESP32 release links in the Boards Manager URLs.
2) Enter The ESP32 Stable Release Urls
Stable release link for the ESP32 boards – https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
3) Open Boards Manager to install ESP32
- Click on Tools in the menu bar
- Click on Board
- Select Boards Manager
The board manager will look like this in the future version of Arduino 2.0.
- Type in ESP32 in the search bar
- You can see the results in the section below the search bar
- Click on the install button
The installation will take some time, depending on the network speed. Once the installation is complete, you can see the following content in the Boards manager.
Congratulations. You have now completed the required setup to use ESP32 on an Arduino IDE.
Step 2: Testing the ESP32 installation on the Arduino IDE
In this step, you will test the installation done in the previous step. Let us begin.
1) Select the correct COM port
A COM port will appear once you connect the ESP32 module to your PC. Select the correct COM port as shown in the image below.
2) Select the Board
- Click on Tools
- Select Board
- Click on the ESP32 option
- Choose the appropriate board (in my case, it is Devkit v1)
3) Choose an ESP32 example
4) Code for reading ChipID
/* The true ESP32 chip ID is essentially its MAC address. This sketch provides an alternate chip ID that matches the output of the ESP.getChipId() function on ESP8266 (i.e. a 32-bit integer matching the last 3 bytes of the MAC address. This is less unique than the MAC address chip ID, but is helpful when you need an identifier that can be no more than a 32-bit integer (like for switch...case). created 2020-06-07 by cweinhofer with help from Cicicok */ uint32_t chipId = 0; void setup() { Serial.begin(115200); } void loop() { for(int i=0; i<17; i=i+8) { chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i; } Serial.printf("ESP32 Chip model = %s Rev %d\n", ESP.getChipModel(), ESP.getChipRevision()); Serial.printf("This chip has %d cores\n", ESP.getChipCores()); Serial.print("Chip ID: "); Serial.println(chipId); delay(3000); }
5) Serial Monitor Output for ChipID reading program
Open the Serial terminal from the Tools option in the menu bar.
Here is the screenshot of the messages read on the serial terminal.
6) Code for reading the list of WiFi networks available
/* * This sketch demonstrates how to scan WiFi networks. * The API is almost the same as with the WiFi Shield library, * the most obvious difference being the different file you need to include: */ #include "WiFi.h" void setup() { Serial.begin(115200); // Set WiFi to station mode and disconnect from an AP if it was previously connected WiFi.mode(WIFI_STA); WiFi.disconnect(); delay(100); Serial.println("Setup done"); } void loop() { Serial.println("scan start"); // WiFi.scanNetworks will return the number of networks found int n = WiFi.scanNetworks(); Serial.println("scan done"); if (n == 0) { Serial.println("no networks found"); } else { Serial.print(n); Serial.println(" networks found"); for (int i = 0; i < n; ++i) { // Print SSID and RSSI for each network found Serial.print(i + 1); Serial.print(": "); Serial.print(WiFi.SSID(i)); Serial.print(" ("); Serial.print(WiFi.RSSI(i)); Serial.print(")"); Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*"); delay(10); } } Serial.println(""); // Wait a bit before scanning again delay(5000); }
7) Serial Monitor Output for WiFiScan program
Like the previous step, open the Serial terminal from the Tools option in the menu bar. You can see the list of WiFi devices detected by your ESP32 device.
-> Read our article about How Easy Is It To Learn Arduino?
FAQs About The ESP32 installation on Arduino IDE
Here is a list of frequently asked questions about the ESP32 installation on Arduino IDE. If your questions are still not answered, please leave a comment.
1) Which board is chosen for ESP32 in Arduino IDE?
In this example, I have selected DOIT ESP32 Devkit v1. You will find the list of standard boards under Tools → Boards → ESP32.
If your board name is not listed, try choosing the closest one. For example, the ESP32 Devkit is produced by several suppliers, but all will work with the selected option in the article.
2) How do I add ESP32 to Arduino IDE?
Adding ESP32 to the Arduino IDE is easy. Since most people use Arduino, the IDE is user-friendly, and most settings are well known.
You can follow the steps mentioned in this article to get started with ESP32 programming on Arduino.
3) Does ESP32 work with Arduino IDE?
Yes. ESP32 works with the Arduino IDE. Once the ESP32’s installation is complete on the Arduino IDE, you can refer to examples links to explore the vast library available for your ESP32 projects.
You will also get options to select the correct ESP32 board.
4) Can ESP32 communicate with an Arduino?
Yes. ESP32 has several serial interfaces such as UART, I2C, SPI, etc. You can use the UART interface as it is the most basic one, and both ESP32 and Arduino UNO can spare a UART channel for communication.
My personal favourite is also the UART communication due to its simplicity.
Conclusion
This article went through the steps needed to make ESP32 work on Arduino IDE. I have given complete step-by-step instructions to install ESP32 on the Arduino IDE.
With the basic setup ready, you will now find it very easy to continue your quest for projects related to connectivity, the Internet of Things, and more.
I have used ESP32 for my home security system project and garden watering system. It’s a powerful device and I highly recommend reading my beginners guide to ESP32 microcontrollers to get started with if you are interested in using them in your own projects.
What would you love to learn next?
Please share your suggestions in the comments.
I am Puneeth. I love tinkering with open-source projects, Arduino, ESP32, Pi and more. I have worked with many different Arduino boards and currently I am exploring, Arduino powered LoRa, Power line communication and IoT.