How to Upload Code on ESP32 Using Arduino IDE – Complete Beginner Step-by-Step Guide

Introduction

ESP32 is one of the most powerful and popular Wi-Fi + Bluetooth microcontroller boards used in IoT, automation, and smart electronics projects. Many beginners face confusion while uploading code to ESP32 using Arduino IDE because ESP32 boards do not come pre-installed in Arduino IDE by default.

In this tutorial, I will explain everything in a easy and beginner-friendly way—from understanding the ESP32 module, installing required board packages, and finally uploading code successfully without errors. If you follow each step carefully, you will be able to upload code to ESP32 as well as ESP8266 using Arduino IDE without any problem.

WATCH COMPLETE VIDEO


Step 1: Know About ESP32 Module Before Uploading Code

Before learning how to upload code, it is important to understand what ESP32 is and why it is so powerful.

What is ESP32?

ESP32 is a low-cost, low-power microcontroller developed by Espressif Systems. It comes with built-in Wi-Fi and Bluetooth, making it ideal for IoT and smart device applications.

Key Features of ESP32

  • Built-in Wi-Fi (2.4 GHz) and Bluetooth (Classic + BLE)
  • Dual-core processor (in most variants)
  • High processing speed
  • Supports Arduino IDE, MicroPython, and ESP-IDF
  • Large community and library support

ESP32 Pin Details (30-Pin Module)

A standard ESP32 Dev Module comes with 30 pins, which include:

  • Power Pins: 3.3V, VIN, GND
  • Digital GPIO Pins: GPIO 0 to GPIO 39
  • Analog Pins: ADC supported pins for sensor reading
  • PWM Pins: For motor and LED control
  • UART Pins: RX, TX for serial communication
  • SPI & I2C Pins: For display, sensors, and memory modules

This wide range of pins makes ESP32 suitable for complex electronics projects.

Internet Connectivity

ESP32 connects directly to the internet using Wi-Fi without any external module. This allows you to:

  • Build web servers
  • Send sensor data to cloud
  • Control devices remotely
  • Create smart home systems


Step 2: Brief About ESP8266 Module

ESP8266 is another popular Wi-Fi microcontroller module.

ESP8266 in Brief

  • Single-core processor
  • Built-in Wi-Fi only (no Bluetooth)
  • Fewer GPIO pins compared to ESP32
  • Low cost and easy to use
  • Best for simple IoT projects

ESP32 is more powerful, but ESP8266 is still widely used for basic Wi-Fi-based applications.


Step 3: Connect ESP32 to Laptop

  1. Connect Micro USB cable to ESP32
  2. Connect the other end to your laptop or PC
  3. Once connected, the red LED on ESP32 will start glowing, indicating power supply is active

Now open Arduino IDE on your system.

Important: Make sure your system is connected to the internet, as we need to download board files.


Step 4: Why ESP32 Board is Not Visible in Arduino IDE

By default, Arduino IDE does not include ESP32 or ESP8266 boards. That’s why when you go to:

Tools → Board,
you will not find ESP32 or ESP8266.

So we need to manually add these boards.


Step 5: Add ESP32 Board URL in Arduino IDE

  1. Open Arduino IDE
  2. Go to File → Preferences
  3. Find “Additional Boards Manager URLs”
  4. Copy and paste the ESP32 board URL:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

            5. Click OK

This step allows Arduino IDE to download ESP32 board files.


Step 6: Install ESP32 Board in Arduino IDE

  1. Go to Tools → Board → Board Manager
  2. A new window will open
  3. In the search bar, type ESP32
  4. Select ESP32 by Espressif Systems
  5. Choose the latest version
  6. Click Install

Within a few seconds, ESP32 board support will be installed successfully.


Step 7: Select ESP32 Board

  1. Go to Tools → Board
  2. Scroll down and find ESP32 Arduino
  3. Select your board type

I am using ESP32 Dev Module, so I select:
ESP32 → ESP32 Dev Module

Now Arduino IDE is ready to upload code.


Step 8: Upload Code to ESP32

  1. Write or open your ESP32 code
  2. Click on the Upload button
  3. During uploading, you may see an error

Fix Upload Error (Boot Button Solution)

  • Press and hold the BOOT button on ESP32
  • Keep holding until code starts uploading
  • Release the button once uploading begins

Now the code will upload successfully without any issue.


Step 9: Upload Code to ESP8266 (Same Method)

Using the same process, you can:

  • Add ESP8266 board URL
  • Install ESP8266 from Board Manager
  • Select ESP8266 board
  • Upload code easily

This makes Arduino IDE a single platform to program both ESP32 and ESP8266 Wi-Fi modules.

WATCH COMPLETE VIDEO ON YOUTUBE


Conclusion

In this tutorial, we learned how to upload code on ESP32 using Arduino IDE in a clear and professional step-by-step manner. We also understood ESP32 features, pin details, internet connectivity, and how to fix common upload errors using the BOOT button. With the same method, you can also upload code to ESP8266 boards.

I hope you understood everything clearly and found this tutorial helpful.
Let me know your comments or suggestions regarding this tutorial.
Happy Coding!!

Post a Comment

0 Comments