Go Down

Topic: No data from "9 axis motion shield" (Read 568 times) previous topic - next topic

aahr

I recently bought a new Arduino and a "9 axis motion shield". I connected them, downloaded the library from https://github.com/arduino-org/arduino-library-nine-axes-motion and tried one of the test programmes. However, I do not get any data from them. All sensors report back a "0".

For example:
The output from the Euler example code is:

Time: 3296ms H: 0.00deg R: 0.00deg P: 0.00deg A: 0 M: 0 G: 0 S: 0

Time: 3316ms H: 0.00deg R: 0.00deg P: 0.00deg A: 0 M: 0 G: 0 S: 0

Time: 3336ms H: 0.00deg R: 0.00deg P: 0.00deg A: 0 M: 0 G: 0 S: 0

Any idea what the problem could be? Broken shield?

Miniflyer

Can you post more information on what Arduino you are using, what sensor you are using, how you have wired them, how the calibration routine runs....? Without these infos i doubt you will get any usable information.

jremington

Probably a communications failure. Post a link to the sensor.

Idahowalker

So you have a BNO055 and the library reports no thingies. If you connected the device using I2C was the device identified?

Your actual code, formatted and posted in code tags, would be a big help. Along with an image of your device and its connections and a schematic, not FritzNuts, of some sort.
I won't do your homework, don't ask.

Miniflyer

If its a BNO055 you can go on youtube and look at PaulMcWhorters IMU tutorial. Hes currently on lesson 13, but lesson 1-4 cover IMU basics and an entire lesson just on setting everything up and getting data from specifically the BNO055.
I believe that will get you set up quickly.

aahr

Thanks for all your replies! Maybe I am missing something very basic...

I am using an Arduino Uno and an official Arduino 9 axis motion shield (https://store.arduino.cc/9-axis-motion-shield) which is in fact based on the BNO055.

Since this is a shield, there is no wiring.

When I just pull off the shield while observing the serial monitor, I get the exact same output.

Regarding calibration, I could not find any information on how to do that with the shield.

The code is an example from the library which I got here https://github.com/arduino-org/arduino-library-nine-axes-motion

Code: [Select]

#include "NineAxesMotion.h"        //Contains the bridge code between the API and the Arduino Environment
#include <Wire.h>

NineAxesMotion mySensor;         //Object that for the sensor
unsigned long lastStreamTime = 0;     //To store the last streamed time stamp
const int streamPeriod = 20;          //To stream at 50Hz without using additional timers (time period(ms) =1000/frequency(Hz))

void setup() //This code is executed once
{
 //Peripheral Initialization
 Serial.begin(115200);           //Initialize the Serial Port to view information on the Serial Monitor
 I2C.begin();                    //Initialize I2C communication to the let the library communicate with the sensor.
 //Sensor Initialization
 mySensor.initSensor();          //The I2C Address can be changed here inside this function in the library
 mySensor.setOperationMode(OPERATION_MODE_NDOF);   //Can be configured to other operation modes as desired
 mySensor.setUpdateMode(MANUAL); //The default is AUTO. Changing to MANUAL requires calling the relevant update functions prior to calling the read functions
 //Setting to MANUAL requires fewer reads to the sensor
}

void loop() //This code is looped forever
{
 if ((millis() - lastStreamTime) >= streamPeriod)
 {
   lastStreamTime = millis();
   mySensor.updateEuler();        //Update the Euler data into the structure of the object
   mySensor.updateCalibStatus();  //Update the Calibration Status

   Serial.print("Time: ");
   Serial.print(lastStreamTime);
   Serial.print("ms ");

   Serial.print(" H: ");
   Serial.print(mySensor.readEulerHeading()); //Heading data
   Serial.print("deg ");

   Serial.print(" R: ");
   Serial.print(mySensor.readEulerRoll()); //Roll data
   Serial.print("deg");

   Serial.print(" P: ");
   Serial.print(mySensor.readEulerPitch()); //Pitch data
   Serial.print("deg ");

   Serial.print(" A: ");
   Serial.print(mySensor.readAccelCalibStatus());  //Accelerometer Calibration Status (0 - 3)

   Serial.print(" M: ");
   Serial.print(mySensor.readMagCalibStatus());    //Magnetometer Calibration Status (0 - 3)

   Serial.print(" G: ");
   Serial.print(mySensor.readGyroCalibStatus());   //Gyroscope Calibration Status (0 - 3)

   Serial.print(" S: ");
   Serial.print(mySensor.readSystemCalibStatus());   //System Calibration Status (0 - 3)

   Serial.println();
 }
}

Miniflyer

I suspect you have a communication problem.
(Even with a breakout board, using i2c you need 4 cables....so there is a wiring. SDA, SCL, Gnd and VCC)

2 steps:
1.)run an i2c scanner with the sensor attached. See if it spits out an adress. If it does you can check in the library if the correct adress is called. If it doesnt then you either wired wrong or you grabbed a bad sensor...

2.) Try the bno library that paul mcwhorter shows. It includes an example that first checks the sensor and its outputs.


aahr

I found the solution to the problem. The library on github was coded for an older version of the shield. The github user "trullock" fixed the issue. You can find his solution in his repository: https://github.com/trullock/arduino-library-nine-axes-motion

Thank you everybody for your effort!

Go Up