1. Setting Up the Development Environment
I recommend using PlatformIO (VS Code extension) instead of Arduino IDE. PlatformIO has native support for the XIAO ESP32S3 Sense, so you don’t need to fall back on “ESP32S3 Dev Module.”
- Install VS Code
- Install PlatformIO IDE extension
- Create a new project, and select:
- Board:
Seeed Studio XIAO ESP32S3 - Framework:
Arduino
- Board:
Your platformio.ini should look like this:
[env:seeed_xiao_esp32s3]
platform = espressif32
board = seeed_xiao_esp32s3
framework = arduino
monitor_speed = 115200
2. LED Blink Test
Always start simple. Run a blink sketch to confirm that the board and toolchain are working.
#include <Arduino.h>
#define LED_BUILTIN 21 // Yellow onboard LED
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}
If the yellow LED blinks, your setup is good to go.
3. Camera Initialization & Web Streaming
The XIAO ESP32S3 Sense comes with an OV2640 camera module. Below is a simplified snippet of the setup code (PlatformIO + Arduino framework):
#include "esp_camera.h"
#include <WiFi.h>
#include <WebServer.h>
#define XCLK_GPIO_NUM 10
#define SIOD_GPIO_NUM 40
#define SIOC_GPIO_NUM 39
#define Y9_GPIO_NUM 48
#define Y8_GPIO_NUM 11
#define Y7_GPIO_NUM 12
#define Y6_GPIO_NUM 14
#define Y5_GPIO_NUM 16
#define Y4_GPIO_NUM 18
#define Y3_GPIO_NUM 17
#define Y2_GPIO_NUM 15
#define VSYNC_GPIO_NUM 38
#define HREF_GPIO_NUM 47
#define PCLK_GPIO_NUM 13
const char *ssid = "YourWiFi";
const char *password = "Password";
WebServer server(80);
void startCameraServer() {
server.on("/", HTTP_GET, []() {
server.send(200, "text/html", "<h1>ESP32S3 Camera</h1><img src=\"/stream\">");
});
server.begin();
}
When successful, you’ll see an IP address in the Serial Monitor (e.g. 192.168.1.104).
Open http://192.168.1.104/stream in a browser to view the camera feed.
4. WiFi Connection & Debugging
A very common beginner issue is WiFi not connecting. Here are some tips:
- ESP32 supports only 2.4GHz WiFi (no 5GHz support).
- Keep your SSID and password simple (no unusual characters).
- Use a WiFi scan to confirm available networks:
Serial.println("Scanning WiFi...");
int n = WiFi.scanNetworks();
for (int i = 0; i < n; i++) {
Serial.printf("%d: %s (%d dBm)\n", i+1, WiFi.SSID(i).c_str(), WiFi.RSSI(i));
}
- Print connection status codes while connecting:
1 = WL_NO_SSID_AVAIL→ AP not found3 = WL_CONNECTED→ Connected successfully4 = WL_CONNECT_FAILED→ Wrong password
5. Power Supply Pitfalls (The Biggest Trap!)
Here’s the #1 issue I ran into:
- When powered via PC USB → everything worked, video stream was fine.
- When powered via a cheap USB adapter or power bank → black screen, page not loading, or extreme lag.
Why? The ESP32S3 + Camera can draw 500–700mA at peak. Many USB adapters and thin cables can’t supply this reliably.
Fixes
- Use a stable 5V / 2A USB power adapter
- Use a short, thick USB cable (30–50 cm, rated for 2A current)
- If you must use a weak power source, lower the camera load:
config.frame_size = FRAMESIZE_QQVGA; // 160x120
config.jpeg_quality = 20; // High compression
config.xclk_freq_hz = 10000000; // Lower clock speed
config.fb_count = 1; // Single framebuffer
6. Common Issues & Solutions
- Black screen → Power supply too weak / camera init failed
- Page loads but extremely slow → WiFi unstable or CPU overloaded with JPEG compression
- WiFi won’t connect → Check 2.4GHz availability, WPA2-PSK(AES) recommended
- High latency → Either power issue or resolution too high
7. Suggested Beginner Workflow
- Verify development environment with LED Blink
- Test WiFi connectivity with a network scan
- Connect to WiFi and run basic camera streaming
- Solve power supply issues for stability
- Fine-tune resolution, frame rate, and JPEG quality for your use case
8. Changing PlatformIO Default Project Directory
By default, PlatformIO creates all new projects under:
~/Documents/PlatformIO/Projects/
On Linux, this path expands to something like:
/home/username/Documents/PlatformIO/Projects/
If you prefer to keep your projects in another location (for example, under ~/dev/platformio_projects), you can change this setting inside VS Code.
Steps:
- Open VS Code.
- Press
Ctrl+Shift+P→ type Preferences: Open User Settings (JSON). - In the
settings.json, add the following line:"platformio-ide.projectsDir": "/home/yourname/dev/platformio_projects" - Save and restart VS Code.
From now on, all new PlatformIO projects will be created under your custom directory.