Introduction
PlatformIO is a professional development platform for microcontrollers that integrates into VSCode as an extension.
Together, VSCode + PlatformIO offer:
- Support for hundreds of development boards (Arduino, ESP32, ESP8266, STM32, Raspberry Pi Pico…)
- Automatic management of libraries and dependencies
- Built-in compiling, uploading and debugging
- IntelliSense (smart autocompletion)
- Multi-platform project management
This tutorial guides you through the complete installation on Windows, macOS and Linux.
PlatformIO offers advanced project management, faster builds, better library management, support for several platforms in the same project, and professional debugging tools. It is the reference tool for serious projects.
Now that VSCode is installed, we will add the PlatformIO extension, which turns VSCode into a complete IDE for microcontrollers.
Step 1: Open the extension manager
In VSCode, click the Extensions icon in the activity bar on the left (stacked squares icon) or use the shortcut:
- Windows/Linux: Ctrl+Shift+X
- macOS: Cmd+Shift+X
In the extensions search bar, type platformio. You should see the PlatformIO IDE extension by PlatformIO.
Step 3: Install the extension
Click the Install button. Installation takes a few minutes because PlatformIO automatically downloads:
- Python (if needed)
- PlatformIO Core
- The build tools
Be patient, and do not close VSCode during the installation!
Step 4: Wait for the installation to finish
Once the installation is complete, you will see:
- A PlatformIO icon (alien head) in the activity bar on the left
- A notification saying that PlatformIO is ready
- Possibly a request to restart VSCode
If asked, click Reload Now.
The first installation of PlatformIO can take 5-10 minutes depending on your internet connection. PlatformIO downloads all the tools needed (compilers, flashing tools and so on). This is normal, be patient!
Click the PlatformIO icon (alien head) in the activity bar on the left. A panel opens with several options. Click PIO Home then Open.
The PlatformIO home page opens with several sections:
- New Project: Create a new project
- Open Project: Open an existing project
- Platforms: Manage the supported platforms
- Libraries: Manage libraries
- Boards: See the supported boards
If you see this page, congratulations! PlatformIO is correctly installed.
Configuring USB permissions (Linux only)
On Linux, you must configure permissions to access USB ports without sudo.
Add the user to the dialout group
Open a terminal and run:
sudo usermod -a -G dialout $USER
sudo usermod -a -G plugdev $USER
Log out and log back in (or restart the computer) for the changes to take effect.
Install the udev rules (optional)
For better support of some boards (ESP32, STM32…), install the PlatformIO udev rules:
curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/master/scripts/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules
Then reload the rules:
sudo udevadm control --reload-rules
sudo udevadm trigger
After adding your user to the dialout and plugdev groups, you MUST log out and log back in (or restart) for the permissions to take effect. Otherwise PlatformIO will not be able to access the USB ports.
Memorise these essential shortcuts:
Windows/Linux:
- Ctrl+Alt+B: Build
- Ctrl+Alt+U: Upload
- Ctrl+Alt+S: Serial monitor
- Ctrl+Alt+T: Run task (a specific task)
macOS:
- Cmd+Alt+B: Build
- Cmd+Alt+U: Upload
- Cmd+Alt+S: Serial monitor
Troubleshooting
- Uninstall the PlatformIO extension in VSCode
- Close VSCode completely
- Delete the
~/.platformio folder (Linux/macOS) or C:\\Users\\YourName\\.platformio (Windows)
- Reopen VSCode and reinstall PlatformIO
Solution 2: Python problem
PlatformIO needs Python. Check that Python is installed:
python --version or python3 --version
If Python is not installed, download it from python.org and reinstall PlatformIO.
Problem: USB port not detected (Linux)
Check the USB permissions
Make sure you have followed the USB configuration steps (previous section):
sudo usermod -a -G dialout $USER
sudo usermod -a -G plugdev $USER
Then log out and log back in.
- Open PlatformIO Home
- Go to Platforms > Installed
- Find your platform (e.g. Espressif 32) and click Uninstall
- Reinstall the platform from Platforms > Embedded
- Try compiling again
Let us test the installation by creating a simple “Blink” project.
Step 1: New project
- Click the PlatformIO icon in the left bar
- Click PIO Home > Open
- Click + New Project
Step 2: Project configuration
Fill in the following fields:
- Name:
test_blink
- Board: Select your board (for example:
Arduino Uno, Seeed Studio XIAO ESP32S3, ESP32 Dev Module…)
- Framework: Leave
Arduino, the default
- Location: Leave the default path or choose a folder
Click Finish. PlatformIO creates the project and downloads the tools needed for your board.
Step 3: Test code
PlatformIO automatically creates the project structure. Open the file src/main.cpp. Replace its contents with this Blink test code:
#include <Arduino.h>
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
Step 4: Build the project
To build the project:
- Click the ✓ (tick) icon in the status bar at the bottom (Build)
- Or use the shortcut: Ctrl+Alt+B (Windows/Linux) / Cmd+Alt+B (macOS)
PlatformIO compiles the code. If all goes well, you will see SUCCESS in the terminal.
The first build of a project for a new platform can take several minutes, because PlatformIO downloads the compiler, libraries and frameworks needed. Later builds will be much faster!
Step 5: Upload to the board (optional)
If you have a board connected, you can upload the program:
- Plug in your board over USB
- Click the → (arrow) icon in the status bar (Upload)
- Or use the shortcut: Ctrl+Alt+U (Windows/Linux) / Cmd+Alt+U (macOS)
PlatformIO compiles and uploads automatically. The LED of your board should blink!
If the build succeeds, your VSCode + PlatformIO installation is complete and working. You are ready to develop your embedded projects!
Installing libraries
Libraries are declared directly in the platformio.ini file with the lib_deps key. This is the recommended method: dependencies are versioned with the project and installed automatically at build time.
Step 1: Find the identifier of the library
Go to the official registry registry.platformio.org and search for the library you want. Note its identifier in the author/LibName format (e.g. waspinator/AccelStepper).
Open the platformio.ini file at the root of your project and add the lib_deps key:
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps =
waspinator/AccelStepper@^1.64
To add several libraries, list them one under the other:
lib_deps =
waspinator/AccelStepper@^1.64
bblanchon/ArduinoJson@^7.0.0
Step 3: Build to install
Start a build with Ctrl+Alt+B (Windows/Linux) or Cmd+Alt+B (macOS). PlatformIO automatically downloads and installs all the libraries listed in lib_deps before compiling.
The ^ symbol means « compatible version » (e.g. ^1.64 accepts 1.64, 1.65… but not 2.0). Use @* to always take the latest version, or an exact number such as @1.64.0 to pin the version.
Resources and going further
Official documentation
Tutorials and guides
Useful CLI commands
If you prefer to use PlatformIO from the command line:
# Create a new project
pio project init --board <board_name>
# Build
pio run
# Upload
pio run --target upload
# Open the serial monitor
pio device monitor
# List the available boards
pio boards
# Search for a library
pio lib search <lib_name>
# Install a library
pio lib install <lib_name>
my_project/
├── .pio/ # Build files (generated automatically)
├── include/ # Header files (.h)
├── lib/ # Private libraries
├── src/ # Source code (.cpp, .c)
│ └── main.cpp # Main file
├── test/ # Unit tests
├── platformio.ini # Project configuration
└── .gitignore # Files for Git to ignore
The platformio.ini file configures the project:
[env:myboard]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps =
adafruit/Adafruit Sensor@^1.1.4
bblanchon/ArduinoJson@^6.21.0
Now that VSCode and PlatformIO are installed, you are ready to develop your embedded projects! Explore the examples included, try different boards, and do not hesitate to read the documentation.