ESP32 Introduction & Hardware Overview
What is ESP32?
ESP32 is a low-cost, low-power system-on-chip (SoC) microcontroller developed by Espressif Systems. It's the successor to the popular ESP8266 and has become the go-to choice for IoT projects, wearables, and connected devices.
Why ESP32 for Product Development?
| Advantage | Description |
|---|---|
| Cost-effective | Modules start at ~$2-3 in quantity |
| Integrated WiFi/Bluetooth | No external wireless modules needed |
| Powerful processor | Dual-core 240MHz, handles complex tasks |
| Rich peripherals | ADC, DAC, PWM, touch sensors, and more |
| Low power modes | Essential for battery-powered products |
| Mature ecosystem | Extensive libraries, community support |
| Production-ready | Pre-certified modules available |
| Scalable | Same codebase from prototype to production |
ESP32 Family Overview
Espressif has released several variants. Understanding them helps you choose the right chip for your product.
ESP32 (Original)
The classic ESP32, still widely used.
Cores: 2x Xtensa LX6 @ 240MHz
SRAM: 520 KB
Flash: External, typically 4MB
WiFi: 802.11 b/g/n (2.4GHz)
Bluetooth: Classic + BLE 4.2
GPIO: 34 pins
ADC: 18 channels (12-bit)
DAC: 2 channels (8-bit)
Touch: 10 capacitive touch pins
Temperature: -40°C to 85°C (industrial versions to 125°C)
Best for: General IoT, when you need both WiFi and Classic Bluetooth
ESP32-S2
Single-core, USB native, lower power.
Cores: 1x Xtensa LX7 @ 240MHz
SRAM: 320 KB
Flash: External, typically 4MB
WiFi: 802.11 b/g/n (2.4GHz)
Bluetooth: None
USB: Native USB OTG
GPIO: 43 pins
ADC: 20 channels (13-bit)
DAC: 2 channels (8-bit)
Touch: 14 capacitive touch pins
Best for: USB devices, HID applications, lower power WiFi-only devices
ESP32-S3
Enhanced AI/ML capabilities, USB native.
Cores: 2x Xtensa LX7 @ 240MHz
SRAM: 512 KB + 8MB PSRAM option
Flash: External, up to 16MB
WiFi: 802.11 b/g/n (2.4GHz)
Bluetooth: BLE 5.0
USB: Native USB OTG
GPIO: 45 pins
ADC: 20 channels (12-bit)
Vector Instructions: Yes (AI acceleration)
Best for: AI/ML edge computing, camera applications, USB devices with BLE
ESP32-C3
RISC-V architecture, cost-optimized.
Cores: 1x RISC-V @ 160MHz
SRAM: 400 KB
Flash: External, typically 4MB
WiFi: 802.11 b/g/n (2.4GHz)
Bluetooth: BLE 5.0
GPIO: 22 pins
ADC: 6 channels (12-bit)
Best for: Cost-sensitive WiFi/BLE products, simpler applications
ESP32-C6
WiFi 6 and Thread/Zigbee support.
Cores: 1x RISC-V @ 160MHz + 1x low-power RISC-V
SRAM: 512 KB
Flash: External, typically 4MB
WiFi: 802.11 ax (WiFi 6, 2.4GHz)
Bluetooth: BLE 5.0
802.15.4: Thread, Zigbee, Matter
GPIO: 30 pins
ADC: 7 channels (12-bit)
Best for: Smart home (Matter), Thread/Zigbee mesh, WiFi 6 requirements
ESP32-H2
Thread/Zigbee focused, no WiFi.
Cores: 1x RISC-V @ 96MHz
SRAM: 320 KB
Flash: External, typically 4MB
WiFi: None
Bluetooth: BLE 5.0
802.15.4: Thread, Zigbee, Matter
GPIO: 26 pins
Best for: Battery-powered Thread/Zigbee devices, Matter accessories
Comparison Chart
| Feature | ESP32 | ESP32-S2 | ESP32-S3 | ESP32-C3 | ESP32-C6 | ESP32-H2 |
|---|---|---|---|---|---|---|
| CPU | LX6 Dual | LX7 Single | LX7 Dual | RISC-V | RISC-V | RISC-V |
| MHz | 240 | 240 | 240 | 160 | 160 | 96 |
| WiFi | 4 | 4 | 4 | 4 | 6 | No |
| BT Classic | Yes | No | No | No | No | No |
| BLE | 4.2 | No | 5.0 | 5.0 | 5.0 | 5.0 |
| Thread | No | No | No | No | Yes | Yes |
| USB Native | No | Yes | Yes | No | No | No |
| Price* | $$ | $ | $$$ | $ | $$ | $ |
*Relative pricing, actual costs vary by volume and distributor
Development Boards
When prototyping, you'll use a development board rather than the bare chip. Here are the main options:
Official Espressif Boards
ESP32-DevKitC
The standard reference board.
- Direct USB programming
- All GPIO pins exposed
- Built-in USB-to-UART bridge
- Breadboard-friendly (barely)
- Recommended for beginners
ESP32-DevKitM
Compact version with ESP32-MINI module.
- Smaller form factor
- Fewer exposed pins
- Good for space-constrained prototypes
Popular Third-Party Boards
NodeMCU-32S
- Similar to DevKitC
- Different pin layout
- Wide community support
WROOM vs WROVER Modules
WROOM: Standard module, external flash only
- ESP32-WROOM-32E (latest revision)
- Most common choice
- 4MB flash typical
WROVER: Includes PSRAM (extra RAM)
- ESP32-WROVER-E (latest revision)
- 8MB PSRAM
- Needed for: camera, audio buffers, large data
Specialized Boards
| Board | Specialty | Use Case |
|---|---|---|
| ESP32-CAM | OV2640 camera | Vision projects |
| TTGO T-Display | Built-in LCD | Quick UI prototypes |
| LilyGO T-Beam | GPS + LoRa | Tracking, mesh |
| M5Stack | Modular + screen | Rapid prototyping |
| Adafruit Feather | Battery management | Portable devices |
Choosing a Development Board
For Learning:
- ESP32-DevKitC v4 or NodeMCU-32S
- Widely documented, community support
For Product Prototyping:
- Choose based on your target chip (S3, C3, etc.)
- Consider form factor for enclosure design
- Check if you need PSRAM
For Quick Demos:
- M5Stack or TTGO with display
- Faster iteration, built-in UI
ESP32 Pinout Deep Dive
Understanding the pinout is critical for hardware design.
GPIO Overview (ESP32 Original)
Total GPIO: 34 pins
Input only: GPIO 34, 35, 36, 39
Input/Output: All others
Touch capable: GPIO 0, 2, 4, 12, 13, 14, 15, 27, 32, 33
ADC1: GPIO 32-39 (available with WiFi)
ADC2: GPIO 0, 2, 4, 12-15, 25-27 (NOT available with WiFi!)
DAC: GPIO 25, 26
Pin Categories
Boot Configuration Pins
These affect boot behavior, so be careful!
| GPIO | Function | Safe to Use? |
|---|---|---|
| GPIO 0 | Boot mode | Pull-up, avoid LOW at boot |
| GPIO 2 | Boot mode | Must be LOW or floating at boot |
| GPIO 12 | Flash voltage | Keep LOW at boot for 3.3V flash |
| GPIO 15 | Silence boot log | Pull-up to silence UART output |
Strapping Pins Summary
GPIO 0: LOW = Download mode, HIGH = Normal boot
GPIO 2: Should be LOW or floating at boot
GPIO 5: SDIO timing (usually fine to use)
GPIO 12: Flash voltage select (keep LOW for most boards)
GPIO 15: Silences boot messages if LOW
Safe GPIO for General Use
These pins have no boot restrictions:
GPIO 4, 13, 14, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32, 33
Input-Only Pins
GPIO 34, 35, 36, 39
- No internal pull-up/pull-down
- Often used for analog input
- Cannot drive outputs
ADC Considerations
ADC1 (Use with WiFi):
- Channels: GPIO 32, 33, 34, 35, 36, 39
- Always available
ADC2 (Conflicts with WiFi):
- Channels: GPIO 0, 2, 4, 12, 13, 14, 15, 25, 26, 27
- Cannot use while WiFi is active!
- Plan accordingly for IoT devices
ADC Characteristics:
- 12-bit resolution (0-4095)
- Non-linear response (needs calibration)
- Reference voltage ~1.1V (attenuated to 3.3V)
- Noisy, so average multiple readings
SPI Pins
ESP32 has multiple SPI interfaces:
VSPI (SPI3) - Default for user applications:
MOSI: GPIO 23
MISO: GPIO 19
CLK: GPIO 18
CS: GPIO 5 (or any GPIO)
HSPI (SPI2) - Alternative:
MOSI: GPIO 13
MISO: GPIO 12
CLK: GPIO 14
CS: GPIO 15
I2C Pins
Software-configurable (any GPIO), but defaults:
SDA: GPIO 21
SCL: GPIO 22
UART Pins
UART0 (Programming/Debug):
TX: GPIO 1
RX: GPIO 3
UART1 (User available):
TX: GPIO 10 (default, often remapped)
RX: GPIO 9 (default, often remapped)
UART2 (User available):
TX: GPIO 17
RX: GPIO 16
Complete Pinout Reference
┌─────────────────┐
│ ESP32-WROOM │
│ │
EN ──────┤ 1 38 ├────── GPIO 23 (VSPI MOSI)
(Input) GPIO 36 ─┤ 2 37 ├────── GPIO 22 (I2C SCL)
(Input) GPIO 39 ─┤ 3 36 ├────── GPIO 1 (TX0)
(Input) GPIO 34 ─┤ 4 35 ├────── GPIO 3 (RX0)
(Input) GPIO 35 ─┤ 5 34 ├────── GPIO 21 (I2C SDA)
(Touch) GPIO 32 ─┤ 6 33 ├────── GND
(Touch) GPIO 33 ─┤ 7 32 ├────── GPIO 19 (VSPI MISO)
(DAC1) GPIO 25 ─┤ 8 31 ├────── GPIO 18 (VSPI CLK)
(DAC2) GPIO 26 ─┤ 9 30 ├────── GPIO 5 (VSPI CS)
(Touch) GPIO 27 ─┤ 10 29 ├────── GPIO 17 (TX2)
(HSPI) GPIO 14 ─┤ 11 28 ├────── GPIO 16 (RX2)
(HSPI) GPIO 12 ─┤ 12 27 ├────── GPIO 4 (Touch)
GND ──────┤ 13 26 ├────── GPIO 0 (Boot)
(HSPI) GPIO 13 ─┤ 14 25 ├────── GPIO 2 (LED/Boot)
(Flash) GPIO 9 ─┤ 15 24 ├────── GPIO 15 (HSPI CS)
(Flash) GPIO 10 ─┤ 16 23 ├────── GPIO 8 (Flash)
(Flash) GPIO 11 ─┤ 17 22 ├────── GPIO 7 (Flash)
5V ───────┤ 18 21 ├────── GPIO 6 (Flash)
GND ──────┤ 19 20 ├────── 3V3
└─────────────────┘
Note: GPIO 6-11 are used for flash - DO NOT USE
Electrical Specifications
Power Requirements
Operating Voltage: 3.0V - 3.6V (3.3V typical)
I/O Voltage: 3.3V (NOT 5V tolerant!)
Current (Active WiFi): 80-240mA
Current (Active BLE): 27-100mA
Current (Deep Sleep): 10µA
Current (Hibernation): 5µA
GPIO Electrical Characteristics
Output High (VOH): ~3.3V (VDD)
Output Low (VOL): ~0V
Max Output Current: 40mA per pin (20mA recommended)
Total GPIO Current: 1.2A max (all pins combined)
Input High (VIH): >2.5V (0.75 × VDD)
Input Low (VIL): <0.8V (0.25 × VDD)
Internal Pull-up: ~45kΩ
Internal Pull-down: ~45kΩ
Level Shifting for 5V Devices
ESP32 is 3.3V only! For 5V peripherals:
For Inputs (5V → 3.3V):
- Voltage divider (2:1 ratio)
- Level shifter IC (TXS0108E, 74LVC245)
For Outputs (3.3V → 5V):
- Level shifter IC
- Many 5V devices accept 3.3V logic
5V Input to ESP32 (Voltage Divider):
5V Signal ──┬── 10kΩ ──┬── ESP32 GPIO
│ │
GND 20kΩ
│
GND
Output: 5V × (20k/(10k+20k)) = 3.33V
Module Options for Production
When moving from development board to product, you'll use a module.
Popular Modules
| Module | Chip | Flash | PSRAM | Antenna | Certification |
|---|---|---|---|---|---|
| ESP32-WROOM-32E | ESP32 | 4/8/16MB | No | PCB | FCC, CE |
| ESP32-WROVER-E | ESP32 | 8/16MB | 8MB | PCB | FCC, CE |
| ESP32-WROOM-32UE | ESP32 | 4/8/16MB | No | U.FL | FCC, CE |
| ESP32-S3-WROOM-1 | ESP32-S3 | 4/8/16MB | 2/8MB | PCB | FCC, CE |
| ESP32-C3-MINI-1 | ESP32-C3 | 4MB | No | PCB | FCC, CE |
Certification Advantage
Using pre-certified modules (like WROOM) means:
- No RF testing required for your product (intentional radiator)
- Faster time to market
- Lower certification costs
- Must follow module placement guidelines
Custom Design Considerations
If designing your own module (advanced):
- Full RF certification required
- Antenna design critical
- EMC compliance testing
- Higher NRE costs
- Only for very high volumes
Summary: Choosing Your ESP32
Decision Flowchart
Need Bluetooth Classic?
├── Yes → ESP32 (Original)
└── No
└── Need WiFi?
├── No → ESP32-H2 (Thread/BLE only)
└── Yes
└── Need USB?
├── Yes
│ └── Need BLE?
│ ├── Yes → ESP32-S3
│ └── No → ESP32-S2
└── No
└── Need Thread/Matter?
├── Yes → ESP32-C6
└── No
└── Cost priority?
├── Yes → ESP32-C3
└── No → ESP32-S3
Quick Recommendations
| Use Case | Recommended Chip |
|---|---|
| General IoT | ESP32-C3 or ESP32 |
| Smart Home (Matter) | ESP32-C6 |
| Camera/Vision | ESP32-S3 |
| USB HID Device | ESP32-S2 or S3 |
| Battery Device | ESP32-C3 or H2 |
| Audio Streaming | ESP32 (Classic BT) |
| Cost-Optimized | ESP32-C3 |
| Maximum GPIO | ESP32-S3 |