Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use Xiao Samd21: Examples, Pinouts, and Specs

Image of Xiao Samd21Design with Xiao Samd21 in Cirkit Designer

Introduction

The Xiao SAMD21, manufactured by Seeed, is a compact microcontroller board based on the SAM D21 ARM Cortex-M0+ processor. Designed for low-power applications, it offers a versatile range of I/O options, including digital and analog pins, making it ideal for a variety of embedded systems and IoT projects. Its small form factor and powerful processing capabilities make it a popular choice for developers seeking a balance between performance and size.

Explore Projects Built with Xiao Samd21

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Solar-Powered GSM/GPRS+GPS Tracker with Seeeduino XIAO: A project utilizing Xiao Samd21 in a practical application
Solar-Powered GSM/GPRS+GPS Tracker with Seeeduino XIAO

This circuit features an Ai Thinker A9G development board for GSM/GPRS and GPS/BDS connectivity, interfaced with a Seeeduino XIAO microcontroller for control and data processing. A solar cell, coupled with a TP4056 charging module, charges a 3.3V battery, which powers the system through a 3.3V regulator ensuring stable operation. The circuit likely serves for remote data communication and location tracking, with the capability to be powered by renewable energy and interfaced with additional sensors or input devices via the Seeeduino XIAO.

Open Project in Cirkit Designer
Image of Xiao ESP32 C3 Based Temperature and Humidity Monitoring System: A project utilizing Xiao Samd21 in a practical application
Xiao ESP32 C3 Based Temperature and Humidity Monitoring System

This circuit features a Xiao ESP32 C3 microcontroller connected to a DHT11 Humidity and Temperature Sensor. The ESP32 C3 provides power to the DHT11 sensor through its VUSB pin and receives data from the sensor's DATA pin via the ESP32's D2 pin. The circuit is designed to measure environmental temperature and humidity, with the microcontroller processing and potentially communicating the sensor data.

Open Project in Cirkit Designer
Image of Wi-Fi Controlled Weather Station with Wemos D1 Mini and OLED Display: A project utilizing Xiao Samd21 in a practical application
Wi-Fi Controlled Weather Station with Wemos D1 Mini and OLED Display

This circuit is a weather monitoring system that uses a Wemos D1 Mini microcontroller to read temperature and humidity data from four DHT22 sensors and display the information on an Adafruit OLED screen. The data is also transmitted via WiFi to an MQTT server for remote monitoring. The system is powered by a 2000mAh battery, which is managed by a TP4056 charging module and a Mtiny Power module.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

The Xiao SAMD21 is packed with features that make it a versatile and efficient microcontroller board. Below are its key technical details:

Key Technical Details

Pin Configuration and Descriptions

The Xiao SAMD21 features a total of 14 pins, including power, digital, and analog pins. Below is the pinout description:

Pin Type Description
3V3 Power 3.3V output for powering external components.
GND Power Ground connection.
D0/RX Digital (UART) Digital I/O pin, also serves as UART RX (receive) pin.
D1/TX Digital (UART) Digital I/O pin, also serves as UART TX (transmit) pin.
D2 Digital Digital I/O pin with PWM support.
D3 Digital Digital I/O pin with PWM support.
D4 Digital Digital I/O pin with PWM support.
D5 Digital Digital I/O pin with PWM support.
A0 Analog/Digital Analog input (12-bit ADC) or digital I/O pin.
A1 Analog/Digital Analog input (12-bit ADC) or digital I/O pin.
A2 Analog/Digital Analog input (12-bit ADC) or digital I/O pin.
A3 Analog/Digital Analog input (12-bit ADC) or digital I/O pin.
A4 Analog/Digital Analog input (12-bit ADC) or digital I/O pin.
A5 Analog/Digital Analog input (12-bit ADC) or digital I/O pin.

Usage Instructions

The Xiao SAMD21 is easy to use and can be programmed using the Arduino IDE or other compatible development environments. Below are the steps to get started and some best practices for using the board.

How to Use the Xiao SAMD21 in a Circuit

  1. Powering the Board:

    • Connect the Xiao SAMD21 to your computer using a USB Type-C cable for power and programming.
    • Alternatively, supply 3.3V to the 3V3 pin and connect GND to ground.
  2. Programming the Board:

    • Install the Arduino IDE and add the Seeed SAMD Boards package via the Board Manager.
    • Select "Seeeduino XIAO" as the board in the Arduino IDE.
    • Write your code and upload it to the board using the USB connection.
  3. Connecting Peripherals:

    • Use the digital pins (D0-D5) for digital I/O operations, such as controlling LEDs or reading button states.
    • Use the analog pins (A0-A5) for reading sensor data or generating analog output signals.

Important Considerations and Best Practices

Example Code for Arduino UNO Compatibility

The following example demonstrates how to blink an LED connected to pin D2 of the Xiao SAMD21:

// Blink an LED connected to pin D2 on the Xiao SAMD21
const int ledPin = 2; // Define the LED pin (D2)

void setup() {
  pinMode(ledPin, OUTPUT); // Set the LED pin as an output
}

void loop() {
  digitalWrite(ledPin, HIGH); // Turn the LED on
  delay(1000);                // Wait for 1 second
  digitalWrite(ledPin, LOW);  // Turn the LED off
  delay(1000);                // Wait for 1 second
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. The board is not recognized by the computer:

    • Ensure the USB cable is not a power-only cable and supports data transfer.
    • Check that the correct board and port are selected in the Arduino IDE.
    • Double-tap the reset button to enter bootloader mode and try uploading the code again.
  2. Code upload fails:

    • Verify that the Xiao SAMD21 is connected to the correct COM port.
    • Ensure the Seeed SAMD Boards package is installed in the Arduino IDE.
    • Check for syntax errors in your code.
  3. Peripherals are not working as expected:

    • Confirm that the peripherals are connected to the correct pins.
    • Check that the voltage and current requirements of the peripherals are within the board's limits.

FAQs

By following this documentation, you can effectively utilize the Xiao SAMD21 for your projects and troubleshoot common issues with ease.