What is ESP32 | Configuration of ESP32 with Arduino IDE

Today we are going to see what is ESP32, how to use ESP32, how ESP32 works, ESP32 pin configurations, etc.

Hello guys! Welcome back to my blog today we are going to learn about ESP32 in detail, so let’s begin.

What is ESP32?

Esp32 is a low-cost development board with WIFI & Bluetooth chips embedded in it. The main feature of ESP32 that makes it better than other development boards is that it is dual core 32-bit with an ESP-WROOM-32 LX6 microprocessor. ESP32 plays important role in developing IoT-based applications as it consists of two wireless technology such as WIFI and Bluetooth.

ESP32 has an operating voltage of 2.2v to 6v with the onboard regulator to provide stable voltage and an available output current of more than 500 mA. ESP32 has a dual-core processor which runs independently of each other. 1 core at 240 MHz, 2 cores at 240 MHz adjustable clock frequency. Esp32 has a flash memory of 4 MB which makes ESP32 faster. it has a built-in hall effect sensor.

ESP32 is a low-cost, low-power system on a chip (SoC) series with Wi-Fi and dual-mode Bluetooth capabilities. It's built around a Tensilica Xtensa dual-core processor, running at 160MHz (overclockable to 240MHz). With 520KB of SRAM, 34 GPIO pins, and integrated Wi-Fi and Bluetooth, the ESP32 is designed for simple, cost-effective, and power-efficient IoT applications. While it doesn't have built-in USB ports, it can be programmed via USB-UART, and while it doesn't include onboard storage, it does support microSD and SPI flash. It is developed by Developed by Espressif Systems. The ESP32 can be programmed using the Arduino IDE, ESP-IDF (IoT Development Framework), MicroPython, JavaScript, Lua, and more. ESP32 operates at 2.7V - 3.6V and has a wide operating temperature range from -40°C to 125°C.

esp32 Arduino

The ESP32 includes a Tensilica Xtensa LX6 microprocessor in both dual-core and single-core variations and includes built-in antenna switches, RF balun, power amplifier, low-noise receive amplifier, filters, and power management modules. ESP32 is already integrated with antenna switches, RF balun, power amplifier, low-noise receive amplifier, filters, power management module, and advanced adaptive biasing for low-power operation. It supports a variety of Bluetooth features such as classic Bluetooth, Bluetooth low energy, and Bluetooth 4.2 specification. ESP32 includes both RAM and flash memory, the size of which depends on the specific variant. Typically, an ESP32 variant has 512KB of SRAM and 4MB of flash memory. The ESP32 chip has 34 GPIO pins which can support functions such as ADC (Analog to Digital Conversion), DAC (Digital to Analog Conversion), I2C (Inter-Integrated Circuit), UART (Universal Asynchronous Receiver/Transmitter), CAN 2.0 (Controller Area Network), SPI (Serial Peripheral Interface), and more.

The ESP32 is widely used in IoT devices, wearable electronics, smart home applications, and many other scenarios due to its features, low cost, and ease of use. It provides a high level of integration, and its extensive protocol support makes it a very versatile chip for building connected devices.

Types of ESP32 Sleep Modes

ESP32 sleep turns on a power-saving feature for the board to maximize the operation time of ESP32. sleep modes are also known as power-saving modes. all the power towards I/O pins is terminated and only CPU and GPIO pins receive some current. There are 5 types of sleep modes in ESP32

  • Active Mode
  • Modem Sleep Mode
  • Light Sleep Mode
  • Deep Sleep Mode
  • Hibernation Mode

Active mode - 

In active mode is a normal mode. In this mode everything is ON Wi-Fi & Bluetooth also chip will receive a maximum current of 240mA.

Modem Sleep Mode - 

In modem sleep except for WIFI and Bluetooth. Everything is ON along with the CPU. The power consumes by the CPU during modem sleep is between 3mA to 20 mA.

Light Sleep Mode -

During light sleep mode, the CPU is paused by powering off its clock pulses, while RTC and ULP-coprocessor are in an active state. Thus less power consumption takes place compared to modem sleep mode which is approx. around 0.8mA.

Deep sleep -

In deep sleep mode, the memory chip, and main CPU is turned OFF while the ULP co-processor is operated. ULP co-processor reads the sensor value and also wakes the main processor. In deep sleep mode RTC controller, RTC peripherals, and RTC memories are in an Active state. In this mode, the chip consumes a very low current between 0.15 mA to 10µA.

ESP32 Hibernation mode - 

Hibernation is the same as deep sleep mode except it turns off 90% of the operation of the ESP32 board. it turns off the internal oscillator and ULP processor. we cannot save any data in hibernation mode. only the RTC timer is turned on to wake the ESP32 board from hibernation mode. 

Types of esp32 development board

  • ESP32 DEV KIT DOIT
  • ESP32-DevKitC
  • ESP32-PICO-KIT
  • ESP-EYE
  • ESP32 Thing
  • SX1278 ESP32 (LORA)
  • ESP32-CAM

ESP32 can be programmed in different programming environments such as

  • Arduino IDE
  • Espressif IDF

ESP32 Specifications

  • Enable Button (for Reset)
  • Boot Button (for flashing)
  • Power LED (Red)
  • AMS1117 3.3V Regulator IC
  • Two IO Pins rows 15 pins on each side (total of 30 pins)
  • CP2012 USB – UART Bridge IC
  • Serial Communication (4 x SPI), (2 x I2C), (2 x I2S), (3 x UART)
  • Blue LED User Input (connected to GPIO2)
  • Single or Dual-Core 32-bit LX6 Microprocessor
  • clock frequency up to 240 MHz
  • Supports 802.11 b/g/n Wi-Fi connectivity
  • Support for Bluetooth
  • PWM to 16-channels
  • 12-bit SAR ADC and 2 channels of 8-bit DAC
  • Capacitive touch, ADC (analog to digital converter)

Advantage of ESP32

  • More GPIO pins
  • Dual processor
  • Low power consumption
  • Various sleep modes are available
  • WIFI and Bluetooth features
  • Internet accessibility
  • Faster than other development board
  • Internet Accessibility

Pin Configuration

esp32pinout

There are several kinds of GPIO that are digital-only GPIOs, analog-enabled GPIOs, capacitive touch-enabled GPIOs, etc.

Analog-to-Digital Converter (ADC)

ESP32 integrates 12-bit SAR ADCs and supports measurements on 18 channels (analog-enabled pins).

Digital-to-Analog Converter (DAC)

Two 8-bit DAC channels can be used to convert two digital signals into two analog voltage signal outputs.

EN Button 

To reset the ESP32 development board module we use the EN button.

Boot Button

The boot button is used to upload the program from Arduino IDE into ESP32 after clicking on the upload button in Arduino IDE.

Power-On LED

ESP32 board contains two LED red and blue. A Red LED light is used to indicate the power supply and a blue LED is used to indicate user input.

Micro USB Port

To program the ESP32 module with the computer we use a Micro USB port to upload the program to the board through the computer.

USB-UART Bridge

USB to UART controller provides USB connectivity to devices with a UART interface. 

Touch Sensor

ESP32 offers 10 capacitive sensing GPIOs which detect capacitive variations introduced by the GPIO’s direct contact or close proximity with a finger or other objects.

The 10 capacitive sensing GPIOs are - GPIO4, GPIO0, GPIO2, MTDO, MTCK, MTD1, MTMS, GPIO27, 32K_XN, 32K_XP.

I2S Interface

Two standard I2S interfaces are available in ESP32. They can be operated in the master or slave mode, in full duplex and half-duplex communication modes.

Pulse Width Modulation (PWM)

The Pulse Width Modulation (PWM) controller can be used for controlling the light intensity and speed of motors.

Application of ESP32

  • Home automation
  • Smart lights
  • Baby monitors
  • Wearable electronics (Smartwatches)
  • Fish & pet feeder
  • Healthcare device
  • GPS Tracking system
  • Curtain Automation
  • IP cameras
  • Remote control Cars / Drones
  • Bluetooth controlled device

How to use ESP32 with Arduino IDE

1) Download Arduino IDE.

2) Open your IDE and click on File -> Preferences.



3) In Additional Boards Manager URLs add this line and click on ok



4) Go to Tools -> Board -> Boards Manager type “ESP32” by Espressif Systems
 and install it.


5)  Go again to Tools -> Board and select ESP32 

6) To verify everything works good, Go to File -> Example and select LED to blink example 


Getting started with ESP32 using LED blink Example

Pin D2 has an onboard LED, now we will write our first program to blink the LED, code uploading is the same as Arduino.

Code -  

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

Once the code is uploaded you can see LED is blinking with a delay of 1000 milliseconds.

Conclusion –

Today we learn what ESP32 is, types of ESP32 development board, ESP32 pins configurations, ESP32 specification, ESP32 Advantages, ESP32 Application & features, we also learn how to configure the ESP32 board with Arduino IDE and write our first program to blink on-board LED.

"I hope you understand the basics of ESP32. In the next chapter, we will learn more about the ESP32 board and many ESP32-related projects in the future till then bye, see you in my next blog."

Close Menu