The ESP32 is a powerful and versatile microcontroller developed by Espressif Systems. It features integrated Wi-Fi and Bluetooth capabilities, making it an excellent choice for Internet of Things (IoT) applications, smart devices, and embedded systems. With its 30-pin configuration, the ESP32 provides a wide range of input/output (I/O) options, enabling developers to connect sensors, actuators, and other peripherals with ease.
Explore Projects Built with ESP32 (30 pin)
Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
This circuit features two ESP32 microcontrollers, one standard 30-pin version and one ESP32-CAM module, both sharing a common ground and power supply. The 30-pin ESP32 is interfaced with an I2C LCD 16x2 Screen for display purposes, using its I2C pins (D21 for SDA and D22 for SCL), and controls a buzzer connected to pin D23. Additionally, the ESP32-CAM is connected to the 30-pin ESP32 via serial communication through pins TX2 and RX2 for potential image data transfer.
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.
This circuit features an ESP32 microcontroller connected to an OLED 1.3" display. The ESP32's GPIO pins 21 and 22 are used for I2C communication (SDA and SCL respectively) with the OLED display. The display is powered by the 5V output from the ESP32, and both devices share a common ground.
This circuit features an ESP32 microcontroller as the central processing unit, interfacing with a DHT11 temperature and humidity sensor, an MPU-6050 accelerometer and gyroscope, an OLED display, and a separate temperature sensor. The ESP32 communicates with the MPU-6050 and the OLED display via I2C (using pins D22 and D21 for SCL and SDA, respectively), reads temperature data from the DHT11 sensor through pin D18, and interfaces with the additional temperature sensor via pin D5. All components share a common power supply connected to the ESP32's Vin pin and a common ground.
Power Consumption: Ultra-low power consumption in deep sleep mode (~10 µA)
Pin Configuration and Descriptions
The ESP32 (30-pin variant) has a standard pinout. Below is a table describing the key pins:
Pin Name
Function
Description
VIN
Power Input
Accepts 5V input to power the ESP32.
GND
Ground
Ground connection.
3V3
Power Output
Provides 3.3V output for external components.
EN
Enable
Enables or disables the chip. Active high.
GPIO0
Input/Output, Boot Mode Select
Used for boot mode selection during programming.
GPIO1 (TX0)
UART TX
UART0 transmit pin.
GPIO3 (RX0)
UART RX
UART0 receive pin.
GPIO2
Input/Output, ADC, PWM
General-purpose I/O, supports ADC and PWM.
GPIO4
Input/Output, ADC, PWM
General-purpose I/O, supports ADC and PWM.
GPIO5
Input/Output, ADC, PWM
General-purpose I/O, supports ADC and PWM.
GPIO12-15
Input/Output, ADC, PWM, SPI
General-purpose I/O, supports ADC, PWM, and SPI communication.
GPIO16-19
Input/Output, ADC, PWM, I2C
General-purpose I/O, supports ADC, PWM, and I2C communication.
GPIO21-23
Input/Output, ADC, PWM, I2C, SPI
General-purpose I/O, supports ADC, PWM, I2C, and SPI communication.
GPIO25-27
Input/Output, ADC, PWM, DAC
General-purpose I/O, supports ADC, PWM, and DAC (GPIO25 and GPIO26 only).
GPIO32-39
Input/Output, ADC, PWM
General-purpose I/O, supports ADC and PWM.
BOOT
Boot Mode Select
Used to enter bootloader mode for programming.
Note: Some GPIO pins have specific restrictions or are used internally by the ESP32. Refer to the datasheet for detailed pin functionality.
Usage Instructions
How to Use the ESP32 in a Circuit
Powering the ESP32:
Use a USB cable to supply 5V via the micro-USB port.
Alternatively, provide 5V to the VIN pin or 3.3V to the 3V3 pin.
Connecting Peripherals:
Use the GPIO pins for connecting sensors, actuators, or other devices.
Ensure that the voltage levels of connected devices are compatible with the ESP32's 3.3V logic.
Programming the ESP32:
Install the Arduino IDE and add the ESP32 board package.
Connect the ESP32 to your computer via USB.
Select the correct board and port in the Arduino IDE.
Write and upload your code.
Using Communication Protocols:
Use I2C, SPI, or UART pins to interface with external modules like displays, sensors, or communication modules.
Important Considerations
Voltage Levels: The ESP32 operates at 3.3V logic. Avoid connecting 5V signals directly to GPIO pins.
Boot Mode: Hold the BOOT button while pressing the EN button to enter bootloader mode for programming.
Power Supply: Ensure a stable power supply to avoid unexpected resets or malfunctions.
Example Code: Blinking an LED
Below is an example of how to blink an LED connected to GPIO2 using the Arduino IDE:
// Define the GPIO pin where the LED is connected
const int ledPin = 2;
void setup() {
// Set the LED pin as an output
pinMode(ledPin, OUTPUT);
}
void loop() {
// Turn the LED on
digitalWrite(ledPin, HIGH);
delay(1000); // Wait for 1 second
// Turn the LED off
digitalWrite(ledPin, LOW);
delay(1000); // Wait for 1 second
}
Tip: Replace GPIO2 with the pin number where your LED is connected.
Troubleshooting and FAQs
Common Issues
ESP32 Not Detected by Computer:
Ensure the USB cable is functional and supports data transfer.
Install the correct USB-to-serial driver for your operating system.
Upload Fails with Timeout Error:
Check that the correct board and port are selected in the Arduino IDE.
Hold the BOOT button while uploading the code.
ESP32 Keeps Resetting:
Verify that the power supply is stable and sufficient.
Avoid connecting peripherals that draw excessive current.
Wi-Fi Connection Issues:
Double-check the SSID and password in your code.
Ensure the Wi-Fi network is within range.
FAQs
Q: Can I power the ESP32 with a 5V power supply?
A: Yes, you can power the ESP32 via the VIN pin or the USB port with a 5V supply. However, the GPIO pins operate at 3.3V logic.
Q: How do I use the ESP32's Bluetooth functionality?
A: The ESP32 supports both Bluetooth Classic and BLE. Use the Arduino IDE's Bluetooth libraries or Espressif's ESP-IDF framework to implement Bluetooth functionality.
Q: Can I use the ESP32 with a 5V sensor?
A: Use a level shifter to safely interface 5V sensors with the ESP32's 3.3V GPIO pins.
Q: What is the maximum current the ESP32 can source/sink on a GPIO pin?
A: Each GPIO pin can source/sink up to 12 mA. For higher currents, use an external transistor or driver circuit.
By following this documentation, you can effectively use the ESP32 (30-pin variant) in your projects and troubleshoot common issues with ease.