DEV Community

chung-cha tsai
chung-cha tsai

Posted on

Getting Started with ESP32: From Zero to "Hello World"

Why I Started This Project

I'm a firmware engineer looking to transition into remote IoT roles at globally distributed companies. To build a portfolio that demonstrates end-to-end IoT skills — from embedded sensors to cloud backends — I decided to start from the basics: getting an ESP32 up and running.

This is the first post in a series where I'll document building a complete IoT system with ESP32, MQTT, and Go.


What You'll Need

  • ESP32 DevKit (WROOM)
  • USB cable (data-capable, not charge-only)
  • VS Code + PlatformIO extension

Step 1 — Install PlatformIO

  1. Install VS Code
  2. Go to Extensions, search PlatformIO IDE and install
  3. Restart VS Code

Step 2 — Create Your First Project

Open PlatformIO, click New Project:

  • Board: DOIT ESP32 DEVKIT V1
  • Framework: Arduino

Step 3 — Verify Your Board is Connected

This is where I got stuck the longest.

After plugging in the ESP32 via USB, I wasn't sure if my computer actually recognized it. Here's how to confirm:

On Windows:

  1. Open Device Manager
  2. Look under Ports (COM & LPT)
  3. You should see something like Silicon Labs CP210x or CH340 on a COM port

Once I saw COM3 appear, VS Code's PlatformIO also showed the device was ready to connect. That was my confirmation the board was properly detected.

If nothing shows up, you likely need a driver. Check which USB chip your board uses (usually CP2102 or CH340) and download the corresponding driver.


Step 4 — Write and Upload Your First Program

Paste this into src/main.cpp:

#include <Arduino.h>

void setup() {
  Serial.begin(115200);
  pinMode(2, OUTPUT);
}

void loop() {
  Serial.println("hello from ESP32");
  digitalWrite(2, HIGH);
  delay(500);
  digitalWrite(2, LOW);
  delay(500);
}
Enter fullscreen mode Exit fullscreen mode

Press → Upload in the bottom toolbar, or Ctrl+Alt+U.


Step 5 — Open Serial Monitor

Click the plug icon in the bottom toolbar to open Serial Monitor.

Important: Make sure the baud rate matches your code. Add this to platformio.ini:

monitor_speed = 115200
Enter fullscreen mode Exit fullscreen mode

Without this, you'll see garbled text instead of your output — exactly what happened to me.


Result

When I finally saw hello from ESP32 printing every second, I was genuinely surprised it worked. It felt like a small but real milestone — the board was alive, the toolchain worked, and I had a foundation to build on.


What's Next

In the next post, I'll connect a BME280 sensor and publish temperature and humidity data over MQTT — the first step toward a complete IoT pipeline.

Top comments (0)