Nano 33 BLE Sense Cheat Sheet
Learn how to set up the Nano 33 BLE Sense, 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.
This article is a collection of guides, API calls, libraries and tutorials that can help you get started with the Nano 33 BLE Sense board.
You can also visit the documentation platform for the Nano 33 BLE Sense.
Board Package
The Nano 33 BLE Sense uses the Arduino Mbed OS Nano Board Package.
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 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
The Nano 33 BLE Sense can be programmed through the Arduino IDE 2. To install your board, you can check out the guide below:
Web Editor
The Nano 33 BLE Sense 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:
MicroPython
This board is supported by MicroPython. Visit the MicroPython documentation for getting started with installation and usage.
Using OpenMV IDE
If you want to use your board with MicroPython and OpenMV. Follow 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
Analog Pins
The Nano 33 BLE Sense has 8 analog pins, that can be used through the
analogRead()
function.1value = analogRead(pin, value);
Please note: pin
and A4
should be used for I2C only.A5
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 input2pinMode(pin, OUTPUT); //configured as an output3pinMode(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 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.
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 through the USB port. 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.
IMU
LSM9DS1
The LSM9DS1 inertial measurement unit features a 3D accelerometer, gyroscope and magnetometer and allows you to detect orientation, motion or vibrations in your project.
LSM9DS1 Library
To access the data from the LSM9DS1 module, we need to install the LSM9DS1 library, which comes with examples that can be used directly with the Nano 33 BLE Sense.
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_LSM9DS1.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:
- Accessing IMU gyroscope data with Nano 33 BLE Sense
- Accessing IMU accelerometer data with Nano 33 BLE Sense
- Accessing IMU magnetometer data with Nano 33 BLE Sense
Proximity and Gesture Detection
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.
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
HTS221
The HTS221 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.
HTS221 Library
To access the data from the HTS221 module, we need to install the HTS221 library, which comes with examples that can be used directly with the Nano 33 BLE Sense.
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_HTS221.h>
And to initialize the library, we can use the following command inside
void setup()
.1if (!HTS.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(HTS.readTemperature());2Serial.println(HTS.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
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.
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
MP34DT05
The MP34DT05 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 MP34DT05, we need to use the PDM library that is included in the Arduino Mbed OS Nano Boards Package. If the Board Package 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); //RED2digitalWrite(LEDG, HIGH); //GREEN3digitalWrite(LEDB, HIGH); //BLUE
To turn OFF the pixels, write a
LOW
state to the LED:1digitalWrite(LEDR, LOW); //RED2digitalWrite(LEDG, LOW); //GREEN3digitalWrite(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 features dedicated pins for different protocols.
SPI
The pins used for SPI (Serial Peripheral Interface) on the Nano 33 BLE Sense 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 pin2 3 SPI.transfer(address); // address for device, for example 0x004 SPI.transfer(value); // value to write5
6 digitalWrite(chipSelectPin, HIGH); // pull up the CS pin
I2C
The pins used for I2C (Inter-Integrated Circuit) on the Nano 33 BLE Sense 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 12 Wire.write(byte(0x00)); //send instruction byte 3 Wire.write(val); //send a value4 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 supports Bluetooth® through the u-blox NINA-B306 module. To use this module, we can use the ArduinoBLE library.
Bluetooth®
To enable Bluetooth® on the Nano 33 BLE Sense, 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 Service2BLEByteCharacteristic switchCharacteristic("2A57", BLERead | BLEWrite);
Set advertised name and service:
1BLE.setLocalName("Nano 33 BLE Sense");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 Board Package.
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!");
Suggest changes
The content on docs.arduino.cc is facilitated through a public GitHub repository. If you see anything wrong, you can edit this page here.
License
The Arduino documentation is licensed under the Creative Commons Attribution-Share Alike 4.0 license.