I just bought an Arduino Uno microkontroller with a Tinkerkit sensor shield and Tinkerkit gyroscope 2 axis sensitivity 4X.
I have connected one of the axis on the sensor with a cable with plugs also from tinkerkit, who fits right on. My project is to control a 230V relay when gyro is out of a given range in degrees. See attachment for circuit diagram.
I have started to connect the gyrosenser to the microcontroller, and downloaded the code given in the datasheet for the sensor.
[To the problem:]
I have mounted the sensor on a straight metal rod so it should be easy to rotate and test the code. When I start the program i get 0 on the connected axis, and that is what i want. But when I rotate the sensor 90 degrees counterclocwise, and then clockwise 90 degrees back to my zero point, I dont get 0 but 356 degrees.
This displacement increases for each time I repeat this process. And the deviation from my originally zero point increases.
So what could I possibly do wrong? I have tried to adjust sensitivity and ADC resolution with no results. Do I need a filter or something? If someone have experienced the same problem, I would really appreciate you sharing your experiences.
Im new to Arduino, but have some coding experience. Thank you for reading my question.