which means that I would read ADC1 and ADC0 alternatively, then I read a constant value of 395 on ADC0 (aka Vref) and ~392 on ADC1 (aka 4X).
If I leave it commented, which means that I only read ADC1 (aka the 4X output), I get a value of 497 (which soon drops to 492). A huge difference! Why does this happen?
Why does the reading on ADC1 (aka 4X) change when I rotate the sensor around the Z-axis and Z-axis alone?
Based on the information you have given us, I would guess that this is a problem with your AVR setup or code, not the gyro. Can you simplify your system as much as possible, then post your entire code and a detailed description of the circuit and a picture if possible?
In particular, I recommend removing the gyro from the circuit and replacing it with resistor voltage dividers giving you approximately the voltages you expect. On the other hand, if take work as expected and you suspect that the gyro is the problem, you could remove the AVR from the circuit and look at the gyro outputs with a multimeter.
This is weird:
I simplified the circuit, meaning that I removed a dummy motor driver and I changed the gyro’s position on the breadboard.
I now read Vref=395 and 4X = ~383 in both cases, which I think is correct.
The driver wasn’t running and the connections were the same…
The difference 395-383 => 40mV difference => 4deg/sec can be attributed to gyro’s drift, am I correct?
This is not “drift” unless it changes over time. I recommend calibrating your sensor for this if it matters to you.
As for question 2, unless you describe your setup and show us your numbers, I cannot really comment. But sure, if you do not rotate it perfectly, you will see some variation in the reading on the other axis.
I was not trying to imply that there is any calibration feature built in to the chip - just that instead of using Vref as your zero, you can measure what the sensor reads when it is not moving, and use that value as a zero.
How are you sure that your ADC is so accurate? Can you also check Vref with a multimeter? It really does not matter in this situation, but in general, a good thing to do on the AVR (or most microcontrollers) if you need accurate measurements is to calibrate your analog reference against the internal reference diode. The datasheet for your AVR should have more information, but basically there is an internal analog channel you can read that should give you a precise voltage independent of VCC or AREF, which could easily be off by 5% or so.