edit

Getting Started with XIAO BLE (Sense)

pir

As the first wireless product in the Seeed XIAO family, Seeed XIAO BLE is equipped with a powerful Nordic nRF52840 MCU which integrates Bluetooth 5.0 connectivity. Meanwhile, it has a small and exquisite form-factor which can be used for wearable devices and Internet of Things projects. The single-sided surface-mountable design and the onboard Bluetooth antenna can greatly facilitate the rapid deployment of IoT projects.

In addition, there is an advanced version of this board, Seeed XIAO BLE Sense. It is integrated with two extra onboard sensors. One of them is a Pulse Density Modulation (PDM) Digital Microphone. It can receive audio data in real-time which allows it to be used for audio recognition. The other one is a 6-axis Inertial Measurement Unit (IMU), this IMU can be very useful in TinyML projects like gesture recognition. These onboard sensors provide a great convenience for users while the board is ultra-small.

Compared to XIAO RP2040, XIAO BLE contains richer interfaces. The first thing to note is that the Near Field Communication (NFC) interface is functional on the board. Secondly, there is a tiny reset button on the side of the Type-C interface. On the other side, there is a 3-in-one LED (User LED) along with a Charge LED to indicate the charging status when a battery is connected. There are 11 digital I/O that can be used as PWM pins and 6 analog I/O that can be used as ADC pins. It supports all three common serial interfaces such as UART, I2C, and SPI. Same as Seeed XIAO RP2040, it has an onboard 2 MB flash which means it can also be programmed using Arduino, MicroPython, CircuitPython, or other programming languages.

XIAO BLE Sense is compatible to the XIAO expansion board.

This wiki will show you both the modules, Seeed XIAO BLE and advanced version Seeed XIAO BLE Sense and how to get started with them quickly.

Features

  • Powerful wireless capabilities: Bluetooth 5.0 with onboard antenna
  • Powerful CPU: Nordic nRF52840, ARM® Cortex®-M4 32-bit processor with FPU, 64 MHz
  • Ultra-Low Power: Standby power consumption is less than 5μA
  • Battery charging chip: Supports lithium battery charge and discharge management
  • Onboard 2 MB flash
  • Onboard PDM microphone (only in XIAO BLE Sense)
  • Onboard 6-axis LSM6DS3TR-C IMU (only in XIAO BLE Sense)
  • Ultra Small Size: 20 x 17.5mm, XIAO series classic form-factor for wearable devices
  • Rich interfaces: 1xUART, 1xI2C, 1xSPI, 1xNFC, 1xSWD, 11xGPIO(PWM), 6xADC
  • Single-sided components, surface mounting design

Specifications comparison

Item Seeeduino XIAO Seeed XIAO RP2040 Seeed XIAO BLE Seeed XIAO BLE Sense
Processor SAMD21 M0+@48MHz RP2040 Dual-core M0+@133Mhz nRF52840 M4F@64MHz nRF52840 M4F@64MHz
Wireless Connectivity N/A N/A Bluetooth 5.0/BLE/NFC Bluetooth 5.0/BLE/NFC
Memory 32 KB SRAM 256KB FLASH 264 KB SRAM 2MB onboard Flash 256 KB RAM, 1MB Flash 2MB onboard Flash 256 KB RAM,1MB Flash 2MB onboard Flash
Built-in Sensors N/A N/A N/A 6 DOF IMU (LSM6DS3TR-C), PDM Microphone
Interfaces I2C/UART/SPI I2C/UART/SPI I2C/UART/SPI I2C/UART/SPI
PWM/Analog Pins 11/11 11/4 11/6 11/6
Onboard Buttons N/A Reset/ Boot Button Reset Button Reset Button
Onboard LEDs N/A Full-color RGB/ 3-in-one LED 3-in-one LED/ Charge LED 3-in-one LED/ Charge LED
Battery Charge Chip N/A N/A BQ25101 BQ25101
Programming Languages Arduino/ CircuitPython Arduino/ MicroPython/ CircuitPython Arduino/ MicroPython/ CircuitPython Arduino/ MicroPython/ CircuitPython

Hardware overview

pir

pir

pir

Getting started

First, we are going to connect the Seeed XIAO BLE (Sense) to the computer and upload a simple code from Arduino IDE to check whether the board is functioning well.

Hardware setup

You need to prepare the following:

Tip

Some USB cables can only supply power and cannot transfer data. If you don't have a USB cable or don't know if your USB cable can transmit data, you can check Seeed USB Type-C support USB 3.1 .

Connect the XIAO BLE (Sense) to your computer via a USB Type-C cable.

pir

Software setup

  • Step 1. Download and Install the latest version of Arduino IDE according to your operating system

pir

  • Step 2. Launch the Arduino application

  • Step 3. Add XIAO BLE (Sense) board package to your Arduino IDE

Navigate to File > Preferences, and fill "Additional Boards Manager URLs" with the url below: https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json

pir

Navigate to Tools > Board > Boards Manager..., type the keyword "seeed nrf52" in the search box, select the latest version of Seeed nRF52 Boards, and install it.

pir

  • Step 4. Select your board and port

Board

After installing the board package, navigate to Tools > Board > Arduino Mbed OS Boards and select "Seeed XIAO nRF52840 Sense". Now we have finished setting up the XIAO BLE (Sense) for Arduino IDE.

pir

Port

Navigate to Tools > Port and select the serial port name of the connected XIAO BLE (Sense). This is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). The serial port of the connected XIAO BLE (Sense) usually contains parentheses that are written Seeed XIAO nRF52840 for XIAO BLE or Seeed XIAO nRF52840 Sense for XIAO BLE Sense.

pir

  • Step 5. Navigate to File > Examples > 01.Basics > Blink to open Blink example

pir

  • Step 6. Click the Upload button to upload the Blink example code to the board

pir

Once uploaded, you will see the built-in red LED blinking with a 1-second delay between each blink. This means the connection is successful and now you can explore more projects with the XIAO BLE (Sense)!

Playing with the built-in 3-in-one LED

Seeed XIAO BLE (Sense) has an onboard 3-in-one LED which is user-programmable. Now you will learn how to control the RGB colors one-by-one using Arduino!

You first have to understand that the behavior of this LED is not as usual when controlled by the code. The LED turns ON when we give a LOW signal and it turns OFF when we give a HIGH signal. This is because this LED is controlled by a common anode and will light up only with a low-level signal.

An example code would be:

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   
}

Here, even though HIGH is used, the LED will be OFF. You need to replace HIGH with LOW to turn ON the LED.

Refer to the following pin mappings of the LEDs and use them in your codes:

  • Red LED - LED_BUILTIN or LEDR
  • Green LED - LEDG
  • Blue LED - LEDB

Power Consumption Verification

The XIAO BLE is low power consumption and here we provide a method to verify.

Note

If you are using the factory firmware of the XIAO BLE or have never made changes to the firmware of the XIAO BLE, you can skip this step.

  • Step 2. Please use version 1.0.0 of the XIAO BLE on-board files.

If you used the latest on-board package before this, please uninstall it again and then install version 1.0.0.

pir

pir

  • Step 3. Upload the deep_sleep demo here and run it with Arduino

  • Step 4. Adjust the voltage of the digital source meter to 3.6V constant voltage

  • Step 5. Touch the red test pen to BAT+ and black test pen to BAT-

pir

  • Step 6. The output shows the current is at about 3 μA

pir

Battery Charging current

The battery charging current is selectable as 50mA or 100mA, where you can set Pin13 as high or low to change it to 50mA or 100mA. The low current charging current is at the input model set up as HIGH LEVEL and the high current charging current is at the output model set up as LOW LEVEL.

Low Charging Current

int power_pin = 13;
void setup(){
pinMode (HiCHG, INPUT);
}
void loop() {
digitalWrite(power_pin, HIGH);
}

High Charging Current

int power_pin = 13;
void setup(){
pinMode (HiCHG, OUTPUT);
}
void loop() {
digitalWrite(power_pin, LOW);
}

Access the SWD Pins for Debugging and Reflashing Bootloader

Hardware Required

Software Required

It is required to download the Segger software from the website.

  • Step 1. Use Jlink to connect pins below:

pir

  • Step 2. Start the J-Flash and serach nRF52840, creating a new project:

pir

  • Step 3. Click "Target" and then select "Connect".

pir

  • Step 4. Draw the bin or hex file to software. Then press F4 and F5 in that order. The reflashing is done.

FAQ

Q1: My Arduino IDE is stuck when uploading code to the board

You can first try to reset the board by clicking the "Reset Button" once. If that does not work, rapidly click it twice to enter bootloader mode. If that also doesn't work, disconnect the board from the PC, and connect the board again.

Q2: My board is not showing up as a serial device on Arduino IDE

You can first try to reset the board by clicking the "Reset Button" once. If that does not work, rapidly click it twice to enter bootloader mode.

Resources

Tech support

Please submit any technical issues into our forum