This is tutorial for first time using ESP-IDF.
Requirements
You need
- An internet connection
- ESP-IDF V5.5 Offline Installer (download)
- VS Code (download) with
- C/CXX Extensions by Microsoft (download) or Clangd
- CH340 Driver (download)
1. Install ESP-IDF and CH340 Driver
After you downloaded the installer. Just install it like other program. Just make sure the ESP-IDF installation path are on C:\Espressif. You can check the folder in C: directories after you finished the installer.
2. First Blinking LED Project
So this is your first blinking LED project. What you need:
- An internet connection
- An ESP32 Devkit Development Board (just use from stas-rg lab)
- LED 3.3v
- USB Data Cable (make sure it is can transfer data)
- Breadboard
The hardware
- Connect the
D2orDigital Pin 2of ESP32 Devkit to the+side of the LED. - The
-side of LED you can connect to theGNDpin on ESP32.
Get Started, The Firmware
Important (About project folder)
Make sure you have created DEV folder inside your Documents. We will use this as standard project path.
Remember, to recheck the path. Don’t use OneDrive documents folder.
- Run the ESP-IDF from powershell (just type ESP-IDF on windows start menu). After it starts. Open
file explorer, Copy the path from ourDEVfolder. Then open the ESP-IDF terminal and usecdcommand to navigate\DEV\folder. Here the example.Terminal window cd <the dev folder path> - Clone my repository by using
gitcommand.Terminal window git clone https://github.com/bokumentation/ESP32-Arduino-as-Components-Starter.git - You will see folder called
ESP32-Arduino-as-Components-Starter. We need to navigate to the example by doing this commands.Terminal window cd ESP32-Arduino-as-Components-Starter/examples/esp32_arduino - Plug your ESP32 to your computer. Open
device managerand look up for PORT or COM section. You will see the COM number of your ESP32. - Now we can build by using this command.
Terminal window idf.py build - It will take time. You need to be patience.
- After the build succesfull. Now we can flash then monitor.
Terminal window idf.py buildTerminal window idf.py -p <PORT> flash monitor
Important (About <PORT>)
Replace <PORT> with your ESP32’s actual serial port (e.g., COM3 on Windows or /dev/ttyUSB0 on Linux). We can find this in device manager.
- Now you LED should be blinking.
Edit in VS Code
If you wanna use vscode. Just type code . to open your project into the vscode. Remember to open the project from the ESP-IDF terminal like this.
code .You can use auto completion or show suggestion feature by pressing ctrl + space.