Strange values with Gyro Sensor - I072605

Hello all,

I am using a Arduino Mega board with a gyro sensor I072605. I have used the code below to program it.
This gives me values between 300 and 18000 (image attached) but I donโ€™t manage to understand them :frowning: . These values are big whereas I was expecting to receive something between 0 and 360.
Do you know what are these values ? And how could I convert them ?

Thanks by advance for your help :slight_smile:

// MPU-6050 Short Example Sketch
// By Arduino User JohnChi
// August 17, 2014
// Public Domain

const int MPU_addr=0x68; // I2C address of the MPU-6050
int16_t GyX,GyY,GyZ;
void setup(){
Wire.write(0x6B); // PWR_MGMT_1 register
Wire.write(0); // set to zero (wakes up the MPU-6050)
void loop(){
Wire.write(0x3B); // starting with register 0x3B (ACCEL_XOUT_H)
Wire.requestFrom(MPU_addr,14,true); // request a total of 14 registers<<8|; // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L)<<8|; // 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L)<<8|; // 0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L)
Serial.print(" | GyX = โ€œ); Serial.print(GyX);
Serial.print(โ€ | GyY = โ€œ); Serial.print(GyY);
Serial.print(โ€ | GyZ = "); Serial.println(GyZ);


You could simply use the map function to map those values from 0 to 360. It will map 300 to 18000 to 0 to 360.

anglex = map(GyX, 300, 18000, 0, 360);

Thanks a lot for your reply. However, I am not really sure of the range. I can only estimate it so i will never be able to be very accurate.
Does someone know the calculation behind these figures, please ?

Thanks for your help

The gyro measures the RATE of rotation, not the rotation angle. This is explained in the data sheet, which also explains the units of measurement (related to degrees per second).

Hi, noob question... I hope it is ok to join this thread? Apologies if not.

I am looking in to using multiples of this unit myself in a project, can you tell me how many pins are required on the Arduino? Can it have shared power and ground then 3 analog pins per gyro i'm guessing/hoping?