1. Getting Started
1. Getting Started

Introduction #

In this tutorial we will be looking at how get started with ESP32 development on Windows. We will be installing the Espressif IoT Development Framework (esp-idf), building a simple Hello World application and then programming it to an ESP32 development board. For this tutorial you’ll need:

  • Windows PC
    • with Python v3 installed
  • Any ESP32 development board

ESP-IDF Installation #

Let’s start by installing ESP-IDF, which we’ll do by using Espressif’s ESP-IDF Tools Installer:

ESP-IDF Tools Installer Download

Open up the installer we just downloaded and accept the license agreement and after the pre-installation system check, click Next. Start by either selecting an installation of Git on your system (as is the case for us), or select Install Git if you don’t already have it installed:

ESP-IDF Tools Installer - Git

Click Next and Select Download ESP-IDF:

ESP-IDF Tools Installer - ESP-IDF

Click Next again and select the latest release version of ESP-IDF and select a location to download it to. We’ll be downloading version 4.2 to C:\esp-idf:

ESP-IDF Tools Installer - ESP-IDF Download

Click Next and select a location to install the ESP-IDF Tools, we’ll be installing to C:\esp-idf-tools:

ESP-IDF Tools Installer - ESP-IDF Tools Download

Click Next and select any shortcuts you’d like to create, leave Optimisation turned off and click Next. Finally we’ll get a summary of what we’re going to install:

ESP-IDF Tools Installer - Summary

If you’re happy with everything then click Install:

ESP-IDF Tools Installer - Install

ESP-IDF Configuration #

Once installation is complete, ensure Run ESP-IDF Command Prompt Environment is selected and click Finish:

ESP-IDF Tools Installer - Finish

The command prompt will open and automatically add our ESP-IDF tools directories to the system PATH:

Add ESP-IDF Tools to PATH

Example Build – Command Line #

Now that we have everything setup, let’s build our first project from the command line. If you close the ESP-IDF Command Prompt and want to get back to it later, just find it in your Start Menu:

ESP-IDF Command Prompt Start Menu Entry

Navigate to examples\get-started\hello_world and if you are using an ESP32 skip to the next step. If you are using an ESP32-S2 like us, type: idf.py set-target esp32s2

ESP-IDF Build Set Target

Once done we can now build our project, so type: idf.py build

ESP-IDF Build

Then wait for the project to build, this will take a few minutes:

ESP-IDF Building

Once complete we can then flash our example project by typing idf.py -p (PORT) flash where PORT is your the COM port of your ESP32 device, in our case this is COM15:

ESP-IDF Flashing

Now open up a serial terminal and connect to your ESP32 device with a baudtrate of 115200 and you should see Hello World outputted after the device starts up:

Hello World Example Serial Output

Example Project Config #

If you want to alter the baud rate of the serial output, Type: idf.py menuconfig

Then head to Serial Flasher Config > idf.py monitor’ baud rate and change the baud rate to your preferred speed:

ESP-IDF Menuconfig

Press Q on your keyboard to quit and press Y to save the configuration as we leave. Now we can re-build and re-flash. Type: idf.py -p (PORT) flash

Note that the flash command will automatically build the project again if needed.