Hello Everyone.
Gy-955 and BNO055 have the same German IC but different modules. When we connect GND, S1 and SR pins together for Gy-955 module, we can communicate with BNO055 directly, through I2C connection. Here I will represent my Code to run Gy-955 (BNO055) by Arduino IDE, 3 times FASTER than BNO055.h library (because of better I2C Message structure):
// Connect GND, S1 and SR pins together.
#include <Wire.h>
float Yaw,Roll,Pitch,magx,magy,magz,accx, accy,accz, gyrox,gyroy,gyroz,q0,q1,q2,q3,Roll2,Pitch2,Yaw2,LIAx,LIAy,LIAz,GRVx,GRVy,GRVz;
const int GY_955=0x29;
void setup()
{
Wire.begin();
Wire.setClock(400000); // I2C clock rate ,You can delete it but it helps the speed of I2C (default rate is 100000 Hz)
delay(100);
Wire.beginTransmission(GY_955);
Wire.write(0x3E); // Power Mode
Wire.write(0x00); // Normal:0X00 (or B00), Low Power: 0X01 (or B01) , Suspend Mode: 0X02 (orB10)
Wire.endTransmission();
delay(100);
Wire.beginTransmission(GY_955);
Wire.write(0x3D); // Operation Mode
Wire.write(0x0C); //NDOF:0X0C (or B1100) , IMU:0x08 (or B1000) , NDOF_FMC_OFF: 0x0B (or B1011)
Wire.endTransmission();
delay(100);
Serial.begin(115200); //Setting the baudrate
delay(100);
}
void loop()
{
Wire.beginTransmission(GY_955);
Wire.write(0x08);
Wire.endTransmission(false);
Wire.requestFrom(GY_955,32,true);
// Accelerometer
accx=(int16_t)(Wire.read()|Wire.read()<<8 )/100.00; // m/s^2
accy=(int16_t)(Wire.read()|Wire.read()<<8 )/100.00; // m/s^2
accz=(int16_t)(Wire.read()|Wire.read()<<8 )/100.00; // m/s^2
// Magnetometer
magx=(int16_t)(Wire.read()|Wire.read()<<8 )/16.00; // mT
magy=(int16_t)(Wire.read()|Wire.read()<<8 )/16.00; // mT
magz=(int16_t)(Wire.read()|Wire.read()<<8 )/16.00; // mT
// Gyroscope
gyrox=(int16_t)(Wire.read()|Wire.read()<<8 )/16.00; // Dps
gyroy=(int16_t)(Wire.read()|Wire.read()<<8 )/16.00; // Dps
gyroz=(int16_t)(Wire.read()|Wire.read()<<8 )/16.00; // Dps
// Euler Angles
Yaw=(int16_t)(Wire.read()|Wire.read()<<8 )/16.00; //in Degrees unit
Roll=(int16_t)(Wire.read()|Wire.read()<<8 )/16.00; //in Degrees unit
Pitch=(int16_t)(Wire.read()|Wire.read()<<8 )/16.00; //in Degrees unit
// Quaternions
q0=(int16_t)(Wire.read()|Wire.read()<<8 )/(pow(2,14)); //unit less
q1=(int16_t)(Wire.read()|Wire.read()<<8 )/(pow(2,14)); //unit less
q2=(int16_t)(Wire.read()|Wire.read()<<8 )/(pow(2,14)); //unit less
q3=(int16_t)(Wire.read()|Wire.read()<<8 )/(pow(2,14)); //unit less
//Convert Quaternions to Euler Angles
Yaw2=(atan2(2*(q0*q3+q1*q2),1-2*(pow(q2,2)+pow(q3,2))))*180/PI;
Roll2=(asin(2*(q0*q2-q3*q1)))*180/PI;
Pitch2=(atan2(2*(q0*q1+q2*q3),1-2*(pow(q1,2)+pow(q2,2))))*180/PI;
//Linear (Dynamic) & Gravitational (static) Acceleration
Wire.beginTransmission(0x29);
Wire.write(0x28);
Wire.endTransmission(false);
Wire.requestFrom(0x29,12,true);
LIAx=(int16_t)(Wire.read()|Wire.read()<<8)/100.00; // m/s^2
LIAy=(int16_t)(Wire.read()|Wire.read()<<8)/100.00; // m/s^2
LIAz=(int16_t)(Wire.read()|Wire.read()<<8)/100.00; // m/s^2
GRVx=(int16_t)(Wire.read()|Wire.read()<<8)/100.00; // m/s^2
GRVy=(int16_t)(Wire.read()|Wire.read()<<8)/100.00; // m/s^2
GRVz=(int16_t)(Wire.read()|Wire.read()<<8)/100.00; // m/s^2
// Print data
Serial.print("Yaw=");
Serial.print(Yaw);
Serial.print(" Roll=");
Serial.print(Roll);
Serial.print(" Pitch=");
Serial.println(Pitch);
}
NOTE: Powerup this sensor, toward the north to prevent Yaw error or drift (As I showed in the attached picture).
NOTE: Yaw, Roll and Pitch are more reliable than Yaw2, Roll2 and Pitch2.
Enjoy it!!! It is very stable and exact (0.01 degree exactness) and it can differ Linear (Dynamic) Acceleration & Gravitational (static) Acceleration.
Also you can run Gy-955 by Bosch library (BNO055.h) as below but it is at least 3 times slower.
1. Connect GND, S1 and SR pins together.
2. Open IDE>> sketch >> including library >> manage library, in the Library Manager window, in the search blank type BNO055, after that click install for "BNO055 by ROBERT BOSCH GMBH" library.
3. Install Notepad++ on your pc.
4. File explorer>> Documents >> Arduino >> libraries>> BNO055 >> BNO055.h (open it with Notepad++), go to line 84, and change "#define BNO055_I2C_ADDR BNO055_I2C_ADDR1" to "#define BNO055_I2C_ADDR BNO055_I2C_ADDR2" and save it.
5. Open IDE>> File >> Examples >> INCOMPATIBLE >> BNO055>> Euler_Streaming (will report roll, pitch and yaw degrees)
Also you can Run GY-955 through Serial connection:
https://forum.arduino.cc/index.php?topic=588569.0
I used GY-955 through Serial connection for my system, but the final result of GY-955 with I2C connection was very better in comparison to GY-955 Serial connection.
Also I used GY-25 for my system, but the final result of GY-955 through I2C connection was very better in comparison to GY-25. Here is the code to get Euler angles from GY-25 through Serial connection: Run GY 25 in Arduino IDE (with Kalman filter) - Sensors - Arduino Forum
And here is my code to run CMPS12:
https://forum.arduino.cc/index.php?topic=696601.msg4682520#msg4682520
Also I get data from MPU 6050 or GY 521 or MPU 9250 with correct measurement units here:
https://forum.arduino.cc/index.php?topic=596009.0
If you have any question, you can ask me in comments or by a pm.