Nano33BLESensor: Getting Started with the Nano 33 BLE Sense © GPL3+

This project implements an Arduino Library that leverages Mbed OS and makes getting started with the Nano 33 BLE Sense simple!

  • 1,249 views
  • 2 comments
  • 8 respects

Components and supplies

About this project

The Arduino Nano 33 BLE Sense was released in July 2019 and was a real step up for Arduino! Using the Arm Cortex-M4F based nRF52840, the Nano 33 BLE’s arrival made the days of Atmel based 8-bit microcontrollers seem numbered. With more complex offerings such as the Nano 33 series, a new era of seriously cool projects may be on the horizon.

Previously in The Hacky Super Loop Arduino Nano 33 BLE Sense Example You Have Been Waiting For I attempted to address the lack of meaningful working examples for this board. The interfaces for each sensor are not always ideal, and no concrete examples are widely available that enable uses to utilise Mbed OS to gather sensor values.

The ability to use Mbed OS with Arduino is a real step up for Arduino. Finally, a reasonably performant and relatively deterministic way of arranging our more complex Arduino projects! In attempt to simplify the collection of sensor data and at the same time utilise the power of Mbed OS, Nano33BLESensor was born.

The Nano33BLESensor Library

Nano33BLESensor leverages Mbed OS to automatically place sensor measurements in a ring buffer that can be integrated into programs in a simple manner. This means Nano33BLESensor takes care of placing measurements in to the buffer “in the background”, and your program can retrieve them from the buffer at a later time when your program has time. It can be found on GitHub here. It can also be found using Arduino’s Library Manager, and available when searched for when using the Arduino IDE. Simple examples also exist to help get people started.

Nano33BLESensor Features

  • Class implementation with common interface for all of the sensors found on the Arduino Nano 33 BLE Sense (3-axis Accelerometer, 3-axis Gyroscope, 3-axis Magnetic, RMS Microphone, Barometric Pressure, Temperature, Humidity, Proximity, RGBC Colour, and Gesture).
  • Mbed OS usage, allowing easy integration with programs.
  • Ring buffer usage, allowing the softening of time constraints in regard to the reading sensor measurements.
  • Excellent examples for all sensors designed for BLE and Serial Plotter that help you to get started.

In the end, the result of this is:

  • Super simple initialisation of on board sensors.
  • No code required beyond initialisation for collection of sensor data.
  • Super simple usage of sensor data.
  • Common interface among different sensors.
  • Using Mbed OS effectively makes the reading of sensor measurements happen “in the background”, and keeps it out of the main program loop.

Nano33BLESensor Examples

The Nano33BLESensor Library comes with a series of powerful examples that include sensor measurement data output using both Serial and Bluetooth. It is possible to view this data at the same time using Arduino’s Serial Plotter and a Bluetooth packet analysis tool such as Bluetooth LE Explorer. Some of the examples available on the GitHub repository are as follows:

Below are the results of a few of those examples.

How Nano33BLESensor Simplifies Sensor Usage

Here are a couple of examples of how Nano33BLESensor simplifies the collection of sensor data with the Nano 33 BLE Sense. For the full API, you can checkout the GitHub repository.

Accelerometer

#include "Nano33BLEAccelerometer.h"
Nano33BLEAccelerometerData accelerometerData;
void setup()
{
  Accelerometer.begin()
}
void loop()
{ 
  if(Accelerometer.pop(accelerometerData))
  {
     Serial.printf("%f,%f,%f\r\n", accelerometerData.x, accelerometerData.y, accelerometerData.z);
  }
}

Colour

#include "Nano33BLEColour.h"
Nano33BLEColourData colourData;
void setup()
{
  Colour.begin()
}
void loop()
{ 
  if(Colour.pop(colourData))
  {
    Serial.printf( "%d,%d,%d,%d\r\n", colourData.r, colourData.g, colourData.b, colourData.c);
  }
}

Temperature

#include "Nano33BLETemperature.h"
Nano33BLETemperatureData temperatureData;
void setup()
{
  Temperature.begin()
}
void loop()
{ 
  if(Temperature.pop(temperatureData))
  {
    Serial.printf("%f,%f\r\n", temperatureData.temperatureCelsius, temperatureData.humidity);
  }
}

Code

Github
Nano33BLESensor is an Arduino library for the Nano 33 BLE Sense that leverages Mbed OS to automatically place sensor measurements in a ring buffer that can be integrated into programs in a simple manner. Nano33BLESensor was created to help make easy to understand examples for the Arduino Nano 33 BLE Sense that utilise Mbed OS. Download this file as a zip, and extract the resulting folder into your Arduino Libraries folder. Alternatively, use the Arduino IDE and library manager to find and install Nano33BLESensor.

Comments

Similar projects you might like

SPS30 with Nano 33 BLE Sense

Project tutorial by Guntas Singh

  • 395 views
  • 0 comments
  • 0 respects

BLE Sharp Dust Sensor - ARTIK IoT Cloud

Project tutorial by Elijah Scheele

  • 6,363 views
  • 1 comment
  • 20 respects

BluSpike - Community Driven BLE Sensor Network

Project tutorial by Team Hack.Build

  • 2,011 views
  • 1 comment
  • 6 respects

Machine Learning with Nano BLE 33 & Raspberry Pi

Project tutorial by Zoromoth

  • 1,894 views
  • 1 comment
  • 4 respects

MQTT Communication With the Nano 33 IoT & WeMos D1 Boards

Project tutorial by BnBe Club

  • 8,578 views
  • 2 comments
  • 17 respects
Add projectSign up / Login