Skip to main content

Arduino Nano 33 Sense Rev2

What is theArduino IMUNano sensor?

33

IMUSense stands for: inertial measurement unit. It is an electronic device that measures and reports a body's specific force, angular rate and the orientation of the body, using a combination of accelerometers, gyroscopes, and oftentimes magnetometers. Know more.

LibraryRev2?

The IMU system on the Arduino Nano 33 BLE Sense Rev2 (often called Nano 33 Sense Rev2) is a combinationcompact, oflow-power twoIoT modules,and sensor-rich development board designed for machine learning, audio processing, motion detection, and environmental sensing.

It’s the 6-axissuccessor BMI270, andto the 3-axisoriginal BMM15.

To use the IMU (inertial measurement unit) in Nano 33 BLE Rev2Sense, improving performance, accuracy, and sensor reliability. Know more.

<ins class="diffmod">Rev1 vs Rev2 — Short Comparison</ins>

Rev1 vs Rev2

ComponentRev1Rev2
IMULSM9DS1 (9-axis)BMI270 (6-axis) + BMM150 (3-axis)
Temp & Humidity SensorHTS221HS3003
MicrophoneMP34DT05MP34DT06JTR
Power RegulatorMPM3610MP2322
VUSB JumperNoYes
USB / SWD Test PointsNoYes

Install board packages

  1. Go to Tools - Board - Board Management
  2. Search for Arduino Mbed OS Nano BoardsMbedOSNano.png
  3. Choose and install the latest version
  4. It may take a few minutes.
  5. When it's done, you should be able to choose Arduino Nano 33 BLEnano33BLE.png
  6. Sense
Rev2, you<ins class="diffmod">Library</ins> <del class="diffmod">need</del><ins class="diffmod">Update</ins>

Library Changes from Rev1 to useRev2

theArduino_BMI270_BMM150libraryofwhich is used in all example code.

Replace #include <Arduino_LSM9DS1.h> with #include <Arduino_BMI270_BMM150.h> in all existing codes if you are using

For

moreinformationlibrariesforNANO33SENSE REV2, please visit here.

Getting started - Accelerometers

To

detectrotationsandspeed.

#include "Arduino_BMI270_BMM150.h"

float x, y, z;
int degreesX = 0;
int degreesY = 0;

void setup() {
  Serial.begin(9600);
  while
Serial.println("Started"); ifto initialize IMU!"); whilesamplerate
Sensor insteadType Rev1 Arduino_LSM9DS1Library Rev2 boards.

Library
IMU about(9-axis) LSM9DS1 Arduino_BMI270_BMM150
Temperature & GyroscopesHumidity Arduino_HTS221 Arduino_HS300x
Microphone (!Serial);PDM) MP34DT05 (!IMU.begin())generic {PDM Serial.println("Failedlibrary) MP34DT06JTR (1);same }PDM Serial.print("Accelerometerinterface)
= "); Serial.print(IMU.accelerationSampleRate()); Serial.println(" Hz"); } void loop() { float x, y, z; if (IMU.accelerationAvailable()) { IMU.readAcceleration(x, y, z); if(x > 0.1){ x = 100*x; degreesX = map(x, 0, 97, 0, 90); Serial.print("Tilting up "); Serial.print(degreesX); Serial.println(" degrees"); } if(x < -0.1){ x = 100*x; degreesX = map(x, 0, -100, 0, 90); Serial.print("Tilting down "); Serial.print(degreesX); Serial.println(" degrees"); } if(y > 0.1){ y = 100*y; degreesY = map(y, 0, 97, 0, 90); Serial.print("Tilting left "); Serial.print(degreesY); Serial.println(" degrees"); } if(y < -0.1){ y = 100*y; degreesY = map(y, 0, -100, 0, 90); Serial.print("Tilting right "); Serial.print(degreesY); Serial.println(" degrees"); } } }

Getting started - Magnetometer

To detect magnetic fields.

#include "Arduino_BMI270_BMM150.h"
float x,y,z, ledvalue;

void setup() {
  if (!IMU.begin()) {
    Serial.println("Failed to initialize IMU!");
    while (1);
  }
}

void loop() {
  
  // read magnetic field in all three directions
  IMU.readMagneticField(x, y, z);
  
  if(x < 0)
  {
    ledvalue = -(x);
  }
  else{
    ledvalue = x;
  }
  
  analogWrite(LED_BUILTIN, ledvalue);
  delay(500);
}