Hallo ,I got this accelerometer https://www.sparkfun.com/products/9652 ,and Im trying to use it whith arduino uno.The broblem is that when I'm trying to read the output I get an ac signal value instead of a dc.The signal's value is zero for half period and it goes from zero to Vcc the other half.Does anybody know why?I am measuring x output.Thanks in advance!
Did you use the 3.3V of the Arduino to the Vcc of the sensor board ? Did you connect the GND ?
If you read all three axis and dump a number of samples in a post, with your sketch, we can tell more.
The pins of the accelerometer did not osculate well :) Now i've fix that and im getting a constant x axis value of 1.13 volt which is almost the half of the Vcc (3.3 V) so i think now it works ok!Thanx a lot!I'm I supposed to get different values when I'm moving the accelerometer on the x axis?I can't notice a big difference in x output when I'm moving either on x or y axis.I have not connected the gsel pin so the sensitivity must be set up at 1.5 g.Anyway i think I should experiment with the values a little bit more ,thanks for your answer!
In fact the broblem I am facing right now is that I get different values from x and y axis while according to then theory x and y axis values should be the same.I get 1.10 V at x output,1.20 V at y output and 1.43 V at z.These are the values I get on my analog input on arduino and when I am measuring with the multimeter directly at the accelerometers outputs the values differe
That seems wrong. But it is not for sure it is wrong.
I would expect x,y,z = 1.1 1.1 1.6 What happens if you turn is 90 and 180 degrees in all directions?
when I am turning on the x axis the x value start from 1.10 V at 0 degrees ,reach a pick of 1.6 V at 90 degrees and then it goes back to 1.10 at 180 degrees( when the accelerometer is upsidedown) .If I am decreasing from zero to -90 the x axis value reach a least value at -90’ which is 0.5 V and it goes again up to 1.10 at -180 degress.An other issue I can’t solve is the variation between the values i am measuring with the multimeter and my arduino.The multimeter values on the accelerometer are: X=1.55 V , Y = 1.78 V and Z=2.11 V .While on arduino i get the values I refered before.I use the following formula to change the digital input from analog pin0 to real value : realValue=(sensorValue*3.3 /1023 ) ,as Vcc is 3.3 V and arduino got a 10 bit adc
Measures from arduin while I am turning: Xmax = 1.62 V at 90 degrees Ymax=1.72 V at -90 degrees Zmax = 1.42 V at 0 degrees I am a little bit confused.....
Ok I solved the issue with the arduino,the Vref voltage should be 5 V and not 3.3 as i Have asumed.Now i get the same values at the analog input and at the accelelrometer ,the only problem is the difference of x and y output
The values of post #5 look good.
If 'x' is pointing forward and is the nose, a roll (tilt left and right while keepin the nose pointing forward) should change the 'y' and not so much the 'x'. If the pitch is changed (let the nose dive down or climb up) the 'x' should change and not the 'y'. http://en.wikipedia.org/wiki/Flight_dynamics
If you have for examples 'x' and 'z' exchanged, it will be very confusing. Sometimes I write the values down and tilt it in all 90 and 180 degrees. The written down values start making sense.
Yes that's exactly what happens!All right now seems to work fine!!My only problem now is the difference between x and y values.Is this something I should worry about when I'll try to estimate the direction of the vector?
The MEMS sensor can have a large offset.
You could hold the sensor flat, read the values and use that in your sketch as offset. After that it should be fine. You could also use the average of about 5 samples. That will result in more accurate values.
If you accidently write to a analog port, perhaps the internal pull-up resistor can be switched on. But I assume the offset of the sensor is the problem.
According to the datasheet, the selftest is for this kind of situation: "the sensor provides a self test feature that allows the verification of the mechanical and electrical integrity of the accelerometer...".
Thanx a lot for your help!!!I will try that and post back to say what happened :)