Nano 33 BLE Sense Rev2 Cheat Sheet

Learn how to set up the Nano 33 BLE Sense Rev2, get a quick overview of the components, information regarding pins and how to use different Serial (SPI, I2C, UART) and Wireless (Wi-Fi, Bluetooth®) protocols.

The Arduino® Nano 33 BLE Sense Rev2
The Arduino® Nano 33 BLE Sense Rev2

This article is a collection of guides, API calls, libraries and tutorials that can help you get started with the Nano 33 BLE Sense Rev2 board.

You can also visit the documentation platform for the Nano 33 BLE Sense Rev2.

Core

The Nano 33 BLE Sense Rev2 uses the Arduino Mbed OS Nano Boards core.

Datasheet

The full datasheet is available as a downloadable PDF from the link below:

Installation

Arduino IDE 1.8.X

The Nano 33 BLE Sense Rev2 can be programmed through the Classic Arduino IDE 1.8.X. To install your board, you can check out the guide below:

Arduino IDE 2.0.X

The Nano 33 BLE Sense Rev2 can be programmed through the Arduino IDE 2.0.X. To install your board, you can check out the guide below:

Web Editor

The Nano 33 BLE Sense Rev2 can be programmed through the Web Editor. To get started with your board, you will only need to install a plugin, which is explained in the guide below:

Using OpenMV IDE

If you want to use your board with MicroPython and OpenMV. Follow the tutorial below.

If you want an overlook of the functions and features that MicroPython provides, take a look at the tutorial below.

Forcing Bootloader

There is a risk that the uploading process gets stuck during an upload. If this happens, we can double-tap the reset button, to forcefully trigger the bootloader.

Pins

The pinout for Nano 33 BLE Sense Rev2.
The pinout for Nano 33 BLE Sense Rev2.

Analog Pins

The Nano 33 BLE Sense Rev2 has 8 analog pins, that can be used through the

analogRead()
function.

1value = analogRead(pin, value);

Please note: pin

A4
and
A5
should be used for I2C only.

PWM Pins

Pins D2-D12 and A0-A7 supports PWM (Pulse Width Modulation). Pins A4, A5 and D11, D12 are not recommended for PWM as they have I2C & SPI buses attached.

1analogWrite(pin, value);

Digital Pins

There are a total of 14 digital pins.

To use them, we first need to define them inside the

void setup()
function of our sketch.

1pinMode(pin, INPUT); //configured as an input
2pinMode(pin, OUTPUT); //configured as an output
3pinMode(pin, INPUT_PULLUP); //uses the internal 10k ohm resistor

To read the state of a digital pin:

1state = digitalRead(pin);

To write a state to a digital pin:

1digitalWrite(pin, HIGH);

5V Pin

The microcontroller on the Arduino Nano 33 BLE Sense Rev2 runs at 3.3V, which means that you must never apply more than 3.3V to its Digital and Analog pins. Care must be taken when connecting sensors and actuators to assure that this limit of 3.3V is never exceeded. Connecting higher voltage signals, like the 5V commonly used with the other Arduino boards, will damage the Arduino Nano 33 BLE Sense Rev2.

To avoid such risk with existing projects, where you should be able to pull out a Nano and replace it with the new Nano 33 BLE Sense, we have the 5V pin on the header, positioned between RST and A7 that is not connected as default factory setting. This means that if you have a design that takes 5V from that pin, it won't work immediately, as a precaution we put in place to draw your attention to the 3.3V compliance on digital and analog inputs.

5V on that pin is available only when two conditions are met: you make a solder bridge on the two pads marked as VUSB and you power the Nano 33 BLE Sense Rev2 through the USB port. There are two sets of VUSB pads on the Arduino Nano 33 BLE Sense Rev2, one set on the bottom and one set on top. To enable the 5V Pin, either one of these need to be connected If you power the board from the VIN pin, you won't get any regulated 5V and therefore even if you do the solder bridge, nothing will come out of that 5V pin. The 3.3V, on the other hand, is always available and supports enough current to drive your sensors. Please make your designs so that sensors and actuators are driven with 3.3V and work with 3.3V digital IO levels. 5V is now an option for many modules and 3.3V is becoming the standard voltage for electronic ICs.

Soldering the VUSB pins.
Soldering the VUSB pins.

IMU

The LSM9DS1 sensor
The LSM9DS1 sensor

BMI270 and BMM150

The Arduino Nano 33 BLE Sense Rev2 Inertial Measurement Unit system is made up of two separate IMUs, a 6-axis BMI270 and a 3-axis BMM150, effectively giving you a 9-axis IMU system. This allows you to detect orientation, motion, or vibrations in your project.

BMI270 and BMM150 Library

To access the data from the IMU system, we need to install the BMI270_BMM150 library, which comes with examples that can be used directly with the Nano 33 BLE Sense Rev2.

It can be installed directly from the library manager through the IDE of your choice. To use it, we need to include it at the top of the sketch:

1#include "Arduino_BMI270_BMM150.h"

And to initialize the library, we can use the following command inside

void setup()
.

1if (!IMU.begin()) {
2 Serial.println("Failed to initialize IMU!");
3 while (1);
4 }

Accelerometer

The accelerometer data can be accessed through the following commands:

1float x, y, z;
2
3 if (IMU.accelerationAvailable()) {
4 IMU.readAcceleration(x, y, z);
5 }

Gyroscope

The gyroscope data can be accessed through the following commands:

1float x, y, z;
2
3 if (IMU.gyroscopeAvailable()) {
4 IMU.readGyroscope(x, y, z);
5 }

Magnetometer

The magnetometer data can be accessed through the following commands:

1float x, y, z;
2
3 IMU.readMagneticField(x, y, z);

Tutorials

If you want to learn more on how to use the IMU, please check out the tutorial below:

Proximity and Gesture Detection

The APDS-9960 proximity and gesture sensor
The APDS-9960 proximity and gesture sensor

APDS9960

The APDS9960 chip allows for measuring digital proximity and ambient light as well as for detecting RGB colors and gestures.

APDS9960 Library

To access the data from the APDS9960 module, we need to install the APDS9960 library, which comes with examples that can be used directly with the Nano 33 BLE Sense Rev2.

It can be installed directly from the library manager through the IDE of your choice. To use it, we need to include it at the top of the sketch:

1#include <Arduino_APDS9960.h>

And to initialize the library, we can use the following command inside

void setup()
.

1if (!APDS.begin()) {
2 Serial.println("Error initializing APDS9960 sensor!");
3}

Then we check if there is data available from the proximity sensor. If there is we can print the value in the serial monitor. The value can range between 0-255, where 0 is close and 255 is far away. If it prints the value -1, it indicates an error.

1if (APDS.proximityAvailable()) {
2 Serial.println(APDS.readProximity());
3}

Tutorials

If you want to learn more on how to use the proximity sensor, please check out the tutorial below:

Temperature and Humidity Sensor

The HS3003 temperature and humidity sensor
The HS3003 temperature and humidity sensor

HS3003

The HS3003 capacitive digital sensor measures relative humidity and temperature. It has a temperature accuracy of ± 0.5 °C (between 15-40 °C) and is thereby perfectly suited to detect ambient temperature.

HS3003 Library

To access the data from the HS3003 module, we need to install the HS3003 library, which comes with examples that can be used directly with the Nano 33 BLE Sense Rev2.

It can be installed directly from the library manager through the IDE of your choice. To use it, we need to include it at the top of the sketch:

1#include <Arduino_HS300x.h>

And to initialize the library, we can use the following command inside

void setup()
.

1if (!HS300x.begin()) {
2 Serial.println("Failed to initialize humidity temperature sensor!");
3}

Then we can print our values in the serial monitor to check the temperature and humidity values.

1Serial.println(HS300x.readTemperature());
2Serial.println(HS300x.readHumidity());

Tutorial

If you want to learn more on how to use the temperature and humidity sensor, please check out the tutorial below:

Pressure Sensor

The LPS22HB pressure sensor
The LPS22HB pressure sensor

LPS22HB

The LPS22HB picks up on barometric pressure and allows for a 24-bit pressure data output between 260 to 1260 hPa. This data can also be processed to calculate the height above sea level of the current location.

LPS22HB Library

To access the data from the LPS22HB module, we need to install the LPS22HB library, which comes with examples that can be used directly with the Nano 33 BLE Sense Rev2.

It can be installed directly from the library manager through the IDE of your choice. To use it, we need to include it at the top of the sketch:

1#include <Arduino_LPS22HB.h>

And to initialize the library, we can use the following command inside

void setup()
.

1if (!BARO.begin()) {
2 Serial.println("Failed to initialize pressure sensor!");
3}

Then we can read the values from the sensor using the code below.

1BARO.readPressure();

Tutorial

If you want to learn more on how to use the temperature and humidity sensor, please check out the tutorial below:

Microphone

The MP34DT05 microphone
The MP34DT05 microphone

MP34DT06JTR

The MP34DT06JTR is a compact, low-power omnidirectional digital MEMS microphone with an IC interface. It has a 64 dB signal-to-noise ratio, is capable of sensing acoustic waves and can operate in temperatures of -40 °C to +85 °C.

PDM Library

To access the data from the MP34DT06JTR, we need to use the PDM library that is included in the Arduino Mbed OS Nano Boards core. If the core is installed, you will find an example that works by browsing File > Examples > PDM > PDMSerialPlotter.

Please note: The sampling frequency in the PDMSerialPlotter example is set to 16000 Hz. If the microphone appears to not be working (monitor is printing a value of -128), try to change this rate to 20000 Hz. You can change this at the top of the PDMSerialPlotter example sketch.

1static const int frequency = 20000; //frequency at 20 KHz instead of 16 KHz

Tutorial

If you want to learn more on how to use the Microphone, please check out the tutorial below:

RGB

To turn ON the pixels, write a

HIGH
state to the LED:

1digitalWrite(LEDR, HIGH); //RED
2digitalWrite(LEDG, HIGH); //GREEN
3digitalWrite(LEDB, HIGH); //BLUE

To turn OFF the pixels, write a

LOW
state to the LED:

1digitalWrite(LEDR, LOW); //RED
2digitalWrite(LEDG, LOW); //GREEN
3digitalWrite(LEDB, LOW); //BLUE

We can also choose a value between 255 - 0 to write to the LED:

1analogWrite(LEDR, 72); //GREEN
2analogWrite(LEDG, 122); //BLUE
3analogWrite(LEDB, 234); //RED

Communication

Like other Arduino® products, the Nano 33 BLE Sense Rev2 features dedicated pins for different protocols.

SPI

The pins used for SPI (Serial Peripheral Interface) on the Nano 33 BLE Sense Rev2 are the following:

  • (CIPO) - D12
  • (COPI) - D11
  • (SCK) - D13
  • (CS/SS) - Any GPIO

The signal names MOSI, MISO and SS has been replaced by COPI (Controller Out, Peripheral In), CIPO (Controller In, Peripheral Out) and CS (Chip Select).

To use SPI, we first need to include the SPI library.

1#include <SPI.h>

Inside

void setup()
we need to initialize the library.

1SPI.begin();

And to write to the device:

1digitalWrite(chipSelectPin, LOW); //pull down the CS pin
2
3 SPI.transfer(address); // address for device, for example 0x00
4 SPI.transfer(value); // value to write
5
6 digitalWrite(chipSelectPin, HIGH); // pull up the CS pin

I2C

The pins used for I2C (Inter-Integrated Circuit) on the Nano 33 BLE Sense Rev2 are the following:

  • (SDA) - A4
  • (SCL) - A5

To use I2C, we can use the Wire library, which we need to include at the top of our sketch.

1#include <Wire.h>

Inside

void setup()
we need to initialize the library.

1Wire.begin();

And to write something to a device connected via I2C, we can use the following commands:

1Wire.beginTransmission(1); //begin transmit to device 1
2 Wire.write(byte(0x00)); //send instruction byte
3 Wire.write(val); //send a value
4 Wire.endTransmission(); //stop transmit

UART

The pins used for UART (Universal asynchronous receiver-transmitter) are the following:

  • (Rx) - D0
  • (Tx) - D1

To send and receive data through UART, we will first need to set the baud rate inside

void setup()
.

1Serial1.begin(9600);

To read incoming data, we can use a while loop() to read each individual character and add it to a string.

1while(Serial1.available()){
2 delay(2);
3 char c = Serial1.read();
4 incoming += c;
5 }

And to write something, we can use the following command:

1Serial1.write("Hello world!");

Connectivity

The Nano 33 BLE Sense Rev2 supports Bluetooth® through the u-blox NINA-B306 module. To use this module, we can use the ArduinoBLE library.

 Bluetooth® module.
Bluetooth® module.

Bluetooth®

To enable Bluetooth® on the Nano 33 BLE Sense Rev2, we can use the ArduinoBLE library, and include it at the top of our sketch:

1#include <ArduinoBLE.h>

Set the service and characteristic:

1BLEService ledService("180A"); // BLE LED Service
2BLEByteCharacteristic switchCharacteristic("2A57", BLERead | BLEWrite);

Set advertised name and service:

1BLE.setLocalName("Nano 33 BLE Sense Rev2");
2 BLE.setAdvertisedService(ledService);

Start advertising:

1BLE.advertise();

Listen for Bluetooth® Low Energy peripherals to connect:

1BLEDevice central = BLE.central();

Tutorials

USB Keyboard

To use the board as a keyboard, you can refer to the USBHID library that can be found inside the core.

You first need to include the libraries and create an object:

1#include "PluggableUSBHID.h"
2#include "USBKeyboard.h"
3
4USBKeyboard Keyboard;

Then use the following command to write something:

1Keyboard.printf("This is Nano 33 speaking!");