Go Down

Topic: Measuring tilt with an MMA7260Q accelerometer (Read 3 times) previous topic - next topic

wayneft

Why don't try taking the math out of the equation and just focus on what analogRead is returning first.  At the lowest sensitivity setting for that device with it laying "perfectly flat" you should get returned values of ~337 for X and Y and ~501 for Z.  This is assuming you are powering the device with 3.3volts and are using the DEFAULT analogReference.  If you're values are not close to those numbers and semi stable, you may have a wiring problem.
I2C GPS Shield

Checkout my Open Source GPS Tracker on Kickstarter

deviukk

#16
Mar 16, 2011, 08:28 pm Last Edit: Mar 16, 2011, 08:34 pm by deviukk Reason: 1
This is the output of my analogRead (with time-averaging of 20 samples):

x: fluctuating between 307-330
y: fluctuating between 321-333
z: fluctuating between 508-516

The values do fluctuate serious, even with the time-averaging. This is probably not normal?!

liudr

Remind me what range of acceleration in g can the accelerometer measure? (spec sheet)
Also do you have a stable surface for the accelerometer or is it too close to a computer? The computer cooling fan could be a source of vibration. May be important if your accelerometer has a high sensitivity.

wayneft

It could also be instability in the reference(supply) voltage to the ADC (Arduino).  This accelerometer is ratiometric which means the voltage output is relative to the supply voltage at any given acceleration.  This is useful if using the same supply voltage for the accelerometer and A/D reference.  In this case I'm assuming you're using the 3.3V pin as the supply and the Arduino is setup to use the DEFAULT 5V analogreference.

First off try reading just a single axis and see if it's less noisy. If it is maybe you need a delay between axis' to let the voltage stabilize. 
I2C GPS Shield

Checkout my Open Source GPS Tracker on Kickstarter

deviukk


Remind me what range of acceleration in g can the accelerometer measure? (spec sheet)


I'm using the 1.5g range, with a sensitivity of 800 mV/g. Maybe the sensitivity is to high? I can select other ranges: 2, 4 and 6g, but with lower sensitivity. 


Also do you have a stable surface for the accelerometer or is it too close to a computer? The computer cooling fan could be a source of vibration. May be important if your accelerometer has a high sensitivity.


It was close to a computer. I can try to put it further away from it.

Go Up