QG Series inclination sensor delivers wrong values

Hi everyone,

my DIS QG series inclination sensor seems to work not correctly. When i put it on my desk it shows a value of 5.80 degrees. so i got my spirit level and leveled it out perfectly and put the sensor on top. Still same problem. Does anybody know whats the reason behind this?

Further information:


Really simple, sensor is powered by an external power source, grounds connected, output to A0 of the arduino, arduino powered by usb

int analogPin = 0;
float V = 0.0 ;
float val = 0.0 ;
float winkel = 0.0;

void setup()

void loop()
val = analogRead(analogPin);
V = val*0.0049;

winkel = (asin((V-2.5)/2))*(180/3.14159265359);

Serial.print("Winkel: ");

Thanks for your Help!

I would first measure the voltage from the sensor with a voltmeter and make sure that it outputs 0V 2.5V [+edit correction] when it is level. Then, with it held level, see what your code outputs for 'val' and 'winkel'.
In your code you should make sure that you don't allow the value of V to go outside the range -4.5 to +4.5, otherwise you'll get invalid results from asin.

Also, use code tags when posting code to make it easier to read.


Why not simply calibrate the sensor using known angle standards? You can ALWAYS do better than believe the datasheet.

Tutorial here.

Thanks for your answers.

I tried to measure the Output with a voltmeter but when its level it should output a Voltage of 2.5 V and my voltmeter wasnt precise enough to help. I will try to calibrate it now.

Thanks for your help