Arduino Nicla Sense ME

The Nicla Sense ME Hardware

The Arduino Nicla Sense ME board is physically small and comes with a 64 MHz 32-bit Arm® Cortex-M4 processor along with motion, environmental, pressure, and magnetic sensors from Bosch. Additional sensors can be easily added using the built-in SPI or I2C interfaces. The ultra-low power consumption and tiny size (less than one square inch) of the Nicla Sense ME board enables IoT developers to install complete, intelligent endpoints right at the sensing point.

This guide will go over how to setup the Arduino Nicla Sense ME firmware for data collection or recognition. Once your device is setup, you can find a tutorial on how to use the SensiML Toolkit software in the Getting Started Tutorial.

PlatformIO

Arduino firmware in this guide is flashed using the Arduino built-in flashing tools. For building the firmware, we have chosen to use PlatformIO as the main interface for building firmware for Arduino boards which can be found at https://platformio.org/. It allows the user ease of access to change and add build flags, as well as allowing for multiple build environments.

PlatformIO can be installed into your favorite editor or run from the command line. We will use Visual Studio Code in this guide, PlatformIO’s recommended editor.

Example Firmware

You can find examples of data collection or recognition firmware below.

Data Collection Firmware

Arduino Nicla Sense ME pre-built Data Collection Firmware

Sensors

Protocol

Download

Version

Accelerometer/Gyroscope (200 Hz)

Simple Stream V1.0 (BLE)

nicla-sense-me-ble-200hz-imu.hex

1.0

Accelerometer/Gyroscope (200 Hz)

Simple Stream V1.0 (USB Serial)

nicla-sense-me-serial-200hz-imu.hex

1.0

Note

We provide the binaries above for testing data collection quickly. You can build your own binaries for additional sample rates by building from source code in the SensiML GitHub at https://github.com/sensiml/nicla-sense-me-data-capture.

Knowledge Pack/Recognition Firmware

Knowledge Pack recognition firmware can be found in the SensiML GitHub at https://github.com/sensiml/nicla-sense-me-recognition/.

Flash Instructions

Follow the steps below to flash data collection firmware or recognition firmware to your device.

  1. Open the PlatformIO Home page in VS Code

../../_images/platformio-open.png
  1. Click Open Project and select the data collection or recognition source code location on your computer.

../../_images/platformio-open-project.png
  1. PlatformIO will pull down the libraries and packages needed to build, this may take several minutes the first time building. Your project will now appear in the PlatformIO Project Tasks menu.

../../_images/platformio-project1.png
  1. Click Upload in your selected project environment to build the firmware. Make sure your device is plugged in via a USB port.

../../_images/platformio-upload1.png
  1. PlatformIO will automatically detect the proper COM port (Windows) or /dev/ port (Linux) and upload to your device. You can see the status in the Terminal Window.

../../_images/platformio-terminal1.png

Using TensorFlow Lite for Microcontrollers in a Knowledge Pack

When running a model built using TensorFlow Lite, another environment is provided in the Knowledge Pack code base. The environment env:nicla_sense_me_tensorflow will automatically link this in with the same code base.

Changing IMU Frequency/Sample Rate

The frequency/sample rate that IMU data collection firmware outputs is set at compile-time.

  1. Open include/sensor_stream.h.

  2. Update #define ODR_IMU to set the frequency. Note: The supported frequencies are 25, 50, 100, 200, and 400 Hz.

Adding New Sensors to the Data Capture Lab

The Data Capture Lab includes a built-in device plugin for the Nicla Sense ME IMU sensors. You can add additional sensors to your board and use them for data collection in the Data Capture Lab by creating a custom device plugin. You can create a device plugin by defining your sensor information in an SSF file and importing it to the Data Capture Lab. We provide an example SSF file for your device plugin named nicla-sense-me.ssf in the SensiML GitHub repository at https://github.com/sensiml/nicla-sense-me-data-capture/.

For more details on defining SSF file properties and implementing the Simple Streaming specification in your firmware see the Adding Custom Device Firmware Documentation.

More Information

More information can be found on the Arduino documentation site for the Nicla Sense ME: https://docs.arduino.cc/hardware/nicla-sense-me