Contact Us
Blog >> Blog Details Page

Getting Started with ESP32

Posted:03:14 PM November 09, 2023 writer: The Engineering Projects

Hey learners! I hope you are doing great. Today, I am excited because I am going to share the introduction of a versatile and popular microcontroller board named "ESP32 development board”. This has caused a revolution in the world of the Internet of Things (IoT), and we will discuss all the information and concepts from scratch. The ESP32 is a series of low-cost and low-power boards that not only provide the best functionalities but also have more advanced features than its other family members.

In this article, we will start the discussion with the introduction of the ESP32 board; therefore, even if you are new to the development boards, you will get all the concepts clearly. After that, we will discuss the type of projects where ESP32 is used and the specifications and pinouts of this board. Moreover, we will discuss the type of integrated development environment (IDE) that is used to program the ESP32. Once all is clear, we will move towards the Arduino and start with the installation, setting, and getting the Arduino IDE ready for ESP32. Finally, we will run a code of LED blinking to learn the coding process in this IDE. This is going to be lengthy but interesting so let’s start learning. 

Introduction to ESP32 Board

  • EPS32 is a series of microcontrollers that have advanced features and versatile working. It was developed by Espressif System and has models and configurations; therefore, it is usable in different types of projects. The Espressif System is a Shanghai-based Chinese company that manufactures WiFi and Bluetooth chips and is one of the leading companies in the world for this purpose. 
  • The ESP32 is a popular choice among other modules for the following two reasons:
    • Low Cost of ESP32: This board is available at low prices, starting at $6, which makes it accessible for students, teachers, hobbyists, and professional users as well. This makes it the best board for experimentation. 
    • Low Power Consumption: The ESP32 runs on very low power as compared to the other options. It has mode states such as deep sleep to save the power and this makes it ideal for the IoT and other such projects. 

Some important features of the ESP32 are given next:

Get Free PCB Assembly

Features of ESP32

ESP32 is considered one of the best boards for IoT projects because of the versatility and latest features that are in demand for such projects. The following features will help you understand the functionalities of ESP32.

WiFi Capabilities of ESP32

  • The ESP32 can be connected to WiFi, which makes it more versatile than other boards such as Arduino. Users can connect it in two ways:
    • Connect the network to the internet in station mode. 
    • Create the WiFi network and connect the board with the other devices in access point mode. 
  • The WiFi capabilities are also used to carry out communication between multiple devices.

Bluetooth Connections in ESP32

  • Multiple applications run on Bluetooth, which is an important feature of ESP32. There are two types of Bluetooth connectivity:
    • The classic Bluetooth is the legacy technology that is used to connect headsets, keyboards, mice, and other such devices. 
    • Bluetooth Low Energy (BLE) is the latest technology that can be used to connect devices like smartwatches, fitness trackers, heart rate monitors, etc.
  • The ESP32 supports both types of Bluetooth; therefore, multiple types of devices are suitable for use with it. 

Dual Core in ESP32

The ESP32 is a dual-core microcontroller which means it has two cores that run separately. This makes it suitable for multitasking as we can access the ESP32 Dual Cores. Moreover, this feature makes it suitable for tasks that require high processing power. This feature is enabled with the help of a real-time operating system (RTOS).

Peripheral I/O Interface of ESP32

The ESP32 supports a large number of peripheral I/O. This is the reason behind the versatility of this board. Some basic peripherals of this board are:

  • Capacitive touch
  • ADCs
  • DACs
  • UART
  • SPI
  • I2C
  • PWM
  • GPIO

We will discuss some of these peripherals in detail in just a bit. 

 

Programming Language of ESP32

There are multiple options of programming languages to work with ESP32, such as C++, C, Micropython, etc. But usually, people prefer to use C++, because it is easy to install and understand. For this, the Arduino IDE is used for the coding with some special settings. This makes it a perfect choice for users who are working on Arduino and require some additional features to deal with their projects. 

Firmware for the ESP32

  • Firmware is the type of software with which the hardware of the device is programmed. It is essential for the low-level control of the hardware to work properly. The official firmware of the ESP32 is divided into two types:
    • The binary firmware has to be installed in the ESP32 with the USB or similar tools. 
    • The source code has to be the Espressif ESP-IDF development framework. 
  • This is a free and open-source firmware that provides all the basic features of the ESP32. Moreover, this board is also compatible with MicroPython, CircuitPython, Arduino, and FreeRTOS. Collectively, all these make ESP32 easy to use for a large number of users. 

All these features are responsible for the rapid popularity of this board among people interested in the projects of the Internet of Things (IoT). Not only this, ESP323 has multiple types of projects in other fields as well. Here are some important types of projects for the ESP32 development board. 

 

Types of Projects with ESP32 

The ESP32 is one of the best choices for microcontroller boards in different fields of technology. The built-in WiFi and Bluetooth capabilities have made them suitable for a large range of projects. Here is a list of a few categories of the hardware industry where ESP32 is extensively used.

Home Automation with ESP32

Home automation is a trending topic in the Internet of Things (IoT) because these are making life easier, and boards like the ESP32 have made it possible to get the best connectivity at a lower price. Here are some examples of some projects:

 

  • The ESPE32 is used to control the devices remotely without pushing the buttons, just like we change the channels on the television with the help of remote controllers. For instance, with the help of a customer smartphone app like Alexa or Google Assistant, users can control the lights, heater, fan, and other appliances as well. Not only this, the apps and devices may be designed to provide the status of temperature, humidity, light intensity, etc. through the app. 
  • The devices may be designed to automatically turn on or off based on the different parameters so that the user may get comfort every time he/she is at home. 

Security System with ESP32

The ESP32 is compatible with the use of different sensors, such as PIR sensors, smoke sensors, etc. These can be used for the design of security systems either at home, in the office, or in other places. These are known as DIY security systems, and collectively, multiple sensors can be used to create a foolproof and effective security system. For instance, the motion detector on the windows and doors can detect the motion and notify the user on their smartphone apps about any suspicious motion in the place. 

Smart Door Locks with ESP32

In this technical era, every place is becoming smart. The smart door locks are designed with the help of the ESP32 development board to enter sensitive and private places by using security codes and other means. These systems grant access to only related people, and these smart doors are locked instantly when any unwanted person tries to enter the place. Moreover, the admins can get notifications on their smart app about the entry and exit of every person.

ESP32 Price

The ESP32 has different versions, and users get them according to their project type. The price of each type varies. Here is the general price range of different packages of ESP32:

  • The price of the ESP32 module without any additional components has a range of $2 to $10. These are useful for companies and PCB designers to solder directly into PCBs and use their functionality with other components. 
  • The ESP32 development board has a price between $10 and $20. These boards are the best choice for beginners and learners and are ready to use. It has built-in USB-to-serial converters and is ideal for different types of projects. 
  • The ESP32 CAM Module has built-in camera compatibility, and the price depends on the quality of the camera. These can be bought for $5 to $10. 

There are some other options as well for the users, such as specialized boards and commercial boards. The price of these boards depends on the scale of production and the special features of these boards. The total price also depends on the quality of the product and the brand of the ESP32.

Get Instant Online Quote

ESP32 Pinout

The ESP32 has a total of 40 pins, and these are divided into different categories according to their functionalities. Here is an overview of these:

  • Power supply pins
    • VSS: Ground
    • VDD33: 3.3V power supply
    • VBAT: Battery power supply
  • Programming interface pins
    • EN: Reset 
    • BOOT: Boot mode selection
  • External oscillator pins
    • XTAL: Oscillator crystal input
    • XTAL32: Oscillator crystal output
  • GPIO general-purpose input/output pins: These are used for a variety of purposes, such as:
    • Digital input/output
    • Analog input
    • SPI/I2C/UART communication.
  • ADC (analog-to-digital converter) channels: These are the channels that are used to convert analog signals from sensors into digital signals.
  • DAC (digital-to-analog converter) channels: These are the channels that can be used to convert digital signals into analog signals.

 

The following table will make the concept clearer about these pins:

 

Pin Name

Category

Functionality

3V3

Power Supply

3.3V Power Output

GND

Power Supply

Ground Connection

EN

Power Supply

Enable (3.3V)

GPIO 0

General Purpose

Digital I/O, Boot Mode

GPIO 2

General Purpose

Digital I/O

GPIO 4-5

General Purpose

Digital I/O, UART1 TX/RX

GPIO 12-13

General Purpose

Digital I/O

GPIO 14-15

General Purpose

Digital I/O, UART2 TX/RX

GPIO 16

General Purpose

Digital I/O

GPIO 17

General Purpose

Digital I/O

GPIO 18-19

General Purpose

Digital I/O, PWM

GPIO 21-39

General Purpose

Digital I/O

GPIO 25-27

General Purpose

Digital I/O

GPIO 32-39

General Purpose

Digital I/O

 

Note that this is a general description of each pin, and the order of the pins may be changed in some models. But the functionalities and the workings remain the same. 

Specifications of ESP32

The ESP32 is a relatively inexpensive and versatile board that is well-suited for a wide variety of projects. One of the reasons is its pinouts which we have just discussed with you. The other reason is its specifications, which make it more attractive. Here are some important specifications for this development board:

 

Sr #

Specification

Value

1

Processor

Dual-core 32-bit Tensilica 1500 MHz

2

Co-processor

Ultra-low-power (ULP) co-processor

3

Memory

448 KB of ROM, 520 KB of SRAM

4

Wireless connectivity

Wi-Fi (802.11 b/g/n), Bluetooth 4.2, Bluetooth Low Energy (LE)

5

Peripherals

34 GPIO pins, 12 ADC channels, 2 DAC channels, SPI, I2C, I2S, UART, Ethernet, SDIO, RTC, etc.

6

Power consumption

As low as 5 µA in deep sleep mode

7

Operating voltage

3.3 V

8

Operating temperature

-40 to 85 °C

9

Dimensions

25.5 x 18 x 3.1 mm

10

Weight

4.7 g

 

This is a general overview of specifications. If you want to go into the details of these, then you must visit the datasheet on the official website. These specifications make the ESP32 ideal for different projects in multiple fields.

Programming of ESP32

Just like other modules, the ESP32 has to be programmed in the integrated development environment to be used according to the project. Just like the Arduino, the programming language for the ESP32 is C++. There are multiple programming IDEs that are compatible with the ESP32. The basic introduction to all these is given next:

Arduino IDE

The Arduino IDE is developed by the Arduino company for different boards. This is an easy-to-use and user-friendly development environment for microcontrollers like the ESP32. It has a vast library system and is an ideal choice for ESP32 development boards.


Espressif IDF (IoT Development Framework)

This is Espressif’s official development framework, designed for simple microcontrollers such as the ESP32 and ESP8266. This comprehensive tool is best for the relatively complex projects of ESP32 and provides full access to the hardware. This is a good choice for such boards, but it is not suitable for absolute beginners.

PlatformIO for ESP32

This is an extension of the Visual Studio code and has a built-in debugging tool and a library manager. It is an open-source ecosystem that is ideal for IoT projects and, therefore, is suitable for multiple development boards such as ESP32. This can be downloaded from the official website of PlatformIO. It is a powerful and flexible platform for the ESP32. 

Micropython for ESP32

MicroPython is a lightweight Python interpreter for microcontrollers like the ESP32. This is an efficient tool for writing code in Python for the projects of ESP32. This makes the ESP32 more accessible for users who prefer Python programming for the ESP32.

Similarly, Thonny is the Python IDE that has integrated the Micropython shell. It is designed for beginners and is an excellent choice for the ESP32 programmers' practical.

In addition to all these, tools like Mongoose OS are also available for ESP32 programming. All these are popular choices for this task, but among them, the most suitable for beginners is Arduino IDE, and we will work on it for our simple beginner program. 

How to Use ESP32 for Projects

The ESP32 can create versatile projects, and basically, we need multiple types of components, but because this is a beginner’s tutorial, we are starting with the project requiring the least components. We will create a project to blink the LED light on the ESP32 board. Here is the list of the components required for this project:

  1. ESP32
  2. Micro USB cable
  3. Computer/laptop system
  4. Integrated development environment

I hope you have the first three components. Let us go for the IDE. 

Installation of Arduino IDE for ESP32

The installation process for the Arduino IDE is simple. The user has to follow the steps given next:

Download the Arduino IDE for ESP32

  • The Arduino IDE is downloaded from the official website of Arduino.
  • There are different ways to download this IDE; choose the appropriate option. I am using the zip file option to download the file. 

Installation of Arduino IDE for ESP32

 

Once the zip file is downloaded, go to the folder where it was saved and extract it to the required location. 

 

  • Check the required options and click on the next button to install the IDE. 

 

  • By default, the Arduino is installed on the C drive; if you want to change the location, you can browse it to the required location. 
  • Wait for the installation process of the Arduino IDE; once installed, you can see the Arduino IDE on your system. 
  • Connect the ESP32 to the system with the help of cable. This will stimulate the sound for the USB connection in the system.

At this point, the Arduino is not ready to work with the ESP32. The board and port for the ESP32 are not present in the IDE. The user has to make some changes to get the right working.

Getting the Arduino IDE Ready for ESP32

The Arduino IDE is designed to work mainly with the Arduino board. To use it with the ESP32, we have to install the right board and port. For this, follow the steps given next:

Installing ESP32 Board on Arduino IDE

By default, the Arduino IDE is only compatible with the Arduino board, so to make it ready for ESP32, follow the steps:

  • From the header options, go to Tools>Borads>Board Manager. 
  • From the search bar, search for ESP32.

In the below eps32 by Espressif System section, click the install button.

The console on the lower side of the screen will show the downloaded information. 

 

  • Once completed, you can change the board for development. 

 

Downloading of Port for ESP32

  • Right now, when you see Tools>Port, the Arduino will show COM1 (or any other number according to your system).
  • There is a need to install the USB to the UART Bridge VCP driver. You have to go to the website and search for the right package to install from the list. 

  • I am downloading the CP210x Windows drivers. Click on it and start downloading. 

Installation of New Port for ESP32

  • Go to the folder where the RAR file is downloaded.

  • Right-click on the file and extract it in any folder. 

  • It will provide you with two options for the drivers in the compressed folder. 

  • Choose the one according to your system requirements.
  • Double-click on it to start installation. 

  • Click on the “Next” button to proceed.

  • Read the agreement, click on I accept this agreement, and click on the “NEXT” button. 
  • Once the loading is complete, it will show you the window to notify you like this:
  • Click on the “Finish” button. 

Selecting the Right Board and Port for ESP32

Once your downloading process is complete, you can choose the port and board to move forward. 

  • To select the board, go to Tools>Boards>esp32>Node32s. The list of esp32 boards is great, so you have to search it thoroughly. 
  • Similarly, for the right port, go to Tools>Port>COM 3. The port number may be changed in your software according to the system.  

Code for Blinking Project for ESP32

The Arduino is now ready to use the code for the ESP32. By default, it has some pieces of code. Copy all and delete. Now, paste the following code there:


//Creating an integer named ledPin and assigning it the value 2

int ledPin=2;

 

void setup() {

 //declaring the LED pin as output.

  pinMode(ledPin, OUTPUT);

 

}

 

void loop() {

//Creating the LED pin high so the LED will turn on

  digitalWrite(ledPin, HIGH);

//creating a delay time of 1 second so we can see the blinking light

  delay(1000);

//Creating the LED pin low so the LED will turn off

  digitalWrite(ledPin, LOW);

//creating a delay time of 1 second so we can see the blinking light

  delay(1000);

 

}

Getting the Results for ESP32 Blinking Light

  • Now, click on the “Verify” button and let the compiler load the code. 
  • Click on the “Upload” button and wait for the file to load. 
  • Once all the things are set, you will see a blue light on your ESP32 blinking after every second. 

Get Instant Online Quote

Conclusion

The ESP32 is a low-cost, low-power, microcontroller board that is a perfect choice for students, hobbyists, and professional users. This is a perfect development board for projects like home automation, security systems, smart locks, and other IoT-based projects. The price of this board depends on the type of ESP32. Usually, the development board is used and can be bought at a low price. 

This 40-pin board has great specifications that make it one of the most versatile microcontroller boards. There are multiple IDEs to program, but we have used the Arduino IDE for this tutorial. Multiple settings are required to make the Arduino IDE ready for ESP32, and we have discussed all of these in detail. In the end, we have made a project in which a blue LED on pin 2 blinks after every one second. I have tried to make a guide for the engineers to learn the use of ESP32 from scratch. If you are facing any issues, you can ask questions in the comment section.

You may also be interested in...

Autumn Offer: Get $30 off PCB orders over $100 with NextPCB

Free PCB Assembly Offer is Now Live

Types of Arduino Boards: Comparison of Specification and Features

  • PCB
    Prototype
  • PCB
    Assembly
  • SMD
    Stencil

Dimensions: (mm)

×

Quantity: (pcs)

5
5
10
15
20
25
30
40
50
75
100
120
150
200
250
300
350
400
450
500
600
700
800
900
1000
1500
2000
2500
3000
3500
4000
4500
5000
5500
6000
6500
7000
7500
8000
9000
10000

Other Quantities:(quantity*length*width is greater than 10㎡)

OK

Layers:

Thickness:

Quote now