Getting Started with Seeed XIAO BLE nRF52840 Sense

We’ll learn about the latest Seeed XIAO BLE nRF52840 Sense Board from Seeedstudio in this getting started the lesson. They just released two boards based on Nordic Semiconductors nRF52840 BLE 5.2 Chip. The boards are labeled Seeed XIAO BLE nRF52840 and Seeed XIAO BLE nRF52840 Sense on one side and Seeed XIAO BLE nRF52840 Sense on the other.

The Seeed XIAO BLE is a Bluetooth development board with an ultra-small size and low power consumption based on the Nordic nRF52840. It has an inbuilt Bluetooth antenna and a battery charging chip, making it excellent for Internet of Things projects. Similarly, the Seeed XIAO BLE nRF52840 Sense is a small Bluetooth BLE development board for IoT and AI. It has an inbuilt antenna, a 6-DOF IMU, and a microphone, making it a perfect board for running AI with TinyML and TensorFlow Lite.

Earlier, we learned about Makerfabs nRF52840 Board which is a little large board. But Seeed XIAO BLE nRF52840 is a simplified board.

This tutorial covers the following parts:

  • Discover the distinctions between XIAO BLE nRF52840 and XIAO BLE nRF52840 Sense.
  • Examine the board’s design, as well as the pins’ descriptions and functions.
  • Set up the Arduino IDE to work with the nRF52840 board.
  • Blinking an LED with an Arduino Code
  • Learning how to change light intensity using an ADC pin
  • Temperature and humidity values are read through a DHT11 sensor
  • Displaying text on 0.96″ I2C OLED Display

Seeed XIAO BLE nRF52840 (Sense)

The Seeed XIAO BLE is based on the Nordic nRF52840 microcontroller, which is integrated into a Bluetooth 5.2 chipset. The chip is constructed around a 32-bit ARM® Cortex™-M4 CPU with a Floating-Point Unit(FPU) operating at 64Mhz. The best aspect of this module is that only consumes 5 μA under the deep sleep model. The board features a BQ25101 chip that facilitates battery charge control. There is an enhanced version of the “Seeed XIAO BLE Sense” that has both 6-axis IMU and PDM microphones to better support IoT and TinyML AI projects.

Seeed XIAO BLE nRF52840 Sense

On one side of the Type-C interface, the board contains a small and stylish reset button. It is, on the other hand, intended as a three-in-one LED with a power LED. There are 11 digital i/o pins that can be used as PWM pins and six analog i/o pins that can be used as ADC pins on the board. It supports all three common serial ports: UART, IIC, and SPI. Because the board has 2 MB of flash onboard, it can be programmed using Arduino, MicroPython, and CircuitPython. Near Field Communication (NFC) is supported by the board (NFC).


  • Powerful CPU: Nordic nRF52840, ARM® Cortex™-M4 32-bit processor with FPU operating at 64 MHz
  • Wireless capabilities: Bluetooth 5.0, NFC, and ZigBee module with onboard antenna
  • Ultra-small size: 21 x 17.5mm, Seeed Xiao series classic form-factor for wearable devices
  • Ultra-low sleep power: 5 μA, deep sleep model
  • Battery charging chip: BQ25101 chip supported lithium battery charge management
  • Rich interface: 1x Reset button, Ix UART, 1x IIC, 1x SPI, 1x NFC, 1x SWD, 11x GPIO, 6x ADC, 1x Three-in-one LED,1x User LED
  • Onboard 2 MB flash
  • Onboard PDM microphone and 6-axis IMU (only for XIAO BLE nRF52840 Sense)
  • Single-sided components, surface mounting design

Seeed XIAO BLE nRF52840 VS Seeed XIAO BLE nRF52840 Sense

ItemSeeed XIAO BLE – nRF52840Seeed XIAO BLE Sense – nRF52840
  Processor  Nordic nRF52840  The same as XIAO BLE
  ARM® Cortex®-M4 with FPU run up to 64 MHz
  Wireless  Bluetooth 5.0/NFC/Zigbee  The same as XIAO BLE
  On-chip Memory  1 MB flash and 256 kB RAM  The same as XIAO BLE
  Onboard Memory  2 MB QSPI flash  The same as XIAO BLE
  Interface  1xUART, 1xIIC, 1xSPI, 1xNFC, 1xSWD,  The same as XIAO BLE
  11xGPIO(PWM), 6xADC
  Sensors  Onboard PDM digital microphone
  Onboard 6-axis IMU
  Dimensions  21 x 17.5mm  The same as XIAO BLE
  Power  Circuit operating voltage: 3.3V@200mA  The same as XIAO BLE
  Charging current: 50mA/100mA
  Input voltage (VIN): 5V
  Standby power consumption:  <5μA

Hardware Pinout

There are 11 digital i/o pins that can be used as PWM pins and six analog i/o pins that can be used as ADC pins on the board. It supports all three common serial ports: UART, IIC, and SPI.

The topside of the board has a reset button, 6 DOF IMU LSM6DS3TR-C, Bluetooth Antenna, PDM Microphone, RGB LED & power LED.

SWD Pins are located on the backside of the board and are used to debug and reflash the bootloader using JLink. The NFC Antenna and a 3.7V Lithium-Ion Battery are connected via a pair of pins.

Setting Up Arduino IDE

Let’s look at how to use the Seeed XIAO BLE nRF52840 (Sense) with the Arduino IDE now. To begin programming, we must first set up the Arduino IDE.

Seeed XIAO nRF52840 Sense

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

Software Setup

According to your operating system, download and install the newest version of Arduino IDE. The Arduino application will then be launched.

The NRF52840 Board does not come with any pre-installed software. As a result, we must first install the Arduino IDE on the board. To do so, go to File > Preferences and fill in the “Additional Boards Manager URLs” field with the following URL:

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

Select “Seeed XIAO BLE – nRF52840” from Tools > Board > Seeed nRF Boards after installing the board package. We’ve now completed the setup of the XIAO BLE (Sense) for Arduino IDE.

Navigate to Tools > Port and select the serial port. You can get the port number from the Device Manager.

Writing an Arduino Code to Blink an LED

Navigate to File > Examples > Basics > Blink to open the Blink example. Then upload the code.

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.

// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second

After uploading the code, the on-board will turn-ON and OFF for 1 second.

Using ADC Pin to control the LED Brightness

Let’s control the LED brightness with a potentiometer now. The LED will serve as an output and the potentiometer will serve as an input. A simple connection schematic is shown below.

Connect the potentiometer’s pins 1, 2, and 3 to 3.3V, analog pin A0, and GND on the XIAO BLE nRF52840, respectively. Using a 220-ohm resistor, connect the positive pin of the LED to digital pin 10. Connect the GND of the LED to GND.

Copy the following code and upload it to the Seeed XIAO BLE nRF52840 (Sense) Board.

const int LED = 10;
const int analog_ip = A0;
int inputVal = 0;
float mv_per_lsb = 3300.0F / 1024.0F; // 10-bit ADC with 3.3V input range

void setup()
while ( !Serial ) delay(10); // for nrf52840 with native usb
pinMode (LED, OUTPUT);

void loop()
inputVal = analogRead(analog_ip);
Serial.print((float)inputVal * mv_per_lsb);
Serial.println(” mV”);
analogWrite (LED, inputVal);

You can now open Serial Monitor and begin moving the potentiometer knob after the code has been published. With the ADC voltage varying from 0-3.3V, the Serial Monitor will display various analog numbers.

Similarly the LED brightness increases or decreases on the basis of potentiometer rotation.

Seeed XIAO nRF52840 ADC

Reading Temperature & Humidity Value from DHT11 Sensor

Let’s connect the DHT11 Humidity sensor to the Seeed XIAO BLE nRF52840 Sense now. The DHT11 is a basic digital temperature and humidity sensor with a modest price tag. It measures the ambient air with a capacitive humidity sensor and a thermistor and outputs a digital signal on the data pin.

Seeed XIAO BLE nRF52840 DHT11

Connect the DHT11 Sensor’s VCC and GND pins to the nRF52840’s 3.3V and GND pins, respectively. Connect the DHT11 Sensor’s digital output pin to XIAO BLE nRF52840’s digital pin 7.

  • The DHT11 Library must be installed in order to utilize this code with the Arduino IDE.
  • Now copy and paste the following code onto the Seeed XIAO nRF52840 board.
#include <dht.h>
#define dht_pin 7 // Analog Pin sensor is connected to

dht DHT;

void setup()


void loop()

Serial.print(“Humidity: “);
Serial.println(“% “);

Serial.print(“Temperature: “);
Serial.println(“°C “);

Open Serial Monitor after submitting the code to observe the temperature and humidity data displayed on the screen.

Displaying text on 0.96″ I2C OLED Display

Let’s connect the Seeed XIAO nRF52840 Sense to the SSD1306 0.96″ I2C OLED Display. As illustrated in the graphic below, the connection is quite straightforward.

Seeed XIAO nRF52840 Sense OLED
  • Connect the OLED Display’s VCC and GND pins to the nRF5840’s 3.3V and GND pins. Connect the OLED’s SDA and SCL pins to the nRF5840’s SDA and SCL pins.
  • To use this code with Arduino IDE, you need to install Adafruit GFX Library and also Adafruit SSD1306 Library.
  • Now copy the following code and upload it to the Seeed XIAO nRF52840 board.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

void setup()

if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) // Address 0x3D for 128×64
Serial.println(F(“SSD1306 allocation failed”));

display.setCursor(0, 10);
// Display static text

void loop() {


The OLED Display will begin showing the text assigned in the code part as soon as the code is uploaded.

Seeed XIAO nRF52840 Sense OLED Display


I hope all of you had understand Getting Started with Seeed XIAO BLE nRF52840 Sense. We MATHA ELECTRONICS will be back soon with more informative blogs.

Leave a Reply

Your email address will not be published.