The ESP32 (30 pin) is a powerful microcontroller designed for IoT and embedded system applications. It features built-in Wi-Fi and Bluetooth capabilities, making it an excellent choice for projects requiring wireless communication. With its 30 GPIO pins, the ESP32 offers a wide range of input/output functions, including ADC, DAC, PWM, I2C, SPI, UART, and more. Its versatility and high performance make it a popular choice among hobbyists and professionals alike.
The ESP32 (30 pin) has the following pinout:
Pin Name | Function | Description |
---|---|---|
VIN | Power Input | Input voltage (7-12V) for powering 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). |
IO0 | GPIO0 / Boot Mode | General-purpose I/O pin; used for boot mode selection during programming. |
IO2 | GPIO2 | General-purpose I/O pin. |
IO4 | GPIO4 | General-purpose I/O pin. |
IO5 | GPIO5 | General-purpose I/O pin. |
IO12 | GPIO12 / ADC2_CH5 / Touch5 | General-purpose I/O, ADC, or capacitive touch input. |
IO13 | GPIO13 / ADC2_CH4 / Touch4 | General-purpose I/O, ADC, or capacitive touch input. |
IO14 | GPIO14 / ADC2_CH6 / Touch6 | General-purpose I/O, ADC, or capacitive touch input. |
IO15 | GPIO15 / ADC2_CH3 / Touch3 | General-purpose I/O, ADC, or capacitive touch input. |
IO16 | GPIO16 | General-purpose I/O pin. |
IO17 | GPIO17 | General-purpose I/O pin. |
IO18 | GPIO18 / VSPI_CLK | General-purpose I/O or SPI clock pin. |
IO19 | GPIO19 / VSPI_MISO | General-purpose I/O or SPI MISO pin. |
IO21 | GPIO21 / I2C SDA | General-purpose I/O or I2C data pin. |
IO22 | GPIO22 / I2C SCL | General-purpose I/O or I2C clock pin. |
IO23 | GPIO23 / VSPI_MOSI | General-purpose I/O or SPI MOSI pin. |
IO25 | GPIO25 / DAC1 / ADC2_CH8 | General-purpose I/O, DAC, or ADC input. |
IO26 | GPIO26 / DAC2 / ADC2_CH9 | General-purpose I/O, DAC, or ADC input. |
IO27 | GPIO27 / ADC2_CH7 / Touch7 | General-purpose I/O, ADC, or capacitive touch input. |
IO32 | GPIO32 / ADC1_CH4 / Touch9 | General-purpose I/O, ADC, or capacitive touch input. |
IO33 | GPIO33 / ADC1_CH5 / Touch8 | General-purpose I/O, ADC, or capacitive touch input. |
IO34 | GPIO34 / ADC1_CH6 | Input-only pin, used for ADC. |
IO35 | GPIO35 / ADC1_CH7 | Input-only pin, used for ADC. |
RX0 | UART0 RX | UART0 receive pin. |
TX0 | UART0 TX | UART0 transmit pin. |
RST | Reset | Resets the microcontroller. |
Powering the ESP32:
Programming the ESP32:
Connecting Peripherals:
The following example demonstrates how to blink an LED connected to GPIO2:
// Blink an LED connected to GPIO2 on the ESP32
#define LED_PIN 2 // Define GPIO2 as the LED pin
void setup() {
pinMode(LED_PIN, OUTPUT); // Set GPIO2 as an output pin
}
void loop() {
digitalWrite(LED_PIN, HIGH); // Turn the LED on
delay(1000); // Wait for 1 second
digitalWrite(LED_PIN, LOW); // Turn the LED off
delay(1000); // Wait for 1 second
}
ESP32 Not Detected by Computer:
Upload Fails with "Failed to Connect" Error:
Unstable Behavior or Random Resets:
Wi-Fi Connection Issues:
Q: Can I use the ESP32 with 5V sensors?
A: Yes, but you need a level shifter to convert 5V signals to 3.3V.
Q: How do I reset the ESP32?
A: Press the "RST" button on the board or toggle the EN pin.
Q: Can the ESP32 run on batteries?
A: Yes, the ESP32 can run on batteries. Use deep sleep mode to conserve power.