Let me guess — you’re tired of always grabbing a USB cable just to upload code to your ESP32. Been there, done that! 😅 What if I told you there’s a magical way to update your ESP32 firmware wirelessly, using nothing but Wi-Fi? Yup, it’s called OTA (Over-The-Air) updates, and once you set it up, you’ll wonder how you ever lived without it.
In this article, I’ll walk you through everything you need to know to set up OTA updates for your ESP32 using the Arduino IDE. No fluff — just straight-up useful info.

What is OTA (Over-The-Air) Firmware Update?
OTA allows you to upload new firmware to your ESP32 without physically connecting a USB cable. The ESP32 receives the firmware through Wi-Fi, updates itself, and you’re good to go. It’s fast, efficient, and super handy for remote devices.
What You’ll Need:
- ESP32 board (any model)
- Arduino IDE (latest version recommended)
- USB cable (just this once!)
- Wi-Fi network (with stable signal)
Step-by-Step Setup Guide
Step 1: Configure the Partition Scheme
Before anything else, we need to allow enough space for OTA updates in the ESP32’s flash memory.
- Open Arduino IDE.
- Go to Tools > Partition Scheme
- Select “Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)”
This partition scheme gives enough space for the firmware and OTA updates.
Step 2: Initial USB Upload (Setup OTA Code)
You still need to upload the OTA handler code once via USB so it can handle future wireless updates.
Here’s a simple sketch to get started:
#include <WiFi.h>
#include <ArduinoOTA.h>
const char* ssid = "Your_SSID"; // Replace with your Wi-Fi SSID
const char* password = "Your_Password"; // Replace with your Wi-Fi Password
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("\nWiFi Connected");
Serial.println(WiFi.localIP());
ArduinoOTA.setHostname("ESP32_OTA_Device"); // Optional: give it a custom name
ArduinoOTA.begin();
Serial.println("OTA Ready");
}
void loop() {
ArduinoOTA.handle();
}
Upload this via USB. Once done, the ESP32 will be ready to accept wireless uploads!
Step 3: Upload via Wi-Fi 📡
Once your ESP32 is connected to Wi-Fi and running the OTA code:
- In Arduino IDE, go to Tools > Port
- You should now see a network port like
ESP32_OTA_Device at 192.168.X.X
- Select that port.
- Upload your next sketch wirelessly!
You can now code from your couch, bed, or even another country (if your network allows it 😉).
Pro Tips for Smooth OTA Magic
✅ Unique Hostnames for Each Device
If you have multiple ESP32s on your network, always set a unique hostname for each one:
ArduinoOTA.setHostname("ESP32_LivingRoom");
✅ Prevent Auto Reboot
If you’re running a critical operation and want more control over reboots:
ArduinoOTA.setRebootOnSuccess(false);
This ensures the ESP32 won’t reboot automatically after an OTA update — you can handle it manually.
✅ Keep ESP32 Close to the Router
OTA uploads are Wi-Fi dependent, so a weak signal = failed uploads. Try to keep your ESP32 within 2-3 meters (at least for uploads).
✅ Troubleshooting Tips
- If OTA fails, press the RESET button on your ESP32 and retry.
- Make sure the device is still connected to Wi-Fi.
- Check that your PC and ESP32 are on the same local network.
- Restart Arduino IDE to refresh the network ports.
Conclusion
You’ve now unlocked the secret to wireless firmware uploads with your ESP32. Once OTA is set up, updating your projects becomes fast, flexible, and so much more fun.
So ditch the USB cable (well, almost 😄) and enjoy cable-free development from now on.
Happy coding! 💻📶