How to setup ESP32 development environment for ESP-IDF (stable version) in Windows?

There is already many directions on how to install and begin development for ESP32 on Windows, but this is another one and it has our take on it!

Step 1: Toolchain

Download the ZIP file from Espressif as it contains an all-in-one toolchains that can help you up and running in minutes:

Unzip in your C:\ folder.

Run the MSYS2 MINGW32 terminal by launching the mingw32.exe

Type the following into the terminal to make a new directory
mkdir -p ~/esp

Then change directory to the new directory just made
cd ~/esp

Step 2: Get the ESP-IDF

Open the terminal MSYS2 MINGW32 that we downloaded earlier in the toolchain.

Enter the following to clone into the esp folder.

It will take a little while to finish downloading. Once completed, continue on.

Step 3: Change Windows Path to point to ESP-IDF

Use the IDF_PATH environment variable to setup in your Windows Paths.

Search for edit the system environment variables in Windows and this window should show up:

Click on Environment Variables.

Press on New... for “User variables for <Your Username>”

Make sure you enter ESP_IDF for Variable name.

Add the IDF_PATH path based on where you git cloned the esp-idf. For me, I cloned it in C:\

Close and reopen the MYSYS32 terminal and check to see if the path was setup successfully.

If the value shows up such as above example, then that means you have set it up correctly and ready to move to the next steps.

Step 4: Python Requirements

Run the following command as suggested by Espressif in a terminal:

python -m pip install --user -r $IDF_PATH/requirements.txt

Your terminal might say something else since I have already satisfied most of my requirements.

Step 5: Connect ESP32 Development Board to your PC via USB

After you connect your ESP32 development board, please note the Port number. Follow the following steps to get the port number:

Go to your Device Manager, and expand the “Ports (COM & LPT)” section.

Note your COM number for the ESP32 development board. In my case, it is a CP210x USB to UART bridge and it is connected to COM6. Will use this later, so keep this number in the back of your head or keep a note of it.

Step 6: Run a Hello World example to make sure we did everything correctly

Copy to the esp/ folder the example “hello_world” folder located in “**/esp-idf/examples/get-started/hello_world”

Start a terminal and cd to the hello_world folder you just copied over. Your terminal should look something like this:

Run the following command:

make menuconfig

A config menu should come up if we did everything correctly:

Select Serial flasher config > Default serial port > (enter your COM# and delete everything else)

Press Ok

Then navigate to < Save > and press Enter.

Do not change the filename and leave as is and click < Ok >

Then click < Exit > again.

Navigate to < Exit > two more times, until you are back to the terminal.

Run the following command to build the project and flash the chip, and then display the serial monitor.

make -j4 flash monitor

If all went well, the following is the output. Where ESP32 is counting down from 10 and then restarting.

This is just a brief tutorial on how to setup the environment on Windows. Espressif have done a better job of explaining this process, please take a look at their tutorial as the main documentation and this as a backup.

If I missed anything or if there is anything that you still cannot understand, please comment your question and I will respond as soon as possible.

We are not affiliated or paid by any of the mentioned third-party companies to write this article. We are simply a fan of their products and want to learn more about the future of such products. Nothing on here that we recommend that we would not use ourselves. Please feel free to leave your feedback!

How To's , , , ,

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: