Arduino Forum

Products => Nano Boards (NEW types) => Nano 33 BLE Sense => Topic started by: Birkedahl on Aug 11, 2019, 08:08 am

Title: Sketch for reading the accelerometer values on Nano 33 BLE doesn't work
Post by: Birkedahl on Aug 11, 2019, 08:08 am
I loaded the SimpleAccelerometer.ino sketch (code below) from GitHub onto my nano 33 BLE but the serial monitor says " Failed to Initialize IMU!" which indicates the IMU isn't set up. 

Has anybody got this working on the nano 33 BLE/ Sense?  What am I missing?

Thanks!   

/*
  Arduino LSM9DS1 - Simple Accelerometer
  This example reads the acceleration values from the LSM9DS1
  sensor and continuously prints them to the Serial Monitor
  or Serial Plotter.
  The circuit:
  - Arduino Nano 33 BLE Sense
  created 10 Jul 2019
  by Riccardo Rizzo
  This example code is in the public domain.
*/

#include <Arduino_LSM9DS1.h>

void setup() {
  Serial.begin(9600);
  while (!Serial);
  Serial.println("Started");

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

  Serial.print("Accelerometer sample rate = ");
  Serial.print(IMU.accelerationSampleRate());
  Serial.println(" Hz");
  Serial.println();
  Serial.println("Acceleration in G's");
  Serial.println("X\tY\tZ");
}

void loop() {
  float x, y, z;

  if (IMU.accelerationAvailable()) {
    IMU.readAcceleration(x, y, z);

    Serial.print(x);
    Serial.print('\t');
    Serial.print(y);
    Serial.print('\t');
    Serial.println(z);
  }
}
Title: Re: Sketch for reading the accelerometer values on Nano 33 BLE doesn't work
Post by: gbafamily on Aug 11, 2019, 10:11 pm
Open the IDE library manager and search for "nano 33 ble". Install the desired libraries and see if this helps.

If you have connected anything to the Nano BLE pins, disconnect then try the example again.
Title: Re: Sketch for reading the accelerometer values on Nano 33 BLE doesn't work
Post by: Birkedahl on Aug 12, 2019, 07:21 am
Thanks but all libraries installed and nothing is connected to the pins...
Title: Re: Sketch for reading the accelerometer values on Nano 33 BLE doesn't work
Post by: gbafamily on Aug 12, 2019, 09:09 pm
The example included with the library works fine for me.
Title: Re: Sketch for reading the accelerometer values on Nano 33 BLE doesn't work
Post by: Jacks-Pixels on Aug 14, 2019, 11:11 am
Same for me ... it works fine.
Look at Nano 33 BLE to find the specifics libs.
Title: Re: Sketch for reading the accelerometer values on Nano 33 BLE doesn't work
Post by: Birkedahl on Aug 17, 2019, 05:56 pm
So I have all libraries tagged with "nano 33 BLE" installed.  The SimpleAccelerometer sketch uploads and runs - but gives the "IMU Failed to Initialize!" message on the serial monitor.  Perhaps the board is bad? 

Also:  I have the nano 33 BLE (not Sense) board, but the sketch comments indicate it was created for the nano 33 BLE Sense.  I assumed the sketch would work for both models...
 
Title: Re: Sketch for reading the accelerometer values on Nano 33 BLE doesn't work
Post by: msdsmith on Aug 22, 2019, 10:09 pm
I have the nano 33 BLE (not Sense) board, but the sketch comments indicate it was created for the nano 33 BLE Sense.  I assumed the sketch would work for both models...
 
That sketch worked for me without modification on a nano 33 BLE. Perhaps it is an issue with your board?

Have you tried uploading any other sketches?
Title: Re: Sketch for reading the accelerometer values on Nano 33 BLE doesn't work
Post by: Birkedahl on Aug 28, 2019, 08:11 am
The "Arduino people" had me run the sketch MultiSpeedI2CScanner.ino which shows the board is not reading I2C devices correctly..  So conclusion is a bad board - return it for replacement..
Title: Re: Sketch for reading the accelerometer values on Nano 33 BLE doesn't work
Post by: pert on Aug 28, 2019, 01:28 pm
Thanks for taking the time to post an update with the results of the investigation Birkedahl!