Pages: 1 [2]   Go Down
Author Topic: Measuring tilt with an MMA7260Q accelerometer  (Read 3453 times)
0 Members and 1 Guest are viewing this topic.
Worcester, MA
Offline Offline
God Member
*****
Karma: 3
Posts: 623
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

I2C GPS Shield

Checkout my Open Source GPS Tracker on Kickstarter

0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?!
« Last Edit: March 16, 2011, 02:34:34 pm by deviukk » Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7197
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Worcester, MA
Offline Offline
God Member
*****
Karma: 3
Posts: 623
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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. 
Logged

I2C GPS Shield

Checkout my Open Source GPS Tracker on Kickstarter

0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I implemented a Kalman filter to fix the problem of the unstable readings. This works very well. The accelerometer responds well to changed and the value is very stable.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 49
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This sensor has 3 sensitivity settings ... Checkthe data sheet to get what you want, also I had to put a pullup resistor on the sleep pin to get it to stay on ... And third this sensor puts out a value of 0 - 3v3 with the center range being 3v3/2 , negative and positive g will either be more or less ... The mv values posted earlier look correct ... You can reduce noise slightly by using a rc circuit as destroyed In the data sheet... you will need to calculate g's from the mv if that is what your looking for.
Logged

Pages: 1 [2]   Go Up
Jump to: