Skip to Content

Getting started with XIAO-ESP32-S3-Sense

Getting started with XIAO-ESP32-S3-Sense

The Seeed Studio XIAO-ESP32-S3 Sense is a compact, microcontroller development board designed for edge AI and IoT applications. Built around the ESP32-S3 chip, it combines dual-core performance, Wi-Fi and Bluetooth 5 connectivity, and onboard AI acceleration with a rich set of peripherals—all in a tiny 21×17.5 mm form factor.

What sets the XIAO-ESP32-S3 Sense apart is its built-in 2MP camera (OV2640) and digital microphone (MP34DT06JTR), enabling computer vision and audio processing right out of the box. It also features 8 MB of PSRAM, 8 MB of flash and an SD card slot for external 32GB, making it well-suited for lightweight AI workloads using frameworks like TensorFlow Lite Micro or Edge Impulse.

This quick tutorial will guide you through the basics of setting up the board, flashing your first program, and accessing the camera and microphone to get started with your own AI-powered projects. For more information also see the extensive Getting Started Wiki by Seeed Studio.

Required Parts

Obviously, you will need a XIAO ESP32 S3 Sense board by Seeed Studio to try out the code examples. Note that the board can get very hot if you, for instance, when streaming video with a high framerate. I recommend you attach a small heatsink at the back of the board (see the listed part below).

Seeed Studio XIAO ESP32 S3 Sense

USB C Cable

Small Heatsink 9×9 mm

Makerguides is a participant in affiliate advertising programs designed to provide a means for sites to earn advertising fees by linking to Amazon, AliExpress, Elecrow, and other sites. As an Affiliate we may earn from qualifying purchases.

Features of the XIAO-ESP32-S3-Sense board

The XIAO-ESP32-S3 Sense is part of Seeed Studio’s ultra-compact XIAO series. It is built around the ESP32-S3R8, an SoC from Espressif Systems tailored for AI and edge computing tasks. It merges the power of the ESP32-S3 SoC with integrated peripherals in a compact form factor, while adding onboard vision and audio sensors.

The XIAO-ESP32-S3 Sense has four parts, the Main board, the Sense Hat, the Camera and the Wi-Fi Antenna:

Parts of the XIAO-ESP32-S3 Sense
Parts of the XIAO-ESP32-S3 Sense

The Sense Hat can be plugged into the main board and has SD card socket, a socket for the camera and a microphone. When assembled, it becomes a very compact unit with the dimensions of a 20mm cube. The picture below show the assembled XIAO-ESP32-S3-Sense board without Wi-Fi Antenna:

This image has an empty alt attribute; its file name is image-1.png
Assembled XIAO-ESP32-S3-Sense board without Wi-Fi Antenna
Assembled XIAO-ESP32-S3-Sense board without Wi-Fi Antenna

Power to the board can be supplied via the 5V Type-C USB port or via the battery charging interface that can be connected to a 3.7V LiPo battery. The current consumption of the board ranges from 64μA in deep-sleep mode, without any peripherals and ramps up to 340mA when taking a photo.

The Wi-Fi range of the board without the external Wi-Fi antenna will be fairly short but with the antenna can get up to 100m. The disadvantage of the antenna is obviously that it takes up space.

Main Board

The Main board has a tiny Reset and a tiny Button button. Next to the buttons are small LEDs for charging/power and an orange, user-controlled LED on GPIO21. Apart from the GPIO pins the main board also has the connecters for the external Wi-Fi antenna and the Sense Hat.

Main components of XIAO-ESP32-S3-Sense board
Main components of XIAO-ESP32-S3-Sense board (source)

The following list shows the technical features of the Main board:

  • Microcontroller: Espressif ESP32-S3R8 SoC
    • CPU: Dual-core Xtensa® LX7, up to 240 MHz
    • Instruction Set: 32-bit, with vector extension support for machine learning and DSP workloads
    • AI Acceleration: Includes vector instructions for lightweight neural network processing
    • ROM: 384 KB
    • SRAM: 512 KB
    • External RAM: 8 MB PSRAM
    • Flash: 8 MB QSPI NOR Flash
  • Wi-Fi: IEEE 802.11 b/g/n (2.4 GHz only)
  • Bluetooth® LE 5.0: Supports BLE Mesh and long-range mode
  • Antenna options:
    • Onboard PCB antenna
    • U.FL connector for external antenna (better range and signal tuning)
  • GPIOs: 11 multifunctional GPIO pins (all support PWM, digital I/O, and some analog capabilities)
  • ADC: 6 channels of 12-bit ADC
  • I2C: 1 × I2C interface
  • SPI: 1 × SPI interface
  • UART: 1 × UART interface
  • I2S: for audio applications
  • USB:
    • Native USB 1.1 with full-speed support (12 Mbps)
    • Supports USB-OTG (Host/Device mode)
    • Onboard USB Type-C connector for power, programming, and serial communication

Sense Hat

As mentioned before, the Sense Hat on top of the Main board carries the Camera, the Microphone and a Micro SD Card socket:

  • Camera Module:
    • Model: OV2640
    • Resolution: Up to 1600 × 1200 (UXGA)
    • Interface: 24-pin connector (8-bit parallel DVP + I2C)
    • FOV: ~60–65°
    • Frame Rate: Up to 30 FPS at lower resolutions
  • Digital Microphone:
    • Model: MP34DT06JTR (MEMS digital microphone)
    • Interface: PDM (Pulse Density Modulation)
    • Sensitivity: −26 dBFS
    • Signal-to-Noise Ratio: 61 dB(A)
  • SD Card Socket
    • up to 32GB FAT

Pinout of the XIAO-ESP32-S3-Sense board

The following picture shows the Pinout of the XIAO-ESP32-S3-Sense board:

Pinout of XIAO-ESP32-S3-Sense board
Pinout of XIAO-ESP32-S3-Sense board (source)

The 5V pin is the 5V from the USB port. The 3V3 pin provides the output from the onboard regulator and can deliver up to draw 700mA. And GND provides ground.

As for GPIOs: the board offers 11 digital/analog GPIOs but GPIO0, GPIO3, GPIO43 and GPIO44 are strapping pins that need to be in a specific state during startup. Once the microcontroller is running the strapping pins operate as regular IO pins but you should still avoid them if possible. For more details see the Getting Started Wiki by Seeed Studio.

The Sense Hat provide two more GPIO pins (GPIO41, GPIO42) that are available for GPIO when the microphone is not used.

Pinout of XIAO-ESP32-S3-Sense hat (source)

Schematics

For more detailed information, also have a look at the schematics of the XIAO-ESP32-S3-Sense board, which you can find under the following link.

Install ESP32 Core

If you want to use the Arduino IDE to program the board (as we will), you first need to install the ESP32 Core to enable support for ESP32 boards within the Arduino IDE. Open your Arduino IDE and follow the steps outlined below. If you have issues, you can find more detailed instructions in our tutorial How to Program ESP32 with Arduino IDE.

Additional boards manager URLs

First open the Preferences dialog by selecting “Preferences…” from the “File” menu:

Open Preferences Dialog
Open Preferences Dialog

This will open the Preferences dialog shown below. Under the Settings tab you will find an edit box at the bottom of the dialog that is labelled “Additional boards manager URLs“:

In this input field copy the following URL: “https://espressif.github.io/arduino-esp32/package_esp32_dev_index.json

This will let the Arduino IDE know, where to find the ESP32 core libraries. Next we will actually install the ESP32 core libraries using the Boards Manager.

Boards Manager

Open the BOARDS MANAGER by clicking on the board icon in the sidebar of the Arduino IDE:

Board icon in Sidebar
Board icon in Sidebar

You will see the BOARDS MANAGER appearing right to the Sidebar. Enter “ESP32” in the search field at the top and you should see two types of ESP32 boards; the “Arduino ESP32 Boards” and the “esp32 by Espressif” boards. We want the esp32 libraries by Espressif. Click on the INSTALL button and wait until the download and install is complete.

Install ESP32 Core libraries
Install ESP32 Core libraries

Once installed, your Boards Manager should look like this, though the actual version (here 3.0.0-a) might be different.

ESP32 core installed
ESP32 core installed

In the next step, I show you how to select the ESP32 board for the XIAO-ESP32-S3-Sense.

Select XIAO_ESP32S3 board

You can select a board from the drop-down selector under the menu bar: In the example below it shows an Arduino Uno as selected board, for instance:

Bord selector
Bord selector

Clicking on the name of the currently selected board (Arduino Uno), will open the board selection dialog. In the search box type “xiao s3” and select the “XIAO_ESP32S3” as shown below:

Select XIAO_ESP32S3 in Board Manager
Select XIAO_ESP32S3 in Board Manager

If the board is connected to your PC via USB, you should also be able to select the COM port. In the screenshot above this is COM9 but in your case it might be another COM port.

Code Examples

In this section, I will provide you with some code examples on how to use the microphone and the camera of the board. We will, however, start with the common Blink example to test the installation of the board and the USB communication.

Blink on-board LED

This is the common Blink example. It switches the on-board LED on and off for one second. The on-board LED of the XIAO-ESP32-S3 Sense is connected to GPIO21 but is inverted. LOW means the LED is on and HIGH means the LED is off. You can see this in the code example below:

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

void loop() {
  Serial.println("Off");
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);     
  Serial.println("On");                 
  digitalWrite(LED_BUILTIN, LOW);   
  delay(1000);                      
}

Read & Write GPIO

In the following very short examples, we read and write GPIO. For specifying pins in code you can use the GPIO x number or the Dx number. For instance, according to the pinout, D3 or GPIO4 identify the same pin and in your code you can use either. The following two code example are identical in function and set GPIO4 to HIGH:

digitalWrite(D3, HIGH);  // D3 == GPIO4
digitalWrite(4, HIGH);  // D3 == GPIO4

If you want to read analog signals you can use the predefined Ax constants. For instance, the following code reads an analog input from A3, which is the same as the GPIO4 pin:

int val = analogRead(A3);  // A3 == GPIO4
int val = analogRead(4);  // A3 == GPIO4

Analog values range from 0 to 4095, which is equivalent to a voltage at the input between 0 and 3.3V.

Read Microphone Signal

The next example uses the built-in microphone to sample audio data via I2S and displays the audio data on the Serial Monitor and Serial Plotter:

#include "ESP_I2S.h"

const int8_t I2S_CLK = 42;
const int8_t I2S_DIN = 41;
const uint32_t SAMPLERATE = 16000;

I2SClass I2S;

void setup() {
  Serial.begin(115200);

  I2S.setPinsPdmRx(I2S_CLK, I2S_DIN);
  if (!I2S.begin(I2S_MODE_PDM_RX, SAMPLERATE, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_MONO)) {
    Serial.println("Can't find microphone!");
    while (1)
      ;
  }
}

void loop() {
  int sample = I2S.read();
  if (sample > 1) {
    Serial.println(sample);
  }
}

If you run the code, open the Serial Plotter and whistle at fixed frequency, you can see a nice sine wave on the Serial Plotter:

Audio Signal in Serial Monitor measured with Microphone
Audio Signal in Serial Monitor measured with Microphone

If you vary the frequency by whistling a bit lower or higher, you will see that the frequency of the displayed sine wave changes accordingly. Pretty neat ; )

Record Audio

The following example code show you how to record 20 seconds of audio and writes the data as an audio file in WAV format to the SD Card. You will need a formatted SD Card.

As soon as you open the Serial Monitor, the code prints “20 SEC RECORDING STARTED …” and starts the recording. After 20 seconds it writes the audio file and prints “COMPLETE.”. You can then unplug the SD Card and listen to the recorded audio on your computer.

#include "ESP_I2S.h"
#include "FS.h"
#include "SD.h"

void setup() {
  I2SClass i2s;
  uint8_t *wav_buffer;
  size_t wav_size;

  Serial.begin(115200);
  while (!Serial) {
    delay(10);
  }

  i2s.setPinsPdmRx(42, 41);
  if (!i2s.begin(I2S_MODE_PDM_RX, 16000, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_MONO)) {
    Serial.println("Can't find microphone!");
    while (1); // do nothing
  }

  if(!SD.begin(21)){
    Serial.println("Failed to mount SD Card!");
    while (1) ;
  }

  Serial.println("20 SEC RECORDING STARTED ...");
  wav_buffer = i2s.recordWAV(20, &wav_size);

  File file = SD.open("/audio.wav", FILE_WRITE);
  if (!file) {
    Serial.println("Failed to open file for writing!");
    return;
  }

  if (file.write(wav_buffer, wav_size) != wav_size) {
    Serial.println("Failed to write audio data to file!");
    return;
  }

  file.close();
  Serial.println("COMPLETE.");
}

void loop() {
  delay(1000);
}

If you want more information on how to record audio have a look at the Record Audio with XIAO-ESP32-S3-Sense tutorial.

Stream Video

As a final example we are going to stream video data to the web browser on your computer. However, the code requires the esp32cam library, which you can install it via the Library Manager in the Arduino IDE. Just search for “esp32cam” and press INSTALL. The picture below shows the completed installation:

esp32cam library installed via Library Manager
esp32cam library installed via Library Manager

Also, in the code below you will have replace SSID and PASSWORD with the actual credentials of your Wi-Fi network.

Next you should set the following parameter for the board under the Tools menu:

  • enable: OPI PSRAM
  • set Partition Scheme: Maximum APP

This should allow you to compile and run the code. It will print the URL for the video stream to the Serial Monitor, e.g. “Stream at: http://192.168.2.40/stream”. If you then copy&paste this URL into the address bar of your Webbrowser, you should see the video.

#include "WebServer.h"
#include "WiFi.h"
#include "esp32cam.h"

const char* WIFI_SSID = "SSID";
const char* WIFI_PASS = "PASSWORD";
const char* URL = "/stream";
const auto RESOLUTION = esp32cam::Resolution::find(800, 600);
const int FRAMERATE = 10;

WebServer server(80);

void handleStream() {
  static char head[128];
  WiFiClient client = server.client();

  server.sendContent("HTTP/1.1 200 OK\r\n"
                     "Content-Type: multipart/x-mixed-replace; "
                     "boundary=frame\r\n\r\n");

  while (client.connected()) {
    auto frame = esp32cam::capture();
    if (frame) {
      sprintf(head,
              "--frame\r\n"
              "Content-Type: image/jpeg\r\n"
              "Content-Length: %ul\r\n\r\n",
              frame->size());
      client.write(head, strlen(head));
      frame->writeTo(client);
      client.write("\r\n");
      delay(1000/FRAMERATE);
    }
  }
}

void initCamera() {
  using namespace esp32cam;
  Config cfg;
  cfg.setPins(pins::XiaoSense);
  cfg.setResolution(RESOLUTION);
  cfg.setBufferCount(2);
  cfg.setJpeg(80);
  Camera.begin(cfg);
}

void initWifi() {
  WiFi.persistent(false);
  WiFi.mode(WIFI_STA);
  WiFi.begin(WIFI_SSID, WIFI_PASS);
  while (WiFi.status() != WL_CONNECTED) {
    delay(100);
  }
  Serial.printf("Stream at: http://%s%s\n",
                WiFi.localIP().toString().c_str(), URL);
}

void initServer() {
  server.on(URL, handleStream);
  server.begin();
}

void setup() {
  Serial.begin(115200);
  initWifi();
  initCamera();
  initServer();
}

void loop() {
  server.handleClient();
}

If you want more detailed information have a look at the Stream Video with with XIAO-ESP32-S3-Sense tutorial.

And that’s it! Now you should have enough information to use the camera, microphone and GPIO of the XIAO-ESP32-S3 Sense board.

Conclusions

This post showed you how to quickly get started with the Seeed Studio XIAO-ESP32-S3 Sense. Seeed Studio has a lot more information in its Getting Started Wiki.

Compared to other similar board such as the ESP32-CAM or the ESP32-WROVER CAM, which also have cameras, the advantages of the XIAO-ESP32-S3 Sense are the much smaller size, the additional microphone and a microcontroller that has specific support for AI application, such as object classification, face detection and more. You can find various pretrained modeled on the Seeed Studio site, where the SenseCraft AI platform enables the easy deployment of these models.

If you have any questions feel free to leave them in the comment section.

Happy Tinkering 😉