Skip to Content

Getting Started with XIAO ESP32-C5 and Arduino IDE

Getting Started with XIAO ESP32-C5 and Arduino IDE

The Seeed Studio XIAO ESP32-C5 is a compact development board based on the ESP32-C5 microcontroller. It follows the small XIAO form factor, making it suitable for space-constrained and embedded projects.

At its core, the board uses a 32-bit RISC-V processor running at up to 240 MHz. One of its key features is dual-band Wi-Fi 6 support. It operates on both 2.4 GHz and 5 GHz bands. The board also supports Bluetooth Low Energy, as well as protocols like Zigbee and Thread.

In this tutorial you will learn how the program the XIAO ESP32-C5 using the Arduino IDE.

Where to Buy

You can get the XIAO ESP32-C5 at Seeed Studio. You will also need a USB-C cable, if you haven’t one already. Also small heatsink might be useful if you run demanding computation on the board.

XIAO ESP32-C5

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-C5 board

The Seeed Studio XIAO ESP32-C5 is based on the ESP32-C5 system-on-chip. It uses a 32-bit RISC-V single-core processor running at up to 240 MHz. The chip also includes a low-power core for energy-efficient operation. This architecture is designed for IoT workloads that require both performance and low power consumption. The picture below shows the front and back of the board.

Front and Back of XIAO ESP32-C5 board
Front and Back of XIAO ESP32-C5 board

The microcontroller integrates internal memory blocks, including ROM and SRAM, for fast execution. It also supports external memory, which is connected on the board. Hardware acceleration is available for cryptographic operations such as AES and SHA, enabling secure communication and device authentication.

Memory Configuration

The board provides 8 MB of external flash memory and 8 MB of PSRAM. This allows the execution of more complex firmware, including networking stacks and multitasking applications.

On-chip memory includes 384 KB of SRAM and 320 KB ROM. This internal memory is used for time-critical operations and system functions. The combination of internal and external memory enables efficient handling of buffers, protocols, and application data.

Wireless Connectivity

The ESP32-C5 supports dual-band Wi-Fi 6 operation on both 2.4 GHz and 5 GHz bands. This improves throughput and reduces interference in dense wireless environments.

In addition to Wi-Fi, the chip supports Bluetooth 5 Low Energy. It also includes support for Zigbee and Thread via IEEE 802.15.4. This allows the device to act as a bridge between different IoT ecosystems.

The Wi-Fi subsystem supports multiple operating modes, including station and access point mode. It also supports concurrent operation, which allows the device to maintain connections while providing network services.

GPIO and Peripheral Interfaces

The XIAO ESP32-C5 exposes 11 GPIO pins. These pins are multiplexed and support multiple functions. Common interfaces include I2C, SPI, and UART for communication with external devices. The picture below shows the pinout of the board:

Pinout of the XIAO ESP32-C5
Pinout of the XIAO ESP32-C5 (source)

Several GPIO pins support PWM output for motor control or LED dimming. The board also provides multiple ADC channels for analog signal measurement. Debugging is supported through JTAG pads located on the back of the board.

The USB-C interface is used for both power supply and programming. The operating voltage of the board is 3.3 V, while 5 V is supplied through the USB interface.

Power Management

The board includes an integrated battery charging circuit for lithium batteries. This allows direct connection of a 3.7 V Li-Po battery for portable applications. The picture below shows how to connect a Li-Po battery to the BAT pads on the back of the board:

Connecting LiPo battery to XIAO ESP32-C5
Connecting LiPo battery to XIAO ESP32-C5 (source)

Power consumption is optimized through multiple sleep modes. In deep sleep mode, the current can drop to very low levels, making the board suitable for long-term battery-powered deployments.

The ESP32-C5 also supports advanced power-saving features within the wireless subsystem. These features reduce energy usage during idle periods while maintaining connectivity.

Physical Characteristics and Onboard Components

The board follows the XIAO form factor and measures approximately 21 x 17.8 x 4 mm. This compact size makes it suitable for embedded and wearable designs.

Dimensions of XIAO ESP32-C5
Dimensions of XIAO ESP32-C5

It includes a reset button and a boot button for firmware control. Two onboard LEDs are available, one for user control and one for charging indication.

LEDs and Buttons of the XIAO ESP32-C5
LEDs and Buttons of the XIAO ESP32-C5

An external antenna connection is provided via a U.FL connector. This improves RF performance compared to onboard PCB antennas. The board is designed to operate in a temperature range suitable for most embedded and industrial applications.

Technical Specification

The following table summarizes the technical features of the XIAO ESP32-C5:

ParameterSpecification
MicrocontrollerESP32-C5
CPU32-bit RISC-V, up to 240 MHz
Low-power coreYes
Flash memory8 MB
PSRAM8 MB
Internal SRAM384 KB
Internal ROM320 KB
Wi-FiWi-Fi 6, 2.4 GHz and 5 GHz
BluetoothBluetooth 5 LE
IEEE 802.15.4Zigbee and Thread support
GPIOUp to 11 pins
Analog inputADC supported
InterfacesUART, SPI, I2C, PWM
USBUSB Type-C
Operating voltage3.3 V
Input voltage5 V via USB
Battery support3.7 V Li-Po with charging
AntennaU.FL connector
DebuggingJTAG support
Dimensions21 × 17.8 mm

Install ESP32 Core

If you want to use the Arduino IDE to program the board, 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 Install ESP32 core in 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.3.7) 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-C5.

Select XIAO_ESP32C5 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 “c5” and select the “XIAO_ESP32C5” as shown below:

Select XIAO_ESP32C5 in Board Manager
Select XIAO_ESP32C5 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 to try out the main features of the XIAO ESP32-C5.

Blink on-board LED

We start with the common Blink example. It switches the on-board LED on and off for one second. The on-board LED of the XIAO ESP32-C5 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.

Battery Voltage

The XIAO ESP32-C5 has internal wiring that allows you to read the voltage of the connected power supply. The following code examples shows you how enable this function and monitor the battery voltage, for instance:

#include <Arduino.h>

void setup() {
  Serial.begin(115200);
  pinMode(BAT_VOLT_PIN, INPUT);  // A0 as ADC input
  pinMode(BAT_VOLT_PIN_EN, OUTPUT);
  digitalWrite(BAT_VOLT_PIN_EN, HIGH);
}

void loop() {
  uint32_t Vbatt = analogReadMilliVolts(BAT_VOLT_PIN);
  // Adjust for 1:2 divider and convert to volts
  float Vbattf = 2 * Vbatt / 1000.0;  
  
  Serial.println(Vbattf, 2);               
  delay(1000);                             
}

Wi-Fi

The following example shows you how to connect the XIAO ESP32-C5 to a Wi-Fi network. You will need to attach the antenna for this example to work!

#include <WiFi.h>

const char* ssid = "YOUR_SSID";
const char* password = "YOUR_PASSWORD";

void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid, password);

  Serial.print("Connecting");
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("\nConnected");
  Serial.println(WiFi.localIP());
}

void loop() {
}

Bluetooth

This final example demonstrates how to create a simple Bluetooth Low Energy (BLE) server.

#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>

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

  BLEDevice::init("XIAO-ESP32-C5");
  BLEServer *pServer = BLEDevice::createServer();
  BLEDevice::getAdvertising()->start();

  Serial.println("BLE server started");
}

void loop() {
}

You can check whether the server is active by using a BLE scanner on your phone. Common options are nRF Connect or LightBlue. If you initiate a scan, you will see “XIAO-ESP32-C5” appearing.

Conclusions

This post showed you how to get started with the Seeed Studio XIAO ESP32-C5. Seeed Studio provides additional information in its Wiki.

The XIAO ESP32-C5 is especially suited for IoT application that require dual-band Wi-Fi and protocols like Zigbee and Thread.

For applications that need more compute power and GPIO, have a look a the XIAO ESP32-S3-Plus. And should you need a built-in microphone or a camera, the XIAO MG24 Sense or the XIAO-ESP32-S3-Sense will suit these use cases.

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

Happy Tinkering 😉