A PlatformIO-based ESP32 C++ template with WiFi scanner, LED blinking, system monitoring, and formatted serial output.
A professional starter project for embedded development with ESP32 microcontrollers using PlatformIO and modern C++.
This template provides essential embedded development features:
- Built-in LED Blinking - GPIO control with onboard LED (GPIO2)
- WiFi Scanner - Network discovery with formatted ASCII table output
- System Monitoring - Real-time telemetry:
- Free heap memory
- CPU temperature
- System uptime
- Formatted Serial Output - Clean console output with ASCII tables
- PlatformIO Ready - Pre-configured for immediate development
- ESP32 Development Board (ESP32 DevKit, NodeMCU-32S, etc.)
- USB cable (data cable required, not charge-only)
- Computer with USB port
- PlatformIO Core
- Python 3.7+
- USB-to-Serial drivers (CP210x or CH340, depending on your board)
# Install PlatformIO Core globally
pip install platformio
# Or use the VS Code extension
# Extensions -> Search "PlatformIO IDE" -> InstallIf you get permission errors when uploading:
# Add your user to the dialout group
sudo usermod -aG dialout $USER
# Log out and log back in for changes to take effectPlug your ESP32 into your computer via USB. Verify it's detected:
ls /dev/ttyUSB*
# Should show: /dev/ttyUSB0# Navigate to the project folder
cd esp32-starter-template
# Build the project
pio run
# Upload to the ESP32
pio run --target upload
# Build and upload in one command
pio run --target upload# Open serial monitor
pio device monitor
# Or with custom baud rate
pio device monitor --baud 115200Tip: Press Ctrl+T then Ctrl+Q to exit the serial monitor.
esp32-starter-template/
├── src/
│ └── main.cpp # Main C++ application
├── .gitignore # Git ignore rules
├── platformio.ini # PlatformIO configuration
├── LICENSE # MIT License
├── README.md # This file
├── CONTRIBUTING.md # Contribution guidelines
├── CODE_OF_CONDUCT.md # Community standards
└── SECURITY.md # Security policy
Edit platformio.ini and update the upload_port:
upload_port = /dev/ttyUSB0 # Change to your port (e.g., COM3 on Windows)Uncomment the appropriate environment in platformio.ini:
; For ESP32-S3
[env:esp32s3]
platform = espressif32
board = esp32-s3-devkitc-1
monitor_speed = 115200
upload_speed = 921600
; For ESP32-C3
[env:esp32c3]
platform = espressif32
board = esp32-c3-devkitm-1
monitor_speed = 115200
upload_speed = 921600Then upload with:
pio run -e esp32s3 --target upload- Toggles the built-in LED every 250ms
- GPIO 2 is used (standard for most ESP32 boards)
- Status output to serial monitor
- Scans for networks every 5 seconds
- Displays results in a formatted ASCII table:
- Network name (SSID)
- Signal strength (RSSI)
- Channel
- Security type (OPEN, WEP, WPA, WPA2)
- CPU temperature (internal sensor)
- Free heap memory
- Minimum free heap
- Uptime counter
sudo usermod -aG dialout $USER
# Then log out and back in- Hold the BOOT button on your ESP32
- Press RESET/EN button
- Release BOOT button
- Try uploading again
- Verify
monitor_speed = 115200matchesSerial.begin(115200)in code - Press the RESET button on the ESP32
- Check your USB cable (some are charge-only)
- Ensure WiFi is available in your area
- Move closer to your router
- Check antenna connection (if your board has external antenna)
Ideas for customization:
- GPIO Input - Add button/switch input handling
- WiFi Client - Connect to networks and access the internet
- Web Server - Host a web interface on your ESP32
- MQTT Client - Integrate with IoT platforms like Home Assistant
- Deep Sleep - Implement power-saving modes for battery projects
- OLED Display - Add I2C OLED for visual output
- Sensors - Integrate temperature, humidity, motion sensors
This project is licensed under the MIT License.
Found a bug or have a feature request? Open an issue or submit a pull request.
- ESP32 Datasheet
- ESP32 Technical Reference
- PlatformIO Documentation
- PlatformIO ESP32 Platform
- ESP32 Forum
Built for the ESP32 embedded community