Programming ESP32 with PlatformIO IDE and Atom Text Editor

To program the ESP32 development board, we recommend using the Arduino IDE in our ESP32 projects and tutorials. However, owing to permission issues, the Arduino IDE version, or multiple Arduino IDE installations, it might be a little tricky to install the ESP32 add-on on certain Windows computers using the Git GUI.

There’s also another popular method to program ESP32 development boards using the Atom text editor combined with PlatformIO IDE. With this method, you can still use the same programming language you use on Arduino IDE.

This next tutorial was tested on both a Windows 10 PC and a Mac OS X computer.

lilygo Official Store

1. Installing Atom Text Editor

The first step is to go to the website and download the free text editor.

atom desktop

Then, open and run the downloaded installation file. It's a pretty simple installation. To finish the Atom installation, follow the on-screen instructions.

2a. Installing Python 2.7.X on a Windows PC

Python 2.7.X must be installed on your PC to use PlatformIO IDE to program your ESP32 boards. Go to the Python downloads page and get the latest Python 2.7.X version for your OS (Operating System).

python version

Note: We've used Python 2.7.15 for this unit. Any other version of Python 2.7.X should also work.

To start the Python installation, open the downloaded file. Follow these instructions as you go to the next step:

  • Scroll down through the “Customize Python 2.7.15” window.
  • Open “Add python.exe to Path“.
  • And select the option “Will be installed on local hard drive“.
Python 2.7.15

To complete the installation, press “Next” after that. You need to open the “Command Prompt” after installing Python 2.7.X.

keyestudio Official Store

cmd open

To check the Python and pip versions installed, run the next sequence of commands:

python --version
Python 2.7.15
pip --version
pip 9.0.3

Both commands should return output that is similar (the version may change slightly in your case). Check to see whether virtualenv is installed after that.

virtualenv --version

If it is already installed, go to the next stage. Otherwise, you'll need to use the following command to install it:

pip install virtualenv

Then, run this command again to check whether virtualenv was correctly installed:

virtualenv --version

2b. Installing Python 2.7.X on Mac OS X

Python 2.7.X must be installed on your PC to use PlatformIO IDE to program your ESP32 boards. To install Python 2.7.X, do the next sequence of commands. After that, check to see that Python, pip, and virtualenv are installed:

TSCINBUNY Official Store

$ brew install python2

$ python --version
Python 2.7.15

$ pip --version
pip 9.0.3

$ virtualenv --version

$ pip install virtualenv
isntall python2 Mac

3. Installing Clang for Code Completion

PlatformIO IDE uses Clang for intelligent code completion. Open the Terminal or Command Prompt and run: to check if Clang is installed on your system.

clang --version

If Clang is not already installed, follow the instructions for your operating system to install it:

clang installer add path

Warning: Do not install CLANG 4.0; only CLANG 3.9 is supported at the moment.

  • Mac OS X: Install the latest version of Xcode as well as the Command Line Tools. They are installed automatically the first time you run clang in Terminal, or manually by running:
xcode-select --install
  • Linux: using package managers: apt-get install clang or yum install clang.
  • Other systems: download the latest Clang for the other systems.

4. Installing PlatformIO IDE on Atom

Open Atom text editor and go to File > Settings after installing all PlatformIO IDE dependencies.

atom file settings

On the left menu, open the “Install” tab:

atom settings install

Search for “platformio” and press the Enter/Return key:


Install the “platformio-ide” option that is indicated in the preceding picture. For the modifications to take effect when the installation is complete, restart the Atom text editor.

5. PlatformIO IDE Overview

A new text editor window with the “Welcome to PlatformIO” screen should load now when you open Atom text:

platformio main

Press the “New Project” button in the quick access menu:

quick access platformio

A new window allows you to create a new project for your board. The next step is as follows:

  • Name your project (example: Blink).
  • Search for “ESP32” and select your ESP32 board (example: DOIT ESP32 DEVKIT V1).
  • Select the Arduino framework.
  • Press the “Finish” button.
new project esp32

You can navigate through files and folders once the new project has been created since you'll see the new folder on the left menu.

new project blink

Double-click the main.cpp file in the src folder to open it. The file opens in a new window in Atom, where you may edit it:

new project open file

Similar to your Blink.ino file used in the Arduino IDE is the main.cpp file You can write Arduino code, but you need to start with a file and include the Arduino framework. If you start the sketch with the following line, all Arduino sketches will essentially work with PlatformIO IDE:

#include <Arduino.h>

6. Testing PlataformIO IDE

To test PlatformIO IDE, let's try an example. We'll make GPIO 23's LED blink. The parts you need to follow this example are listed below:

You can use the preceding links to find all the parts for your projects at the best price!

Follow the next schematic to assemble your circuit.

schematic bb

Here’s a sketch for testing purposes that blinks the LED:

#include <Arduino.h>

// ledPin refers to ESP32 GPIO 23
const int ledPin = 23;

// the setup function runs once when you press reset or power the board
void setup() {
    // initialize digital pin ledPin as an output.
    pinMode(ledPin, OUTPUT);

// the loop function runs over and over again forever
void loop() {
    digitalWrite(ledPin, HIGH);   // turn the LED on (HIGH is the voltage level)
    delay(1000);                  // wait for a second
    digitalWrite(ledPin, LOW);    // turn the LED off by making the voltage LOW
    delay(1000);                  // wait for a second

For the next steps to upload the code to your ESP32 board, copy the code to the Atom text editor and complete them as follows:

  1. Connect your ESP32 board to your computer.
  2. Save the newly created sketch (File > Save).
  3. Press the “Upload” button (highlighted in the next image).
upload new sketch

Wait a few seconds while the sketch uploads to your board:

platformio upload window

Your ESP32 ought to be blinking the LED attached to GPIO 23 once per second once you load the sketch.

I'm done now! You may now use PlatformIO to program your ESP32 board since PlatformIO was successfully installed.

7. PlatformIO IDE Additional Tips

We've only just scratched the surface of PlatformIO IDE's capabilities. Here's what each PlatformIO IDE button does/means:

Platformio labeled
  1. PlatformIO Home
  2. PlatformIO Build
  3. PlatformIO Upload
  4. Upload to a remote device
  5. PlatformIO Clean
  6. PlatformIO Test
  7. PlatformIO Debug
  8. Run other targets
  9. Toggle Build Panel
  10. Find in Project
  11. Terminal
  12. Serial Monitor (it’s like the Arduino IDE Serial Monitor)
  13. Atom Settings

We've modified the Blink code previously used to include some Serial.println() commands to show how the Serial Monitor looks. You may open the Serial Monitor by clicking the following icon:

platformio open serial monitor

Your settings should be completed automatically by the PlatformIO software. Alternatively, select your ESP32's COM port and Baudrate. Then, press the “Start” button as follows:

platformio serial monitor settings

You have a window that outputs all of the Serial.println() commands used in your code, much like the Arduino IDE Serial Monitor:

platformio serial monitor

As you can see, it’s printing the messages “LED on” and “LED off“.


To explore the numerous features and functionalities that PlatformIO provides, we recommend using the following links as a resource:

If you like ESP32, you may also like:

We hope you find this tutorial useful. Thanks for reading.

Oh hi there It’s nice to meet you.

Sign up to receive awesome content in your inbox, every month.

We don’t spam! Read our privacy policy for more info.

Leave a Reply

Your email address will not be published. Required fields are marked *

Developing IoT Projects with ESP32

Automate your home or business with inexpensive Wi-Fi devices