Go Down

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

#### wayneft

#15
##### Mar 14, 2011, 07:14 pm
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 pmLast 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

#17
##### Mar 17, 2011, 06:29 am
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

#18
##### Mar 17, 2011, 12:36 pm
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

#19
##### Mar 18, 2011, 06:30 pm

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.

#### deviukk

#20
##### Mar 26, 2011, 03:08 pm
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.

#### hotshotharry

#21
##### Mar 26, 2011, 09:24 pm
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.

Go Up

Please enter a valid email to subscribe