Getting Started with ESP32 using Arduino IDE - Blink LED


ByAswinth Raj 2

Getting Started with ESP32 using Arduino IDE

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 dig deep to get started with the 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

ESP32 module


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.




Number of cores



32 bit

CPU Frequency







512 KB


16 MB



Communication Protocols


ADC channels

18 channels

ADC Resolution


DAC channels


DAC Resolution



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.


Programming the ESP32

As mentioned earlier in this tutorial we are going to program the ESP32 using the Arduino IDE since it has a strong community support. But you can also program the ESP32 using other software by the ESP Toolchain.

Also, this tutorial will only explain on getting started with the windows platform. If you are from other platforms follow the links below


Preparing your Arduino IDE:

STEP 1: Now, let’s get started. The first step would be to download and install the Arduino IDE. This can be done easily by following the link and downloading the IDE for free. If you already have one make sure it is of the latest version.


STEP 2: Next proceed to this link to download GIT, and a download will begin automatically named “Git-2.16.2”. Wait for the downloading to complete.

Download GIT 2.16.2


STEP 3: Once the download is complete, open the exe file to install GIT on your computer. Just click on Next for all the options without changing anything to proceed with the installation.

Install GIT on your computer


STEP 4: Search for the name “GIT GUI” to find the one that we just installed. Do not open GIT bash. By default GIT GUI will be installed on C drive under the Program files directory

Search for the name GIT GUI


STEP 5: Launch the GIT GUI application. Then select “Clone exiting repository”.

Launch the GIT GUI application


STEP 6: The following window will appear in which you should do the following.

Under Source Location paste:

Under Target Directory Paste:  [ARDUINO_SKETCHBOOK_DIR]/hardware/espressif/esp32

[ARDUINO_SKETCHBOOK_DIR] can be found by clicking on File -> Preferences on the Arduino IDE

Mine is C:/Users/Aswinth/Documents/Arduino, so my target directory will be C:/Users/Aswinth/Documents/Arduino/hardware/Espressif/esp32. Once pasted my screen looked liked as shown below

Clone exiting repository window


STEP 7: After ensuring the correct location paths, click on clone and you will get the following screen.

After ensuring the correct location paths click on clone


STEP 8: Now again search for “Git Bash” and open it. You will get the following window.

Git Bash window


STEP 9: Now type “cd” and then paste your Target directory again here. Mine looked like this below after pasting. Then hit enter.

Type cd and then paste your Target directory


STEP 10: Now paste git submodule update --init –recursive and hit enter to get the following screen.

Paste git submodule update init recursive


STEP 11: Now open “[ARDUINO_SKETCHBOOK_DIR]/hardware/espressif/esp32/tools” and then double click on the file get.exe. Wait for the process to finish. Once completed you should see the following files on the directory

Execute get.exe to get directories


That is it now our Arduino 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.

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

Select ESP32Dev from tools


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

Open device manager and check to which com port your ESP32 is connected


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.

Select the Port to which your ESP is connected


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() {
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(LED_BUILTIN, LOW);


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.

Uploading the code into Arduino


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

Getting Started with ESP32 using Arduino IDE


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.


int LED_BUILTIN = 2;

void setup() {


void loop() {
digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(LED_BUILTIN, LOW);


Get Our Weekly Newsletter!

Subscribe below to receive most popular news, articles and DIY projects from Circuit Digest


  • ansme's picture
    Oct 02, 2018

    My board is doit ESP32 devkit v2

    Blink:1:5: error: conflicting declaration 'int LED_BUILTIN'

     int LED_BUILTIN = 2;


    In file included from C:\Users\Pangko\Documents\Arduino\hardware\espressif\esp32\cores\esp32/Arduino.h:190:0,

                     from sketch\Blink.ino.cpp:1:

    C:\Users\Pangko\Documents\Arduino\hardware\espressif\esp32\variants\doitESP32devkitV1/pins_arduino.h:14:22: note: previous declaration as 'const uint8_t LED_BUILTIN'

     static const uint8_t LED_BUILTIN = 2;


    exit status 1
    conflicting declaration 'int LED_BUILTIN'


  • NetroZim's picture
    Nov 03, 2018

    I faced the same challenge, you can try making the simple edits like I did in the code below, instead

    of using the keyword LED_BUILTIN you can just you another variable e.g. LED like I did below:


    int LED = 2;

    void setup() {
    pinMode (LED, OUTPUT);


    void loop() {
    digitalWrite(LED, HIGH);
    digitalWrite(LED, LOW);


Log in or register to post Comment