I’m trying to obtain some measurements from the ISM330DHCX sensor using the example1_basic.ino sketch. The data ranges for the accelerometer and gyroscope are 4g and 500 dps, respectively.
Below are the values from the accelerometer and gyroscope. I’m not sure what the units of these values are.
Please post the code, using code tags. The units displayed depend on which device library you are using and whether it scales the units.
As for the accelerometer, it is trivial to deduce the units. An accelerometer held still will report 1 g (9.8 m/s/s) acceleration along a strictly vertical axis. With that information you can estimate a scale factor to SI units of measurement.
/*
example1-basic
This example shows the basic settings and functions for retrieving accelerometer
and gyroscopic data.
Please refer to the header file for more possible settings, found here:
..\SparkFun_6DoF_ISM330DHCX_Arduino_Library\src\sfe_ism330dhcx_defs.h
Written by Elias Santistevan @ SparkFun Electronics, August 2022
Product:
https://www.sparkfun.com/products/19764
Repository:
https://github.com/sparkfun/SparkFun_6DoF_ISM330DHCX_Arduino_Library
SparkFun code, firmware, and software is released under the MIT
License (http://opensource.org/licenses/MIT).
*/
#include <Wire.h>
#include "SparkFun_ISM330DHCX.h"
SparkFun_ISM330DHCX myISM;
// Structs for X,Y,Z data
sfe_ism_data_t accelData;
sfe_ism_data_t gyroData;
void setup(){
Wire.begin();
Serial.begin(115200);
if( !myISM.begin() ){
Serial.println("Did not begin.");
while(1);
}
// Reset the device to default settings. This if helpful is you're doing multiple
// uploads testing different settings.
myISM.deviceReset();
// Wait for it to finish reseting
while( !myISM.getDeviceReset() ){
delay(1);
}
Serial.println("Reset.");
Serial.println("Applying settings.");
delay(100);
myISM.setDeviceConfig();
myISM.setBlockDataUpdate();
// Set the output data rate and precision of the accelerometer
myISM.setAccelDataRate(ISM_XL_ODR_104Hz);
myISM.setAccelFullScale(ISM_4g);
// Set the output data rate and precision of the gyroscope
myISM.setGyroDataRate(ISM_GY_ODR_104Hz);
myISM.setGyroFullScale(ISM_500dps);
// Turn on the accelerometer's filter and apply settings.
myISM.setAccelFilterLP2();
myISM.setAccelSlopeFilter(ISM_LP_ODR_DIV_100);
// Turn on the gyroscope's filter and apply settings.
myISM.setGyroFilterLP1();
myISM.setGyroLP1Bandwidth(ISM_MEDIUM);
}
void loop(){
// Check if both gyroscope and accelerometer data is available.
if( myISM.checkStatus() ){
myISM.getAccel(&accelData);
myISM.getGyro(&gyroData);
Serial.print("Accelerometer: ");
Serial.print("X: ");
Serial.print(accelData.xData);
Serial.print(" ");
Serial.print("Y: ");
Serial.print(accelData.yData);
Serial.print(" ");
Serial.print("Z: ");
Serial.print(accelData.zData);
Serial.println(" ");
Serial.print("Gyroscope: ");
Serial.print("X: ");
Serial.print(gyroData.xData);
Serial.print(" ");
Serial.print("Y: ");
Serial.print(gyroData.yData);
Serial.print(" ");
Serial.print("Z: ");
Serial.print(gyroData.zData);
Serial.println(" ");
}
delay(100);
}