- â Adding ESP32 support to Arduino IDE
- â Understanding ESP32 variants (ESP32, ESP32-S2, ESP32-S3, ESP32-C3)
- â Selecting the correct board for your ESP32 device
- â Configuring upload settings for ESP32
- â Troubleshooting common ESP32 issues
Introduction to the ESP32
The ESP32 is the more powerful successor to the ESP8266. Released by Espressif in 2016, it added Bluetooth, dual-core processing, more GPIO pins, and better analog-to-digital converters. Today, it's the go-to choice for advanced IoT projects.
| Feature | ESP8266 | ESP32 |
|---|---|---|
| Processor | Single-core 80/160 MHz | Dual-core 240 MHz |
| Bluetooth | No | Yes (BLE + Classic) |
| GPIO Pins | 16 | 34+ |
| Analog Inputs | 1 (10-bit) | 18 (12-bit) |
| RAM | 80 KB | 520 KB |
| Flash | 4 MB (external) | 4-16 MB (external) |
ESP32 Board Variants
OceanRemote supports the most popular ESP32 development boards:
- ESP32 Dev Module - The standard development board with 30 or 36 pins. Most common variant.
- ESP32-WROOM-32 - The original ESP32 module with 4MB flash.
- ESP32-WROVER - Includes 4MB PSRAM for larger applications.
- ESP32-S2/S3/C3 - Newer variants with different features (USB-OTG, better security, etc.)
- LOLIN D32 - Popular board from WEMOS.
- NodeMCU-32S - NodeMCU-style ESP32 board.
For most projects, get a standard ESP32 Dev Module (30-pin) or ESP32-WROOM-32. They're widely available ($8-12) and fully compatible with OceanRemote.
Step 1: Add ESP32 to Arduino IDE
If you haven't already done this in Tutorial 04, here's a detailed walkthrough:
- Open Arduino IDE
- Go to File â Preferences (Windows/Linux) or Arduino IDE â Settings (Mac)
- In the "Additional Boards Manager URLs" field, add the ESP32 URL:
If you already have the ESP8266 URL, separate them with a comma:
- Click OK
- Go to Tools â Board â Boards Manager
- Search for "esp32"
- Find "esp32 by Espressif Systems" and click Install
- Wait for installation to complete (5-10 minutes - the package is large ~500MB)
The ESP32 package is about 500MB and can take 5-10 minutes to download on slower connections. Be patient!
Step 2: Selecting Your ESP32 Board
After installation, you'll see many ESP32 board options. Here's what to select for OceanRemote:
For Generic ESP32 Dev Module (Most Common)
- Go to Tools â Board â ESP32 Arduino
- Select "ESP32 Dev Module"
- This works with 95% of generic ESP32 boards
For ESP32-WROOM-32
- Select "ESP32-WROOM-32 Module"
For NodeMCU-32S
- Select "NodeMCU-32S"
For LOLIN D32
- Select "LOLIN D32"
If you're unsure, select "ESP32 Dev Module". It works with almost all ESP32 boards. The main difference between options is the default flash size and partition layout.
Step 3: Configuring Board Settings
Once you've selected your board, configure these settings:
- Upload Speed:
921600(or115200for better reliability) - CPU Frequency:
240 MHz (WiFi/BT)- Full speed with radio - Flash Size:
4MB (32Mb)or match your board's flash - Partition Scheme:
Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) - Core Debug Level:
None - PSRAM:
Disabled(unless your board has PSRAM, then enable) - Arduino Runs On:
Core 1(leaves Core 0 for WiFi stack) - Events Run On:
Core 1 - Erase All Flash Before Sketch Upload:
Disabled(only enable if you need to clear everything) - Port: Select your COM port (Windows) or /dev/cu.usbserial-* (Mac) or /dev/ttyUSB0 (Linux)
If you're using a board with PSRAM (like ESP32-WROVER), set PSRAM: Enabled. This gives you extra memory for large applications.
Step 4: Installing Required Libraries for ESP32
OceanRemote firmware requires these libraries for ESP32:
- Go to Sketch â Include Library â Manage Libraries
- Search for and install each library:
- ArduinoJson by Benoit Blanchon (version 6.x) - Required for all devices
- DHT sensor library by Adafruit - Required only if using DHT22 sensor
- Adafruit Unified Sensor - Dependency for DHT library
- OneWire by Jim Studt - Required only if using DS18B20 sensor
- DallasTemperature by Miles Burton - Required only if using DS18B20 sensor
The ESP32 has built-in support for the DHT library. No special configuration needed.
Step 5: Testing Your ESP32
Before flashing OceanRemote firmware, test your setup with a simple blink sketch:
// ESP32 Blink Test
// The built-in LED is usually on GPIO2
void setup() {
pinMode(2, OUTPUT);
Serial.begin(115200);
Serial.println("ESP32 is alive!");
}
void loop() {
digitalWrite(2, HIGH); // LED ON (on many boards)
delay(1000);
digitalWrite(2, LOW); // LED OFF
delay(1000);
}
- Copy the code above into Arduino IDE
- Select your board (Tools â Board â ESP32 Arduino â ESP32 Dev Module)
- Select your port (Tools â Port)
- Click Verify (checkmark) to compile
- Click Upload (right arrow)
- Open Serial Monitor (Tools â Serial Monitor) at 115200 baud
- You should see "ESP32 is alive!" and the LED blinking
- "Failed to connect to ESP32: Timed out" - Hold the BOOT button on your board while uploading, then press EN/RST after upload starts
- "A fatal error occurred: Failed to connect to ESP32" - Check your port selection and USB cable
- "Invalid head of packet" - Lower upload speed to 115200
- "Uploading stub... Failed to write to target RAM" - Press and hold BOOT button until you see "Connecting..." then release
- Board not recognized - Install CP2102/CH340/FTDI drivers (Windows only)
ESP32 Pin Reference for OceanRemote
When generating firmware, OceanRemote uses these default pin mappings for ESP32:
| Relay | GPIO Pin | Notes |
|---|---|---|
| Relay 1 | GPIO2 | Built-in LED on many boards |
| Relay 2 | GPIO4 | Safe to use |
| Relay 3 | GPIO5 | Safe to use |
| Relay 4 | GPIO12 | Safe to use |
| Relay 5 | GPIO13 | Safe to use |
| Sensor (DHT/DS18B20) | GPIO15 | Connect data pin here |
| NTC Thermistor | GPIO34 (ADC1_CH6) | Analog input pin |
- GPIO0, GPIO2, GPIO5, GPIO12, GPIO15 - Have pull-up/down resistors at boot, use with caution
- GPIO34, 35, 36, 39 - Input only pins (no output)
- GPIO6-11 - Connected to internal flash, avoid using
- GPIO16, 17 - Used for PSRAM if enabled
For reliable operation, use GPIO2, GPIO4, GPIO5, GPIO12, GPIO13, GPIO14, GPIO15, GPIO18, GPIO19, GPIO21, GPIO22, GPIO23, GPIO25, GPIO26, GPIO27, GPIO32, GPIO33.
ESP32 Special Features
The ESP32 has several advanced features that OceanRemote takes advantage of:
- Dual-Core Processing - The ESP32 has two cores. OceanRemote runs WiFi on Core 0 and your application on Core 1 for better performance.
- Bluetooth - Future OceanRemote versions may support Bluetooth control.
- Deep Sleep - For battery-powered projects, the ESP32 can go into deep sleep (ΞA range) and wake on timer or external trigger.
- Touch Sensors - The ESP32 has built-in capacitive touch sensors on several pins.
- Hall Effect Sensor - Built-in magnetic field sensor.
Next Steps
Now that your ESP32 is ready, continue with:
- Tutorial 07: Setting Up Raspberry Pi Pico W
- Tutorial 08: Installing Required Libraries (detailed)
- Tutorial 09: Configuring Board Settings (detailed)
- Tutorial 12: ESP32 Pinout and Wiring Guide
Your ESP32 is now configured. Return to Tutorial 02 to generate and flash your first OceanRemote firmware!