# Gyroscope problems, (null voltage changes with Temperature)

Hello, I have a gyropscope that gives me the temperature and the angle. This is its datasheet.

The problem I have is that the null voltage is 2.5v at 25 C, but my room or environment temperature is not 25C. If i set the calculations to have a null voltage of 2.5V, my degrees will gradually increase, (very hard to explain and it has to do with calculation but is not that important to my question). What my question is how do I know how the null, or ‘Zero movement/standard voltage’ given off by gyroscope changes with temperature. I can’t figure out what the rate of change is by looking at the data sheet. I don’t know if im making myself clear, if you have any additional questions or comments, please comment.

This is my code.

``````int gyroPin = 0;               //Gyro is connected to analog pin 0
float gyroVoltage = 5;         //Gyro is running at 5V
float gyroZeroVoltage = 2.4818;   //Gyro is zeroed at 2.5V
float gyroSensitivity = .007;  //Our example gyro is 7mV/deg/sec
float rotationThreshold = 0;   //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;
//int roundedAngle = currentAngle;

//DEBUG
Serial.println(currentAngle);

delay(10);
}
``````

That PDF only specifies the behaviour at 25C and doesn't state how that varies with temperature, but it also says on Page 6 that they provide the parameters for a quadratic curve indicating the characterstics of each of the listed parameters with temperature, and it also refers to a separate application note with full details of calibration. According to that, if you have one of these devices you should have access to data about the specific characteristics of your device, and just these typical characteristics.