Hello Folks,

Today we will start with our first and for the most topics under IoT Tutorial i.e getting started with esp.

Being hobbyist in electronics, we always prefer playing with well known Arduino Board 

But why people go with esp for IoT tutorials? , Okay before coming to that

Let’s start with

What is ESP?

When we talk about esp generally we have two variant of it

You might have heard of esp8266 and also worked on it.


Esp8266 is a low cost, microcontroller manufactured by espressif systems with wifi capability. 

It supports peripherals such as  I/O, SPI, I2C, I2S, SPI, UART, and ADC. It is a single core with clock frequency 80Mhz to 160 Mhz.

In a small package with low cost and compatible with Arduino IDE  makes it an all-time favourite for DIY IoT projects

After that, a successor of esp8266 comes to the market with some enhancement in features and performance.


Esp32 is a dual-core with wifi as well as Bluetooth capabilities and with versatile features make it a perfect fit for IoT projects.

Here are some examples of ESP32 boards:

    • Espressif Systems ESP32-Azure IoT Kit
    • ESP32-WROOM
    • ESP32-NodeMCU
    • Sparkfun Esp32 Thing
    • HiLetgo and many more…

All board above are manufactured by the different manufacturer with variation in GPIO’s and their function

IMPORTANT: If you are using other boards to do refer to its Datasheet for GPIO’s and everything.


This module does offer industry-leading specifications and the best performance for electronic integration, range, power consumption, and connectivity.

Specifications of ESP32-WROOM

Number of cores Dual-core
Clock frequency Adjustable from 80 MHz to 240 MHz.
Internal Memory

448 KB of ROM, 

520 KB of SRAM 

and 4MB of Flash memory (for program and data storage) 

Connectivity Wifi, Bluetooth and also used as a wifi hotspot
Operating voltage/Power supply 3.0 V ~ 3.6 V
Peripherals capacitive touch sensors, Hall sensors, SD card interface, Ethernet, high-speed SPI, UART, I²S, and I²C.
Serial communication USB-to-UART converter which enables us to flash code via USB and communicate with the ESP32 chip.
Battery support can be connected with 3.3 V Lipo batteries 

Power to the ESP32 development board is supplied via the on-board MicroB USB connector. 

Alternatively, if you have a regulated 5V voltage source, the VIN pin can be used to directly supply the ESP32 and its peripherals

WARNING: The ESP32 requires a 3.3V power supply and 3.3V logic levels for communication. The GPIO pins are not 5V-tolerant!  , If you want to interface the board with 5V (or higher) components, you’ll need to do some level shifting

ESP32 Development Board Pinout

The ESP32 development board has a total of 30 pins that interface it to the outside world. The connections are as follows:

For the sake of simplicity, we will make groups of pins with similar functionalities.

Power Pins There are two power pins viz. VIN pin & 3.3V pin. The VIN pin can be used to directly supply the ESP32 and its peripherals if you have a regulated 5V voltage source. The 3.3V pin is the output of an on-board voltage regulator. This pin can be used to supply power to external components.

GND is a ground pin of the ESP32 development board.

GPIO Pins: ESP32 development board has 25 GPIO pins which can be assigned to various functions programmatically.

Each digital-enabled GPIO can be configured to internal pull-up or pull-down, or set to high impedance. When configured as an input, it can also be set to edge-trigger or level-trigger to generate CPU interrupts.

ADC Channels The board integrates 12-bit SAR ADCs and supports measurements on 15 channels (analog enabled pins). Some of these pins can be used to build a programmable gain amplifier which is used for the measurement of small analog signals. The ESP32 is also designed to measure the voltages while operating in the sleep mode.

DAC Channels The board features two 8-bit DAC channels to convert digital signals into true analog voltages. This dual DAC can drive other circuits.

TouchPads The board offers 9 capacitive sensing GPIOs which detect capacitive variations introduced by the GPIO’s direct contact or proximity with a finger or other objects.

UART Pins ESP32 development board has 2 UART interfaces, i.e. UART0 and UART2, which provide asynchronous communication (RS232 and RS485) and IrDA support and communicate at up to 5 Mbps. UART provides hardware management of the CTS and RTS signals and software flow control (XON and XOFF) as well.

SPI Pins SPI Pins ESP32 features three SPIs (SPI, HSPI, and VSPI) in slave and master modes. These SPIs also support the following general-purpose SPI features:

    •         4 timing modes of the SPI format transfer
    •         Up to 80 MHz and the divided clocks of 80 MHz
    •         Up to 64-Byte FIFO

All SPIs can also be used to connect to the external Flash/SRAM and LCD.

~ PWM Pins The board has 25 channels (Nearly All GPIO pins) of PWM pins controlled by the Pulse Width Modulation (PWM) controller. The PWM output can be used for driving digital motors and LEDs. The controller consists of PWM timers and the PWM operator. Each timer provides timing in synchronous or independent form, and each PWM operator generates the waveform for one PWM channel.

EN Pin is used to enabling ESP32. The chip is enabled when pulled HIGH. When pulled LOW the chip works at minimum power.

Switches & Indicators

EN – Reset the ESP32 chip

Boot – Download new programs

Red LED – Power Indicator

Blue LED – User Programmable (D2)

ESP32 Development Platforms

Although there are many development platforms available for esp.

We will go with Arduino IDE as it’s easily available and preferred by many hobbyists.

Let’s proceed with the installing ESP32 Arduino core.

    1. Install Arduino IDE (Arduino 1.8.5 or higher) installed on your PC. Arduino IDE installation Tutorial  
    2.  Start the Arduino IDE  and open the Preferences window.

 3. Enter one of the release links above into the Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.

Find latest stable release link from GitHub page Esp32-Arduino Package

OR copy from here —>https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

4.Open Boards Manager from Tools > Board menu 

5. install esp32 package

6. All set to go!


Let’s Check with Blink Example

To make sure ESP32 Arduino core and the ESP32 development board are properly set up, we’ll upload the simplest sketch of all – The Blink!

We will use the onboard LED for this test. D2 pin of the board is connected to onboard Blue LED & is user-programmable.

  1. Choose Board: Open Arduino IDE and select the ESP32 Dev Module option under your Arduino IDE > Tools > Board menu.
  2.  Checking Port: Now, plug your ESP32 development board into your computer via micro-B USB cable. Once the board is plugged in, it should be assigned a unique COM port.
  •  On Windows machines, this will be something like COM#,
  •  on Mac/Linux computers it will come in the form of /dev/tty.usbserial-XXXXXX.

3. Select Port: Select this serial port under the Arduino IDE > Tools > Port menu.

4. Set Speed: Also the upload speed is selected to 921600 by default. Try lowering it to Upload Speed: 115200  

Once you are done, try the example sketch below.

/*Example: Blinking on board USER LED for ESP32-WROOM
  LED pin D2
int ledPin =2; 
void setup()
void loop()

  • After successful compilation of sketch
  • Hold-down the “BOOT” (right side of USB) button in your ESP32 board
  • Press the “Upload” button in the Arduino IDE to upload a new sketch:
  • After you see the  “Connecting….” message in your Arduino IDE, release the finger from the “BOOT” button:
  • After that, you should see the “Done uploading” message

Once the code is uploaded, LED will start blinking.


IMPORTANT: You may need to tap the ENABLE button to get your ESP32 to begin running the sketch.

Troubleshooting – ESP32 Installation

1.Port not detecting:

It might be one of these two problems: 1. USB drivers or 2. USB cable without data wires.

Try using another USB cable first

The board includes CP2102 USB-to-UART Bridge Controller from Silicon Labs, which converts USB signal to serial and allows your computer to program and communicate with the ESP32 chip

If you have an older version of CP2102 driver installed on your PC,

CP2102 Driver Installation link

2. A fatal error occurred: “Failed to connect to ESP32: Timed out… Connecting…”

When you try to upload a new sketch to your ESP32 and it fails to connect to your board, it means that your ESP32 is not in flashing/uploading mode.

Having the right board name and COM port selected, follow these steps:

  • Hold-down the “BOOT” button in your ESP32 board
  • Press the “Upload” button in the Arduino IDE to upload a new sketch:
  • After you see the  “Connecting….” message in your Arduino IDE, release the finger from the “BOOT” button:
  • After that, you should see the “Done uploading” message
  • That’s it. Your ESP32 should have the new sketch running. With those boards/with that setup, after uploading a new sketch, press the “ENABLE” button to restart the ESP32 and run the new uploaded sketch.