Gyro Sensor

I have a gyro sensor and am trying to use it to determine angular displacement. The basic equation i am using is:

degree=degree+(angv*time)
delay(time)

When it is in the 0degree position there is a slight drift which i expect. However, when i move the gyro a little and return it back to its original position the gyro returns some insane amount such as 3 degrees or even 5degrees. the drift at the beginning appears to be at an extremly slow rate therefore getting a reading of 5 or 3 degrees at an actual stable/0 degree position is crazy. I have no idea what is going wrong with this. It makes me wonder how on earth a segway doesnt fall over.

I think your problem might be the delay. You are probably missing some movement by not taking samples often enough. It's called sub Niquis sampling.

To save your googling frustration, it's "Nyquist"

Thanks, my spell checked didn't have that one. :slight_smile:

I did a quick web search with what I went with and did get reference to French mathematicians so it looks like other can't spell it either. :wink: