Skip to content

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.

License

Notifications You must be signed in to change notification settings

DaleGia/Nano33BLESensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nano33BLESensor

See The Arduino Nano 33 BLE Sense Sensor Library You Have Been Waiting For.

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. For an example that does not use Mbed OS, please see nano-33-sense-serial-example

Features

  • Class implementation with common interface for the following sensor measurements
    • 3-axis Accelerometer
    • 3-axis Gyroscope
    • 3-axis Magnetic
    • RMS Microphone
    • Barometric Pressure
    • Temperature (with humidity)
    • Proximity
    • RGBC Colour
    • 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.

Why Would I Want This?

  • 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.

Installation

Download this file as a zip, and extract the resulting folder into your Arduino Libraries folder. See Installing Additional Arduino Libraries. Alternatively, use the Arduino IDE and library manager to find and install Nano33BLESensor.

Note on Usage

Nano33BLESensor can be used with both the ArduinoCore-nRF528x-mbedos and ArduinoCore-mbed cores, however the Nano33BLESensorExample_microphoneRMS.ino example only currently compiles when using the ArduinoCore-nRF528x-mbedos core.

By default the ring buffer is only size of 20. No indication of buffer overflow is available, so it is up to the user to ensure the buffer is being read reguarly enough. Each sensor is read at differing intervals that are dependant on the sensors capabilities.

Examples

  • Initialisation and starting of all sensors
#include "Nano33BLEAccelerometer.h"
#include "Nano33BLEGyroscope.h"
#include "Nano33BLEMagnetic.h"
#include "Nano33BLEProximity.h"
#include "Nano33BLEColour.h"
#include "Nano33BLEGesture.h"
#include "Nano33BLEPressure.h"
#include "Nano33BLETemperature.h"
#include "Nano33BLEMicrophoneRMS.h"

void setup()
{
  Magnetic.begin();
  Gyroscope.begin();
  Accelerometer.begin();
  Proximity.begin();
  Colour.begin();
  Gesture.begin();
  Pressure.begin();
  Temperature.begin();
  MicrophoneRMS.begin();
}
  • Get last sensor values taken from Accelerometer and print them
Nano33BLEAccelerometerData accelerometerData;

if(Accelerometer.pop(accelerometerData))
{
  //Sensor value read from buffer
}
else
{
  //Sensor value not ready (try again later)
}
  • Get all available sensor values taken from Colour sensor.
uint32_t availableColourData;
availableColourData = Colour.availableDataSize();
if(availableColourData > 0)
{
  Nano33BLEColourData colourData[availableColourData];
  Colour.popMultiple(colourData, availableColourData);
}

pop() and popMultiple() can be used in a similar manner for all other sensors.

Further Examples

3-axis Accelerometer with BLE and serial output

3-axis Gyroscope with BLE and serial output

3-axis Magnetic with BLE and serial output

IMU sensors with BLE and serial output

RMS Microphone output with BLE and serial output

Barometric pressure with BLE and serial output

Temperature and humidity with BLE and serial output

Proximity with BLE and serial output

RGBC Colour with BLE and serial output

Gesture with BLE and serial output

All sensors with serial output

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages