Programming ESP32 Board with Arduino IDE (2024)

Note: This tutorial was written after Arduino has officially launched its support for ESP32 boards. So if you have followed the old method of using GIT to install the boards then you would have to follow these steps again (highly recommended) if you need support for new libraries. If you are working with ESP32 for first time you do not have to worry about this.

Internet has reached almost every pocket through smart phones, it is estimated that about 3.2 billion people use internet but surprisingly about 8.4 billion devices use internet. That is electronics devices are connected to internet more than twice of the population who use internet and it is making the things around us smarter every day. The major reason is the boom of Internet of things which is commonly known as IOT, it is also estimated that by the end of 2020 we will have 20.4 billion devices connected to the internet. So it’s time to gear up and rise up our sleeves to work with IOT projects if we want to keep up with this development, lucky for us the open source platforms like Arduino and Espressif Systems has made things a lot easy for us.

Espressif Systems launched the ESP8266-01 long back which opened doors to many hobbyists to get into the world of IOT, since then the community has been developing strongly and many products has hit the market. Now the launch of ESP32 Espressif has taken things to a new level. This tiny cheap 8$ module is a dual core 32-bit CPU with built in Wi-Fi and dual-mode Bluetooth with sufficient amount of 30 I/O pins for all basic electronics projects. All these features are very easy to use, since it can be programmed directly from the Arduino IDE. Exiting enough... So let’s start programming ESP32 with Arduino IDEand then you can try all the interesting IoT based projects using ESP32.

Materials Required:

  • ESP32 Module
  • Arduino IDE
  • Programming cable (micro USB cable)
  • The soul stone from MCU (just kidding)

Hardware Information of ESP32:

Let’s take a look the ESP32 module. It is slightly bigger than the ESP8266-01 module and is breadboard friendly since most of the pin headers are broken out as I/O pins facing each other which is a great thing. Let’s break the board into small parts to know the purpose of each segment

Programming ESP32 Board with Arduino IDE (1)

As you can see the heart of the module is the ESP-WROOM-32 which is a 32-bit microprocessor. It also has a couple of buttons and LEDs which are explained below.

Micro-USB jack: The micro USB jack is used to connect the ESP32 to our computer through a USB cable. It is used to program the ESP module as well as can be used for serial debugging as it supports serial communication

EN Button: The EN button is the reset button of the ESP module. Pressing this button will reset the code running on the ESP module

Boot Button: This button is used to upload the Program from Arduino to the ESP module. It has to be pressed after clicking on the upload icon on the Arduino IDE. When the Boot button is pressed along with the EN button, ESP enters into firmware uploading mode. Do not play with this mode unless you know what you are doing.

Red LED: The Red LED on the board is used to indicate the power supply. It glows red when the board is powered.

Blue LED: The Blue LED on the board is connected to the GPIO pin. It can be turned on or off through programming. In some Chinese cloned boards like mine, this led might also be in red colour.

I/O pins: This is where major development has taken place. Unlike ESP8266, on ESP32 we can access all the I/O pin of the module through the break-out pins. These pins are capable of Digital Read/Write, Analog Read/Write, PWM, IIC, SPI, DAC and much more. We will get more into that later. But if you are interested you can learn through the pin description at ESP32 Datasheet.

ESP-WROOM-32: This is the heart of the ESP32 module. It is a 32-bit microprocessor developed by Espressif systems. If you are more of a technical person you can read through the ESP-WROOM-32 Datasheet. I have also listed few important parameters below.

ESP32

Specification

Value

Number of cores

2

Architecture

32 bit

CPU Frequency

Wi-Fi

YES

Bluetooth

YES

RAM

512 KB

FLASH

16 MB

GPIO Pins

36

Communication Protocols

SPI, IIC, I2S, UART, CAN

ADC channels

18 channels

ADC Resolution

12-bit

DAC channels

2

DAC Resolution

8-bit

For now this is all the information that we need to know about the hardware. We will cover more in depth as we move with different projects using the ESP32.

Removing the Old Version of ESP32 Board

This step can be skipped by users who are using ESP32 with Arduino for the first time. For others who have already installed ESP32 board on Arduino using GIT have to delete the Espriff folder from Arduino Directory.

Windows users can find this folder at Documents/Arduino/hardware, just find the folder and delete it permanently before you proceed with other steps.

Programming ESP32 Board with Arduino IDE (2)

Preparing your Arduino IDE

STEP 1:Now, let’s get started. The first step would be todownload and install the Arduino IDE. This can be done easily by following the linkhttps://www.arduino.cc/en/Main/Softwareand downloading the IDE for free. If you already have one make sure it is of the latest version.

STEP 2: Once installed, open the Arduino IDE and go to Files -> Preferences to open the preferences window and locate the “Additional Boards Manager URLs:” as shown below

Programming ESP32 Board with Arduino IDE (3)

STEP 3: This text box might be empty or might also contain some other URL if you have used it previously for ESP8266. If it is empty simply paste the below URL into the text box

https://dl.espressif.com/dl/package_esp32_index.json

If the text box already contains some other URL just add this URL to it, separate both with a comma (,). Mine already had the ESP8266 URL I just added this URL to and added a comma, like this

https://dl.espressif.com/dl/package_esp32_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json

Once done, my preferences windows looked like this below. Just click on OK and the window will disappear.

Programming ESP32 Board with Arduino IDE (4)

STEP 4: Now go to Tools -> Boards -> Board Managers to open the Board manager window and search for ESP32. If the URL was pasted correctly your window should find the below screen with Install button, just click on the Install button and your board should get installed.

Programming ESP32 Board with Arduino IDE (5)

STEP 5: Make sure you have an active internet connection and wait while the installation gets complete. It may take few minutes based on the speed of your internet connection.

Programming ESP32 Board with Arduino IDE (6)

That is it now ourArduino IDE is prepared to work with ESP32. Let’s go ahead and check if it is working.

Programming ESP32 with Arduino IDE:

STEP 1: Connect your ESP32 board to your computer through the micro-USB cable. Make sure the red LED goes high on the module to ensure power supply.

STEP 2: Start the Arduino IDE and navigate to Tools -> Boards and select ESP32Dev board as shown below

STEP 3: Open device manager and check to which com port your ESP32 is connected to. Mine is connected to COM 8 as shown below

Programming ESP32 Board with Arduino IDE (8)

STEP 4: Go back to Arduino IDE and under Tools -> Port select the Port to which your ESP is connected to. Once selected you should see something like this on the bottom left corner of the IDE.

Programming ESP32 Board with Arduino IDE (9)

STEP 5: Let’s upload the Blink Program, to check if we are able to program our ESP32 module. This program should blink the LED at an interval of 1 second.

int LED_BUILTIN = 2;void setup() {pinMode (LED_BUILTIN, OUTPUT);}void loop() {digitalWrite(LED_BUILTIN, HIGH);delay(1000);digitalWrite(LED_BUILTIN, LOW);delay(1000);}

The program is very similar to the Arduino blink code hence I am not explain them in detail. But one change is that, here in ESP32 the LED on board is connected to pin number 2, while for Arduino it will be connected to pin number 13.

STEP 6: To upload the code, just click on upload and you should see the Arduino console displaying the following if everything works as expected.

Programming ESP32 Board with Arduino IDE (10)

Note: For some modules, you might have to hold the Boot button during uploading to avoid error.

That is it we have successfully uploaded out first code to our ESP32 board. My module with its LED blinking is shown below

Programming ESP32 Board with Arduino IDE (11)

This is how Programming ESP32 usingArduino IDE can be implemented. You can go ahead and try the other example programs which are available at File -> Example -> ESP32 to work with other functionalities of the ESP32. If you have had any problem in getting this work, feel free to post the query on the comment sections below. You can also use the Forum for getting technical help.

Programming ESP32 Board with Arduino IDE (2024)

FAQs

Is Arduino IDE good for ESP32? ›

There are several development platforms available for programming the ESP32. You can go with: Arduino IDE – intended for those who are familiar with Arduino. Espruino – JavaScript SDK and firmware closely emulating Node.

Can you program ESP32 in Arduino IDE? ›

There's an add-on for the Arduino IDE that allows you to program the ESP32 using the Arduino IDE and its programming language. In this tutorial we'll show you how to install the ESP32 board in Arduino IDE whether you're using Windows, Mac OS X or Linux.

What is the easiest way to program ESP32? ›

For beginners, we recommend using Arduino IDE. While it's not the best IDE, it works well and is simple and intuitive to use for beginners. After getting familiar with Arduino IDE and you start creating more complex projects, you may find it useful to use VS Code with the Platformio extension instead.

Which board to select in Arduino IDE for ESP32 WROOM 32? ›

Select Tools > Board > Boards Manager from the Arduino IDE menus to open the "Boards Manager" view in the left side panel. Scroll down through the list of boards platforms until you see the "esp32 by Espressif Systems" entry. Click the "INSTALL" button at the bottom of the entry. Wait for the installation to finish.

What is the best programming for ESP32? ›

The Arduino IDE is the easiest way of working with the ESP32; at least, it is if you are coding in C++. The Espressif ESP Boards Manager is the key component in using the ESP32 with the Arduino IDE. The Boards Manager provides all the drivers required to let the IDE work with various ESP32 boards.

Is ESP32 more powerful than Arduino? ›

Arduino boards typically offer lower processing power compared to ESP32 but are often sufficient for many applications. Similar to a devkit, the easy-to-use layout and a range of built-in components make them great for beginners.

Is coding ESP32 same as Arduino? ›

Arduino and ESP32 are the two most popular development boards based on microcontroller or hardware platforms which have impacted embedded systems & DIY projects significantly. These development boards work similarly but, they differ in terms of programming, hardware, processing power & different factors significantly.

Can I use ESP32 without Arduino? ›

You can even program the ESP32 in pure C without using any Arduino code with only the ESP-IDF framework. There is also an increasingly popular alternative, especially since the release of the Raspberry Pi Pico:MicroPython . It is, in fact, possible to program the ESP32 in Python.

Can ESP32 be programmed in Python? ›

You can write Python scripts that will be directly executed on an ESP32 board. To do so, you have to flash the ESP32 board with MicroPython on it and use an IDE (for example, Thonny IDE ) to code Python scripts and send them to the ESP32. The MicroPython firmware is available on the official website .

Why ESP32 is better than Arduino? ›

In terms of connectivity, most Arduino boards don't have Wi-Fi or Bluetooth functionality on their own, and this includes the R4 Minima. They require the use of an add-on Ethernet or Wi-Fi shield. On the other hand, the Esp32 has Wi-Fi capabilities built-in, making it suitable for IoT projects.

What do you need to program ESP32? ›

What You Need
  1. An ESP32 board.
  2. USB cable - USB A / micro USB B.
  3. Computer running Windows, Linux, or macOS.

Can ESP32 be programmed via Wi-Fi? ›

OTA stands for Over The Air. It allows uploading a new program to ESP32 using Wi-Fi instead of connecting the ESP32 to a computer via USB to do the update. It is extremely useful in situations where you don't have physical access to the module.

Are all ESP32 boards the same? ›

Depending on the intended functionality, different development boards feature: Access to different ESP32 GPIO pins. Different interfaces: USB, JTAG. Different peripherals: touchpads, LCD screens, SD card slots, female headers for camera modules, etc.

What is the difference between Wroom 32 and Wrover 32? ›

Key Differences:

1. Memory Capacity: ESP32 WROOM: Standard flash memory. ESP32 WROVER: Additional PSRAM for increased memory capacity.

Which is better ESP32 or ESP8266? ›

The ESP32 is more powerful than the ESP8266, contains more GPIOs with multiple functions, faster Wi-Fi, and also supports Bluetooth. A lot of people think the ESP32 is harder to handle than the ESP8266 because it's more complex.

Is there an IDE for ESP32? ›

Arduino IDE (C++)

Arduino is a very popular IDE among hobbyist developers. Even though the ESP32 is not part of the default installation, you only need to install a plugin to gain access to the Arduino ecosystem. The default programming language for Arduino is C++.

Does Arduino IDE 2.0 support ESP32? ›

Arduino IDE 2. x does not come with built-in support for the ESP32-S3 microcontroller specifically, but you can use the Arduino IDE Boards Manager to easily install the ESP32 boards platform, which adds support for the ESP32-S3.

Which software is used for ESP32? ›

Espressif provides one official SDK for use with either the ESP32, ESP32-2, or the ESP8266. This is the FreeRTOS-based SDK.

Top Articles
Latest Posts
Article information

Author: Duane Harber

Last Updated:

Views: 5884

Rating: 4 / 5 (71 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Duane Harber

Birthday: 1999-10-17

Address: Apt. 404 9899 Magnolia Roads, Port Royceville, ID 78186

Phone: +186911129794335

Job: Human Hospitality Planner

Hobby: Listening to music, Orienteering, Knapping, Dance, Mountain biking, Fishing, Pottery

Introduction: My name is Duane Harber, I am a modern, clever, handsome, fair, agreeable, inexpensive, beautiful person who loves writing and wants to share my knowledge and understanding with you.