How to store Calibration Profile in Arduino 9-Axis Shield

BNO055 Reuse of Calibration Profile in Arduino 9-Axis Shield
My work is now going with this 9axesmotion shield, Arduino Uno minima R4.
The basic problem is calibration, which I don't want to calibration every time of power on. the question is, the link above proposes quite look good. But I don't know the clearly step of doing/following.
Can someone else explain more how to store the calibration offset and read the offset from itself?

That is not to hard, save it in variables, or a array. That can be in EEPROM if available or I use FRAM, both will remember when the power fails. FRAM will survive thousands of times more write - read cycles then the EEPROM will. EEPROM wears on write FRAM wears on reads.

Before purchasing parts etc get a copy of the Arduino Cookbook, it has a great section on EEPROM, the FRAM works about the same but does not need delays or processing in sections.

Hi gilshultz,
Thank you for your replying. I feel relief that sound not more step to finish. I am now a bit lost, because it can not seen where I can get the Reading Calibration Profile.
From the datasheet of BNO055


on first step. >[]<)/

in the link you provided, @ispybadguys seems to provide functions to read the calibration data.

Hi Jackson,
yes, you are right. The provided code in Cpp and h file, i can understand. The point that I lost is the third part of code.... I do not know where to use(program).

what do you call the third part?

can you already write a code that reads the calibration values and print them out to the serial monitor?

Post#3 of ispybadguys

Blockquote
Functions that read and writes the Cal Registers using my new class functions is:

struct bno055_mag_offset_t    mag_offset ={-53,209,-523,836};                                              // Offset and Radius Values
/* s_16 x; < Mag offset x data
   s_16 y; < Mag offset y data
   s_16 z; < Mag offset z data
   s_16 r; < Mag radius x data */
struct bno055_accel_offset_t  accel_offset ={-24,2,7,1000};                                                 // Offset and Radius Values
/* s_16 x; < Accel offset x data
   s_16 y; < Accel offset y data
   s_16 z; < Accel offset z data
   s_16 r; < Accel radius x data */
struct bno055_gyro_offset_t   gyro_offset ={-1,-4,-1};                                                      // Offset Values
/* s_16 x; < Gyro offset x data
   s_16 y; < Gyro offset y data
   s_16 z; < Gyro offset z data  */
/* @return results of bus communication function
   @retval 0 . Success
   @retval 1 . Error */
   // 4/3/17 ReadBNO055Calibration: readmag_offset 0 { -44,204,-515,811} readgyro_offset 0 { -1,-4,-2} readaccel_offset 0 { -21,1,11,1000} 

/**********************************************************************************************************************************************************/
void ReadBNO055Calibration() //This code is executed once
/**********************************************************************************************************************************************************/
{
  BNO055_RETURN_FUNCTION_TYPE readmag_offset   = 1;
  BNO055_RETURN_FUNCTION_TYPE readaccel_offset = 1;
  BNO055_RETURN_FUNCTION_TYPE readgyro_offset  = 1;

  mag_offset.x = 0;
  mag_offset.y = 0;
  mag_offset.z = 0;
  mag_offset.r = 0;

  accel_offset.x = 0;
  accel_offset.y = 0;
  accel_offset.z = 0;
  accel_offset.r = 0;
 
  gyro_offset.x = 0;
  gyro_offset.y = 0;
  gyro_offset.z = 0;
  
  //if(mySensor.readSystemCalibStatus() < 3) return;                                                 // Wait till claibrated

 
  mySensor.setOperationMode(OPERATION_MODE_CONFIG);                                                  // Set CONFIG Mode


  readmag_offset   = mySensor.read_mag_offset(&mag_offset);                                             // Read Offset and Radius

  Console.print(F(" mag ")); Console.print(readmag_offset); 
  Console.print(" {");
  Console.print(mag_offset.x); Console.print(","); 
  Console.print(mag_offset.y); Console.print(","); 
  Console.print(mag_offset.z); Console.print(","); 
  Console.print(mag_offset.r);
  Console.print("} ");
  Console.flush();
  
  readgyro_offset  = mySensor.read_gyro_offset(&gyro_offset);                                         // Read Offset

  Console.print(F("gyro ")); Console.print(readgyro_offset); 
  Console.print(" {");
  Console.print(gyro_offset.x); Console.print(",");
  Console.print(gyro_offset.y); Console.print(",");
  Console.print(gyro_offset.z);
  Console.print("} ");

  readaccel_offset = mySensor.read_accel_offset(&accel_offset);                                        // Read Offset and Radius

  Console.print(F("accel ")); Console.print(readaccel_offset);
  Console.print(" {");
  Console.print(accel_offset.x); Console.print(",");
  Console.print(accel_offset.y); Console.print(",");
  Console.print(accel_offset.z); Console.print(",");
  Console.print(accel_offset.r);
  Console.println("} ");

  mySensor.setOperationMode(BNO055_OPERATING_MODE);                                                // Can be configured to other operation modes as desired mode is 9 Degrees of Freedom Sensor Fusion with fast magcal



}

/**********************************************************************************************************************************************************/
void WriteBNO055Calibration() //This code is executed once
/**********************************************************************************************************************************************************/
{


// Sensor Initialization 4/4/17 ReadBNO055Calibration: readmag_offset 0 { -83,152,152,868} readgyro_offset 0 { -1,-4,-1} readaccel_offset 0 { -25,2,9,1000} 
// WiFi= 35  KBs _2017.03.23.06.57-MEGA_BNO-055  @ 4/5/2017 15:00:13  = 41861  El=ENA Az=ENA S3 G3 A1 M3 EL-Off Az-Off Az 242.95 El 54.50 C 321.15 R -0.00 N 1471 W 5.29 mag 0 {-53,209,-523,836} gyro 0 {-1,-4,-1} accel 0 {-24,2,7,1000} 
// WiFi= 52  KBs _2017.03.23.06.57-MEGA_BNO-055  @ 4/5/2017 15:44:24  = 41982  El=ENA Az=ENA S0 G3 A1 M3 EL-Off Az-Off Az 49.71 El 137.94 C 49.71 R 131.25 N 137 W 5.62 mag 0 {-40,268,-452,832} gyro 0 {-1,-3,0} accel 0 {-23,2,6,1000} 

struct bno055_mag_offset_t    saved_mag_offset ={-53,209,-523,836};                               // Offset and Radius Values
struct bno055_accel_offset_t  saved_accel_offset ={-24,2,7,1000};                                 // Offset and Radius Values
struct bno055_gyro_offset_t   saved_gyro_offset ={-1,-4,-1};                                      // Offset Values


  mySensor.setOperationMode(OPERATION_MODE_CONFIG);                                               // Set CONFIG Mode

  mySensor.write_mag_offset(&saved_mag_offset);
  mySensor.write_accel_offset(&saved_accel_offset);
  mySensor.write_gyro_offset(&saved_gyro_offset);

  mySensor.setOperationMode(BNO055_OPERATING_MODE);                                              // Can be configured to other operation modes as desired mode is 9 Degrees of Freedom Sensor Fusion with fast magcal

}

so you have the code to read the configuration and write them

what's your issue? writing to EEPROM?

I am not so sure how it must be, I guessed I can use above code in ARDUINO IDE. When I tried, it showed error. That made me wonder where else the code need to be utilized. either another c file of BNO055 or somewhere new.

Moreover, these error happen after I run example code from Arduino_NineAxesMotion.h>Accelerometer.ino

In file included from C:\Users\Tisun\AppData\Local\Temp.arduinoIDE-unsaved2024322-13928-8khmse.86y5j\Accelerometer\Accelerometer.ino:47:0:
C:\Users\Tisun\Documents\Arduino\libraries\Arduino_NineAxesMotion\src/Arduino_NineAxesMotion.h:767:9: error: extra qualification 'NineAxesMotion::' on member 'read_mag_offset' [-fpermissive]
int8_t NineAxesMotion::read_mag_offset(struct bno055_mag_offset_t *mag_offset);
^~~~~~~~~~~~~~
C:\Users\Tisun\Documents\Arduino\libraries\Arduino_NineAxesMotion\src/Arduino_NineAxesMotion.h:775:9: error: extra qualification 'NineAxesMotion::' on member 'read_gyro_offset' [-fpermissive]
int8_t NineAxesMotion::read_gyro_offset(struct bno055_gyro_offset_t *gyro_offset);
^~~~~~~~~~~~~~
C:\Users\Tisun\Documents\Arduino\libraries\Arduino_NineAxesMotion\src/Arduino_NineAxesMotion.h:784:9: error: extra qualification 'NineAxesMotion::' on member 'read_accel_offset' [-fpermissive]
int8_t NineAxesMotion::read_accel_offset(struct bno055_accel_offset_t *accel_offset);
^~~~~~~~~~~~~~
C:\Users\Tisun\Documents\Arduino\libraries\Arduino_NineAxesMotion\src/Arduino_NineAxesMotion.h:793:9: error: extra qualification 'NineAxesMotion::' on member 'write_mag_offset' [-fpermissive]
int8_t NineAxesMotion::write_mag_offset(struct bno055_mag_offset_t *mag_offset);
^~~~~~~~~~~~~~
C:\Users\Tisun\Documents\Arduino\libraries\Arduino_NineAxesMotion\src/Arduino_NineAxesMotion.h:801:9: error: extra qualification 'NineAxesMotion::' on member 'write_gyro_offset' [-fpermissive]
int8_t NineAxesMotion::write_gyro_offset(struct bno055_gyro_offset_t *gyro_offset);
^~~~~~~~~~~~~~
C:\Users\Tisun\Documents\Arduino\libraries\Arduino_NineAxesMotion\src/Arduino_NineAxesMotion.h:810:9: error: extra qualification 'NineAxesMotion::' on member 'write_accel_offset' [-fpermissive]
int8_t NineAxesMotion::write_accel_offset(struct bno055_accel_offset_t *accel_offset);
^~~~~~~~~~~~~~

exit status 1

Compilation error: exit status 1

did you modify the Bosch library as suggested in the other thread?

Hi Jackson,
Thank you for your replying. I hope that you can kindly explain me more, because I have no clue how it must be.
From you message, I reckon that either Documents\Arduino\libraries\Arduino_NineAxesMotion\src\utility\BNO055.cpp OR \BNO055.h need to be modified. with some code from ispybadguys

I've not done it but see this post

@ispybadguys explains he added stuff in two files : NAxisMotion.h and NAxisMotion.cpp

These two files(Arduino_NineAxesMotion.cpp and Arduino_NineAxesMotion.h) are modified already, that affects above error around the added lines.

post a sample code using the modified library's features. start small to understand how to use it

Right now, I made a big mistake. the sensor cannot read any data anymore. It freezed at started point of data.....

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.