Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use ESP32: Examples, Pinouts, and Specs

Image of ESP32Design with ESP32 in Cirkit Designer

Introduction

The ESP32, manufactured by Espressif Systems (Shanghai) Co., Ltd, is a low-cost, low-power system on a chip (SoC) with integrated Wi-Fi and Bluetooth capabilities. It is designed for a wide range of applications, including Internet of Things (IoT) devices, wearable electronics, and embedded systems. The ESP32 DEVKITV1 is a popular development board that simplifies prototyping and development with the ESP32 chip.

Explore Projects Built with ESP32

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of ESP32-Based Sensor Monitoring System with OLED Display and E-Stop: A project utilizing ESP32 in a practical application
ESP32-Based Sensor Monitoring System with OLED Display and E-Stop

This circuit features an ESP32 microcontroller that interfaces with a variety of sensors and output devices. It is powered by a Lipo battery through a buck converter, ensuring a stable voltage supply. The ESP32 collects data from a DHT11 temperature and humidity sensor and a vibration sensor, controls a buzzer, and displays information on an OLED screen. An emergency stop (E Stop) is connected for safety purposes, allowing the system to be quickly deactivated.

Open Project in Cirkit Designer
Image of ESP32-Based NTP Clock with DHT22 Temperature Sensor and WS2812 LED Matrix Display: A project utilizing ESP32 in a practical application
ESP32-Based NTP Clock with DHT22 Temperature Sensor and WS2812 LED Matrix Display

This circuit features an ESP32 Devkit V1 microcontroller connected to a DHT22 temperature and humidity sensor and an 8x8 WS2812 RGB LED matrix. The ESP32 reads temperature data from the DHT22 sensor and displays the current date, time, and temperature on the LED matrix, with date and time synchronized via NTP (Network Time Protocol). The ESP32 provides power to both the DHT22 and the LED matrix and communicates with the DHT22 via GPIO 4 and with the LED matrix via GPIO 5.

Open Project in Cirkit Designer
Image of ESP32-Based Environmental Monitoring System with Water Flow Sensing: A project utilizing ESP32 in a practical application
ESP32-Based Environmental Monitoring System with Water Flow Sensing

This circuit features an ESP32 Devkit V1 microcontroller connected to a DHT22 temperature and humidity sensor and a water flow sensor. The ESP32 reads environmental data from the DHT22 via a digital input pin (D33) and monitors water flow through the water flow sensor connected to another digital input pin (D23). The ESP32 is powered through its VIN pin, and both sensors are powered by the ESP32's 3V3 output, with common ground connections.

Open Project in Cirkit Designer
Image of ESP32-Based Smart Weather Station with Wi-Fi Connectivity: A project utilizing ESP32 in a practical application
ESP32-Based Smart Weather Station with Wi-Fi Connectivity

This circuit features an ESP32 microcontroller interfacing with various sensors and modules, including a DHT22 temperature and humidity sensor, an ESP32 CAM for image capture, an I2C LCD screen for display, a load cell with an HX711 interface for weight measurement, and a buzzer for audio alerts. The ESP32 handles data acquisition, processing, and communication with these peripherals to create a multi-functional monitoring and alert system.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

The ESP32 DEVKITV1 is equipped with a dual-core processor, integrated Wi-Fi, Bluetooth, and a variety of peripherals. Below are the key technical details:

Key Technical Details

Parameter Specification
Manufacturer Espressif Systems (Shanghai) Co., Ltd
Part ID DEVKITV1
Processor Dual-core Xtensa® 32-bit LX6 microprocessor
Clock Speed Up to 240 MHz
Flash Memory 4 MB (varies by model)
SRAM 520 KB
Wi-Fi 802.11 b/g/n (2.4 GHz)
Bluetooth Bluetooth v4.2 BR/EDR and BLE
Operating Voltage 3.3 V
Input Voltage Range 5 V (via USB) or 7-12 V (via VIN pin)
GPIO Pins 34 (multiplexed with other functions)
ADC Channels 18 (12-bit resolution)
DAC Channels 2 (8-bit resolution)
Communication Interfaces UART, SPI, I2C, I2S, CAN, PWM
Power Consumption Ultra-low power (varies by mode)
Operating Temperature -40°C to +85°C

Pin Configuration and Descriptions

The ESP32 DEVKITV1 has a 30-pin layout. Below is the pin configuration:

Pin Number Pin Name Description
1 EN Enable pin (active high)
2 IO23 GPIO23 (Digital I/O, SPI MOSI)
3 IO22 GPIO22 (Digital I/O, I2C SCL)
4 IO21 GPIO21 (Digital I/O, I2C SDA)
5 GND Ground
6 VIN Input voltage (7-12 V)
7 IO19 GPIO19 (Digital I/O, SPI MISO)
8 IO18 GPIO18 (Digital I/O, SPI SCK)
9 IO17 GPIO17 (Digital I/O, UART TX)
10 IO16 GPIO16 (Digital I/O, UART RX)
... ... ... (Refer to the datasheet for full details)

Usage Instructions

How to Use the ESP32 in a Circuit

  1. Powering the ESP32:

    • Use a micro-USB cable to power the board via the USB port (5 V input).
    • Alternatively, supply 7-12 V to the VIN pin or 3.3 V to the 3V3 pin.
  2. Connecting Peripherals:

    • Use GPIO pins for digital input/output.
    • Connect sensors or actuators to the appropriate pins (e.g., ADC for analog input).
  3. Programming the ESP32:

    • Install the Arduino IDE or ESP-IDF (Espressif IoT Development Framework).
    • Select the correct board (ESP32 DEVKITV1) and port in the IDE.
    • Write and upload your code via the USB connection.

Important Considerations and Best Practices

Example Code for Arduino UNO Integration

Below is an example of using the ESP32 to blink an LED connected to GPIO2:

// Define the GPIO pin for the LED
#define LED_PIN 2

void setup() {
  // Initialize the LED pin as an output
  pinMode(LED_PIN, OUTPUT);
}

void loop() {
  // Turn the LED on
  digitalWrite(LED_PIN, HIGH);
  delay(1000); // Wait for 1 second

  // Turn the LED off
  digitalWrite(LED_PIN, LOW);
  delay(1000); // Wait for 1 second
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. ESP32 Not Detected by the Computer:

    • Ensure the USB cable is functional and supports data transfer.
    • Install the correct USB-to-serial driver (e.g., CP210x or CH340).
  2. Upload Fails with "Failed to Connect" Error:

    • Press and hold the "BOOT" button on the ESP32 while uploading the code.
  3. Wi-Fi Connection Issues:

    • Verify the SSID and password in your code.
    • Ensure the Wi-Fi network operates on the 2.4 GHz band (ESP32 does not support 5 GHz).
  4. Random Resets or Instability:

    • Check the power supply for sufficient current (at least 500 mA).
    • Avoid using GPIO0, GPIO2, and GPIO15 for critical functions, as they affect boot modes.

FAQs

Q: Can the ESP32 operate on battery power?
A: Yes, the ESP32 can be powered by a LiPo battery connected to the VIN pin. Use a voltage regulator if necessary.

Q: How do I use Bluetooth on the ESP32?
A: The ESP32 supports both Bluetooth Classic and BLE. Use the BluetoothSerial or BLE libraries in the Arduino IDE to implement Bluetooth functionality.

Q: Can I use the ESP32 with sensors that output 5 V signals?
A: No, the ESP32 operates at 3.3 V logic levels. Use a voltage divider or level shifter to step down 5 V signals.

For more details, refer to the official ESP32 datasheet.