IDG500 Breakout Board Gyro Sensor

Hello and thank you!

I have a gyro and I am getting nonsensical values. It is the first time I've used one so I want to make sure I'm not doing anything wrong. But I followed guides, tutorials and datasheets to the letter.

Here is the sensor: https://solarbotics.com/product/50815/
Here is my code:

 /* Keep track of gyro angle over time
 * Connect Gyro to Analog Pin 0
 *
 * Sketch by eric barch / ericbarch.com
 * v. 0.1 - simple serial output
 *
 */

int gyroPin = 14;               //Gyro is connected to analog pin A0
float gyroVoltage = 5.0;         //Gyro is running at 5V
float gyroZeroVoltage = 1.35;   //Gyro is zeroed at 1.35V
float gyroSensitivity = .002;  //Our example gyro is 2mV/deg/sec
float rotationThreshold = 1.00;   //Minimum deg/sec to keep track of - helps with gyro drifting

float currentAngle = 0;          //Keep track of our current angle

void setup() {
  Serial.begin (9600);
}

void loop() {
  //This line converts the 0-1023 signal to 0-5V
  float gyroRate = (analogRead(gyroPin) * gyroVoltage) / 1023;

  //This line finds the voltage offset from sitting still
  gyroRate -= gyroZeroVoltage;

  //This line divides the voltage we found by the gyro's sensitivity
  gyroRate /= gyroSensitivity;

  //Ignore the gyro if our angular velocity does not meet our threshold
  if (gyroRate >= rotationThreshold || gyroRate <= -rotationThreshold) {
    //This line divides the value by 100 since we are running in a 10ms loop (1000ms/10ms)
    gyroRate /= 100;
    currentAngle += gyroRate;
  }

  //Keep our angle between 0-359 degrees
  if (currentAngle < 0)
    currentAngle += 360;
  else if (currentAngle > 359)
    currentAngle -= 360;

  //DEBUG
  Serial.println(currentAngle);

  delay(10);
}

As for the hardware,
I have my Vin on the gyro connected to 5V output on the arduino
Y-OUT connected to A0
GND connected to GND

What happens is it starts at 360 and goes all the way down to 0 and then goes to 360 again. And my moving the gyro around doesn't do anything to increase the rate or decrease it or anything really.

Am I doing anything wrong??

For analog input, use the number: 0
If you use a analog input as a digital pin, use the term: A0

Write the data from analogRead() to the serial monitor, and try to make sense of that.

Thank you for the reply.
I changed the input from 14 to A0 and also 0. They all yielded the same result, which is input from the correct pin.
I looked at the raw data and sometimes I get consistently one number, but that number is different from the XOUT, 4.5XOUT, YOUT, and 4.5YOUT i.e. sample output for XOUT:
293
293
293
i.e. sample output for YOUT:
121
121
121
121

Now, this number stays constant, straying perhaps one if I keep it still. But it doesn't change no matter which way I turn it. It is difficult to tell really if it is just noise or what. But the range never strays above 10.

A point of clarification please: The zero voltage should mean that while the gyro is still, I SHOULD get a constant read from the analog pin that is equal to: (ZeroVoltage/VoltageInput) * 1024
In this case: (1.35/3.3) * 1024 = 418.
Is this correct?

The term "A0" is actually 14. But the number 14 is not used like that. It looked weird to me.

According to the schematics the sensor operates at 2.8V.
I expect the output to be 1.4V if the sensor is kept still. That would be a value of about 287. So your value of XOUT seems okay.

That value of XOUT should change if you rotate the sensor in all directions.
The value changes while the sensor is being rotated. Perhaps only 5 higher or lower. Could you test that once more ?

If the values changes a little, you can try the 4.5XOUT.