I just purchased a gyro sensor. I was trying to use the sample code to chk the sensor.. and for some reason I am not able to detect any change in the angle
I followed the exact steps given in the following website
I still am not getting any changes..
Please suggest
I think you are under the misapprehension that these gyros are absolute - they are not, they are "rate gyros" that output a signal proportional to the current rate(s) of rotation. To get an angle signal you have to integrate the rate signal yourself. It's also important to calibrate the zero-point for each axis for best results.
Even with this modification you will still see drift with time, its in the nature of the device.
I dont think those are floating values. the values vary from 250-285, when I try to rotate them. And when I unplug them, the pins read 0 for a sec and goes back to 145 and again to 272 and from there, I get a constant 270-278 values. Am not really sure if these are the values from gyro. And even if these are the values from this gyro, I can possibly do nothing with this 250-285 range. Please suggest.
The Sparkfun breakout board uses 2.8V supply to the chip, its internal reference is rated as 1.35V, so I believe it will be outputing 1.35V at zero rates, which is roughly a count of 276 on a 5V Arduino, so those ADC values make sense.
You should see them vary while the unit is turning, either increasing of falling depending on the sense of the rotation in the relevant axis - its not easy to turn something at 500 deg/s by hand unless its on a longish set of leads(!).
Hmm..
So, supplying an external output rather than connecting it to arduino, will give me a wide range???
Also, I want this board in my car, so that it can detect turns. If I cant turn it with my hand, how else can I makt it work?
The unit will output a value in the 176 area when stationary and this will increase or decrease if turning in the relevant axis - you have to turn it at 500 deg/s to see full-scale output - that's a very fast turn, so you aren't likely to see a big response to turning it by hand, but that's quite OK, its not a show-stopper like you seem to think.
To measure angle you have to integrate the output, like I said - have a look at the plentiful discussions of this here and elsewhere. To detect a 90 degree turn you'll then have to look at this integrated output over time and see if its varied enough in the timescale of interest.
Or you can look directly at the rate of turn to decide if there is current turning motion - this won't be a big signal with this gyro, a few counts.
Part of the issue is that you are looking at a 1.35V signal with an ADC set to 5V full range. You can get some more precision by using analogReference(EXTERNAL) and feeding 3V3 to AREF pin - then the ADC will have a 3.3V range.
I seem to recall that that breakout has differently-scaled outputs from standard, was it x4.5 or something? Those might help give stronger signal at slower rates-of-turn.