Guides › PlatformIO

Getting started with PlatformIO for ESP32

From a fresh computer to a live temperature graph in about 30 minutes - on Windows, macOS or Linux. We use Sparky's free ESP32-S3 DS18B20 project as the example, but every step works for any PlatformIO project. You don't edit any code: Wi-Fi and your device key are entered on the board's own setup page, from your phone.

Just want it running? Skip the toolchain: flash the prebuilt firmware from Chrome or Edge in one click, then jump to the phone setup step. Use this guide when you want to change or learn from the code.

Sparky says: PlatformIO is a free add-on for VS Code that downloads the right compiler, board files and libraries for you - pinned to exact versions, so the project builds the same on your machine as on mine. No more "which board package did you install?"

What you need

  • An ESP32-S3-DevKitC-1-N16R8, a DS18B20 probe, a 4.7 kΩ resistor and a breadboard - see the parts list.
  • A USB-C data cable (charge-only cables are the #1 cause of "no port found").
  • A computer running Windows 10/11, macOS 12+ or a recent Linux, and about 1.5 GB of free disk space.
  • The project zip from Sparky's giveaway, a free dashboard account, and a phone with Wi-Fi.
  • A 2.4 GHz Wi-Fi network - the ESP32-S3 can't join 5 GHz-only networks.

Install Visual Studio Code

Download it free from code.visualstudio.com.

Windows

Run the User Installer. Tick "Add to PATH". That's it.

macOS

Unzip and drag Visual Studio Code.app into Applications. Open it once from there (not from Downloads).

Linux

Install the .deb (Debian/Ubuntu) or .rpm (Fedora). PlatformIO also needs Python 3 with venv: sudo apt install python3-venv.

Install the PlatformIO IDE extension

  1. In VS Code, click the Extensions icon (four squares) on the left, or press Ctrl+Shift+X (⌘+Shift+X on Mac).
  2. Search PlatformIO IDE (publisher: PlatformIO) and click Install.
  3. Wait for "PlatformIO Core has been successfully installed" in the bottom-right, then click Reload. A little alien-head icon appears in the left bar - that's PlatformIO.

Corporate PC or antivirus? PlatformIO downloads its tools from the internet the first time. If the install hangs, check that Python and VS Code are allowed through the firewall.

USB ports & drivers (read this one!)

The ESP32-S3-DevKitC-1 has two USB-C ports. Look at the tiny labels printed next to them:

Port labelWhat it isDriver
USB (native)Wired straight to the ESP32-S3's built-in USB (GPIO19/20). Shows up as "USB JTAG/serial debug unit".None needed on Windows 10/11, macOS or Linux.
UART (sometimes "COM")Goes through a USB-to-serial chip: CP2102N on Espressif boards, CH343 (or CH340) on many newer/clone boards.Often needed: Silicon Labs CP210x or WCH CH343.

Use the port labelled USB. Sparky's project sets -DARDUINO_USB_CDC_ON_BOOT=1 in platformio.ini, which sends Serial.print() output to the native USB port. Uploading works on either port, but with this setting the serial monitor only shows messages on the USB port.

Prefer the UART port (for example, it's the only cable that reaches)? Change the line in platformio.ini to -DARDUINO_USB_CDC_ON_BOOT=0. Serial then goes to UART0, which the bridge chip passes to your computer.

Windows

Plug in and open Device Manager → Ports (COM & LPT). You should see a new COM port. On the UART port with a yellow "!" icon, install the CP210x or CH343 driver above.

macOS

Ports appear as /dev/cu.usbmodem… (USB) or /dev/cu.usbserial…/cu.wchusbserial… (UART). Apple Silicon and Intel both work without drivers on the USB port. If macOS asks to allow an accessory, click Allow.

Linux

Install PlatformIO's udev rules and add yourself to the serial group, then log out and back in:

curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/system/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules
sudo udevadm control --reload-rules && sudo udevadm trigger
sudo usermod -aG dialout $USER   # Arch: uucp

Ubuntu with a CH34x board that disconnects instantly? sudo apt remove brltty.

Open the project

  1. Unzip esp32-s3-ds18b20-v1.1.0.zip somewhere simple like Documents/esp32 (avoid OneDrive-synced folders on Windows - they slow builds down).
  2. In VS Code choose File → Open Folder… and pick the esp32-s3-ds18b20 folder (the one that contains platformio.ini).
  3. Click Yes, I trust the authors. PlatformIO notices platformio.ini and starts downloading the ESP32 platform and the two libraries. The first time takes 3-10 minutes (about 500 MB) - watch the progress in the bottom bar.

Build

Click the ✓ checkmark in the blue status bar at the bottom of VS Code (or PlatformIO icon → Project Tasks → Build). After a minute you should see:

RAM:   [==        ]  17.6% (used 57596 bytes from 327680 bytes)
Flash: [=         ]  13.5% (used 887677 bytes from 6553600 bytes)
========================= [SUCCESS] Took 41.20 seconds =========================

Upload

  1. Wire the sensor as shown on the project page (DATA on GPIO4, 4.7 kΩ to 3V3).
  2. Plug the board's USB port into your computer.
  3. Click the → arrow in the status bar (Upload). PlatformIO finds the port automatically and ends with Hard resetting via RTS pin... and [SUCCESS].
The BOOT-button trick. If upload fails with "Failed to connect to ESP32-S3" or "No serial data received", put the chip in download mode by hand:
  1. Hold down the BOOT button.
  2. Press and release RST (also labelled EN).
  3. Release BOOT, then click Upload again.
  4. When it finishes, press RST once to start your program (needed after a manual download-mode upload on the USB port).

Open the serial monitor

Click the 🔌 plug icon in the status bar. The project already sets monitor_speed = 115200. On a brand-new board you should see the setup network announced within a few seconds:

=== Sparky by HomeAutomation.com - DS18B20 sensor v1.1.0 ===
Chip ESP32-S3 rev 0, 16 MB flash, PSRAM 8192 KB, id AB12
[sensor] found 1 DS18B20 on GPIO4, parasite power: no
[config] no saved settings - starting setup mode
[setup] ===> Join Wi-Fi "Sparky-Setup-AB12" on your phone, then open http://192.168.4.1

Nothing shows? Press RST on the board - the native USB port re-connects after a reset, and the monitor picks it up again. The blue LED pulsing means setup mode is open.

Set up Wi-Fi from your phone

This replaces editing a settings file. The board saves what you enter in its own flash memory.

  1. Get your device key first (your phone has no internet while it is on the setup network): go to homeautomation.com/dashboard, sign up free, type a name like "Office temperature" and click Create device + key. Copy the key (it starts with hak_). It is shown only once - lost it? Click Regenerate key on the device page.
  2. On your phone, join the open Wi-Fi network Sparky-Setup-XXXX (the same four characters printed on the serial monitor). The setup page opens by itself; if not, browse to http://192.168.4.1.
  3. Choose your Wi-Fi from the list (2.4 GHz only; use Other / hidden network if yours isn't listed), enter its password, paste the device key, and optionally give the device a name. Leave Advanced alone unless you run your own server.
  4. Tap Save & connect. The LED blinks blue while the board tests your Wi-Fi. On success the page shows the board's IP address and the board restarts; reconnect your phone to your normal Wi-Fi. On failure the page says why and you stay in setup, so you can fix it and try again.

The serial monitor then shows the normal-mode log:

[config] Wi-Fi "MyHomeWiFi", key hak_xxxx..., name "Office temperature"
[wifi] connected, IP 192.168.1.42, RSSI -58 dBm
[mdns] http://sparky-ab12.local/
[time] ok: 2026-12-05 18:04:11 UTC
[sensor] 21.44 C / 70.59 F
[http] 202 accepted {"temp_c":21.44,"temp_f":70.59,"rssi":-58,"uptime":12,"sensor_ok":1}

Your password is never printed or shown again. On your home network, open http://sparky-XXXX.local/ for a read-only status page.

Start over any time: hold the BOOT button for 5 seconds while the board runs. The LED flickers, then turns green; release the button and the board erases its saved Wi-Fi and key and reboots into setup mode. Wi-Fi unreachable for about 3 minutes (new router)? The setup network reopens on its own while the board keeps retrying.

Watch it on the dashboard

The board posts to https://api.istuff.io/v1/ingest (the device data hub for all of Sparky's products). Open your dashboard. The device switches to Online and a new point lands on the graph every 30 seconds. Switch between 24 h and 7 d, pick a metric (temperature, Wi-Fi signal, uptime), and set high/low thresholds - email alerts are coming soon.

Free plan: 5 devices, 7 days of history, one reading per 30 seconds per device. Posting faster gets an HTTP 429 with a Retry-After header - Sparky's firmware already respects it.

Optional: bake settings into the firmware (secrets.h)

Most people never need this. If you flash many boards or just prefer files, copy include/secrets.example.h to include/secrets.h, fill in WIFI_SSID, WIFI_PASSWORD and DEVICE_API_KEY, then build and upload. It is only used while nothing is saved on the board; once you complete the phone setup, the saved settings win. Note that a BOOT-button reset erases the saved settings, after which the compiled-in ones are used again.

Build flags in platformio.ini you may want: -DRGB_LED_PIN=38 (DevKitC-1 v1.1 LED) and -DSETUP_AP_PASSWORD="\"yourpass\"" (password-protect the setup network; printed on the serial monitor).

Troubleshooting

SymptomFix
No COM / /dev/tty… port appearsTry a different cable (data, not charge-only) and another USB port on the computer. On the UART port, install the CP210x/CH343 driver. On Linux, add the udev rules and dialout group.
Browser Install can't open the board / "Failed to connect"Close PlatformIO / VS Code's serial monitor, Arduino IDE, and any other serial monitor or browser tab using the board - they hold the COM port. Use Chrome or Edge on a desktop. If it still can't connect: hold BOOT, tap RST, release BOOT, then click Install again. The USB port shows as USB JTAG/serial debug unit; the UART port needs the CP210x or CH343 driver.
Failed to connect to ESP32-S3 / Timed out waiting for packet headerUse the BOOT-button trick above. Close any other serial monitor (PlatformIO, Arduino IDE, PuTTY) that is holding the port.
Upload works but the serial monitor is blankYou're on the UART port with ARDUINO_USB_CDC_ON_BOOT=1 - switch to the USB port or set it to 0. Then press RST.
Port keeps disappearing / changes numberNormal for the native USB port during reset and upload. Unplug, plug back in and retry; pin it with upload_port / monitor_port in platformio.ini if you have several boards.
I don't see Sparky-Setup-XXXXThe board only opens it when nothing is saved (or after 3 minutes without Wi-Fi). Hold BOOT for 5 s to erase the settings, then look for a pulsing blue LED. Phones sometimes hide open networks with no internet - open Wi-Fi settings and refresh the list.
The setup page doesn't pop upBrowse to http://192.168.4.1 (type http:// - not https). Turn off mobile data / "Smart network switch" / private DNS for a minute, and tap "Stay connected" if the phone says the network has no internet.
Setup says "refused the connection" or "could not find that network"Wrong password, or the network is 5 GHz-only. Mesh routers: enable 2.4 GHz or a separate IoT SSID. You stay in setup, so just correct it and save again.
After "Save & connect" the page stops respondingNormal when it worked: the board joined your router, which moves it off the setup network. Reconnect your phone to your usual Wi-Fi and check the dashboard.
Typed the wrong key or password and saved itHold BOOT for 5 s; the board erases its settings and reopens setup.
[wifi] connection lost - retryingThe board keeps retrying and reopens the setup network after about 3 minutes offline, so you can point it at a new router.
[sensor] read -127 C / red LEDThe sensor isn't answering: DATA must be on GPIO4, the 4.7 kΩ pull-up between GPIO4 and 3V3, and GND shared.
[sensor] read 85 CThat's the DS18B20's power-on value. Usually VDD (red) isn't connected to 3V3 or the power is flaky.
[http] 401 / white LED blipThe key was rejected - it was regenerated or mistyped. Copy a fresh key from the device page, hold BOOT for 5 s and enter it in the setup page.
[http] 429 too soonHarmless: the server allows one reading per 30 s per device. The firmware waits and retries automatically.
request failed … (TLS: …)Usually the clock didn't sync (check that the network allows NTP) or a network filter intercepts HTTPS. Captive-portal/guest networks often block devices.
PSRAM 0 KB or a boot loop right after uploadYour board isn't an N16R8. N8R2/N8 boards need board_build.arduino.memory_type = qio_qspi and an 8 MB partition table.
RGB LED stays darkv1.1 boards use GPIO38: add -DRGB_LED_PIN=38 to build_flags.

Still stuck? Reach Sparky through the about page or check the official PlatformIO docs.