Getting Started with ESP32: GPIO, WiFi, and Your First Project
esp32arduinomicrocontrollergetting startedwifigpioiottutorialbeginner
The ESP32 is the most capable entry-level microcontroller available. Dual-core 240 MHz, WiFi, Bluetooth, 34 GPIO pins, under $5. Here's how to go from unboxing to your first WiFi-connected project.
Which Board?
The ESP32 DevKitC (38-pin) is the standard. Most tutorials use it. All pins broken out with clear labels.
Setting Up Arduino IDE
- Download Arduino IDE from arduino.cc
- In Preferences, add to Board Manager URLs:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json - Tools → Board Manager → search 'esp32' → install 'esp32 by Espressif Systems'
- Tools → Board → ESP32 → 'ESP32 Dev Module'
- Select your COM port
First Upload: Blink
void setup() {
pinMode(2, OUTPUT);
}
void loop() {
digitalWrite(2, HIGH); delay(1000);
digitalWrite(2, LOW); delay(1000);
}
If upload fails, hold the BOOT button while clicking upload, release when 'Connecting...' shows.
GPIO Key Points
- GPIO 0, 2, 15: Boot-mode pins — avoid as inputs at startup
- GPIO 34–39: Input-only, no pullup/pulldown
- ADC2 pins: Unavailable when WiFi active — use ADC1 (GPIO 32–39)
- 3.3V logic: ESP32 is NOT 5V tolerant
See the full ESP32 DevKitC pinout reference on this site.
Connect to WiFi
#include <WiFi.h>
void setup() {
Serial.begin(115200);
WiFi.begin("SSID", "password");
while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }
Serial.println("\nConnected! IP: " + WiFi.localIP().toString());
}
Common Problems
Port not detected: Install CP2102 or CH340 USB driver. Upload fails: Hold BOOT button during upload start. WiFi won't connect: ESP32 only supports 2.4 GHz. Crashes on WiFi + ADC: Use ADC1 pins (GPIO 32–39) when WiFi is active.