/*
Data processing example
This example shows how to process raw readings from the sensors to get acceleration in m/s^2,
angular velocity in dps (degrees per second) and magnetic flux density in T (Tesla).
*/
#include <MPU9255.h>// include MPU9255 library
MPU9255 mpu;
//process raw gyroscope data
//input = raw reading from the sensor, sensor_scale = selected sensor scale
//returns : angular velocity in degrees per second
double process_angular_velocity(int16_t input, scales sensor_scale )
{
/*
To get rotation velocity in dps (degrees per second), each reading has to be divided by :
-> 131 for +- 250 dps scale (default value)
-> 65.5 for +- 500 dps scale
-> 32.8 for +- 1000 dps scale
-> 16.4 for +- 2000 dps scale
*/
//for +- 250 dps
if(sensor_scale == scale_250dps)
{
return input/131;
}
//for +- 500 dps
if(sensor_scale == scale_500dps)
{
return input/65.5;
}
//for +- 1000 dps
if(sensor_scale == scale_1000dps)
{
return input/32.8;
}
//for +- 2000 dps
if(sensor_scale == scale_2000dps)
{
return input/16.4;
}
return 0;
}
void setup() {
Serial.begin(115200);// initialize Serial port
if(mpu.init())
{
Serial.println("initialization failed");
}
else
{
Serial.println("initialization successful!");
}
}
void loop() {
//take readings
mpu.read_gyro();
////process and print gyroscope data////
//X axis
Serial.print(" GX: ");
Serial.print(process_angular_velocity(mpu.gx,scale_250dps));
//Y axis
Serial.print(" GY: ");
Serial.print(process_angular_velocity(mpu.gy,scale_250dps));
//Z axis
Serial.print(" GZ: ");
Serial.print(process_angular_velocity(mpu.gz,scale_250dps));
Serial.println();
}
How do I mesure the current angle by the DPS? Do I collect all the DPS values in an array and take the avrage? Or some different connection between the current angle and DPS?
The magnetometer doesnt work for some reason I belive. But I twisted it in the middle witch you can see here. But f I twist it and stop at 30 degrees the DPS will be 0 and the degree will be 0 right?
A rate gyro is a type of gyroscope, which rather than indicating direction, indicates the rate of change of angle with time. If a gyro has only one gimbal ring, with consequently only one plane of freedom, it can be adapted for use as a rate gyro to measure a rate of angular movement.
Yes I have. I can only find information about the MPU9250, but theres nothing with the MPU9255. On my module it is labeled MPU 9250 / 6050 but my research on the internet says that it is a MPU9250 for that reason.