ADXL335 - what's the value of g? Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ADXL335 - what's the value of g?

I'm working with the ADXL335 accelerometer that adafruit sells. I've got the A2D on an arduino running nicely and can read off acceleration values in terms of g. I'd like to now translate those values into "real" accelerations. What value of g should I use?

Obviously, g ~ 9.8m/s^2, but the value varies in the 3rd (and sometimes second) decimal place as your position on earth changes (mainly because of differing altitudes).

I've read the spec sheet and this subtle point isn't mentioned. Does the device measure g and then spit out an acceleration in terms of the local value, OR, is there an internal value that's factory specified.

Here's the same question. If I brought the ADXL to the moon and dropped it, would it show an acceleration of g or less than g?
dintymoore

Posts: 6
Joined: Tue Nov 16, 2010 1:41 pm
Location: 44th parallel & Mississippi River

Re: ADXL335 - what's the value of g?

I would just put the thing with one axis up and down, and whatever it outputs, call that 1G. On the moon it would read less than a G. About a 1/6 IIRC.

zener

Posts: 4558
Joined: Sat Feb 21, 2009 2:38 am

Re: ADXL335 - what's the value of g?

The radius of the earth is 6,371,000 m. At that distance, the acceleration from gravity at the top of Everest is 0.28% less than at sea level. The higest point humans can actually live at is 0.13% less.

I find it difficult to believe the accelerometer you just shelled out twenty bucks for (and the chip itself costs less than \$2) is going to boast sensitivity of better than 0.1%. In fact looking at the datasheet it appears the sensitivity is about +/-10%.
Red M&M, Blue M&M: They all wind up the same color

stinkbutt

Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: ADXL335 - what's the value of g?

dintymoore wrote:If I brought the ADXL to the moon and dropped it, would it show an acceleration of g or less than g?

If you held it on the moon, it'd register 1/6th of g. If you dropped it it would register no acceleration whatsoever, as it'd be weightless while freefalling.
Red M&M, Blue M&M: They all wind up the same color

stinkbutt

Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: ADXL335 - what's the value of g?

I would assume it is g=9.80665 m/s^2, standard gravity.

The device detects apparent gravity.

Apparent gravity varies with altitude, latitude, geology, and a bunch more ever decreasing influences.

On the moon, when static, it should read approximately 0.1655g. (If you dropped it, it would actually read zero until it hit the lunar surface, just as it does here on Earth).

I have to ask why does it matter. The accuracy of the device is only around 1% or so. Your third digit is likely meaningless.

some_call_me_tim

Posts: 7
Joined: Mon Nov 15, 2010 6:00 pm
Location: Sonoran Desert

Re: ADXL335 - what's the value of g?

Wikipedia has a table of the local values of g for various cities in world here: http://en.wikipedia.org/wiki/Earth%27s_gravity

I assume the values would be a bit more extreme at the north pole or at the top of Chimborazo (the peak in Ecuador that is furthest from the Earth's center, further even than Everest due to the Earth's equatorial bulge), but nevertheless, that list gives a reasonable range for the populated areas on Earth.

The highest value in that table is 9.819 in Helsinki, and the lowest value is 9.781 in Jakarta and Calcutta. Those values vary by 0.038, which is about 0.39%

Looking at the ADXL335's data sheet tables of sensitivity, there's somewhere around a 2% variation among samples. In other words, sample-to-sample variation in the chip is more than five times greater than the variation from the highest to lowest local value of gravitational acceleration in populated cities.

If you had to pick one value to use, I'd use the standardized SI value of 9.80665, but realize that individual chips are going to vary so much that it makes no sense to be that precise. Maybe if you're careful and lucky you could calibrate one particular chip to get precise answers out of it; I don't know.
uoip

Posts: 127
Joined: Wed Sep 23, 2009 5:48 pm

Re: ADXL335 - what's the value of g?

uoip wrote:The highest value in that table is 9.819 in Helsinki, and the lowest value is 9.781 in Jakarta and Calcutta. Those values vary by 0.038, which is about 0.39%

Looking at the ADXL335's data sheet tables of sensitivity, there's somewhere around a 2% variation among samples. In other words, sample-to-sample variation in the chip is more than five times greater than the variation from the highest to lowest local value of gravitational acceleration in populated cities.

I'm pretty sure this indicates that the accuracy of the output voltage is +/- 10%:

accuracy.png (5.99 KiB) Viewed 2927 times

But who cares? You're agreeing with me, why am I even posting? Whee!
Red M&M, Blue M&M: They all wind up the same color

stinkbutt

Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: ADXL335 - what's the value of g?

I'm pretty sure this indicates that the accuracy of the output voltage is +/- 10%:

This does actually bring up a good point about interrupting data sheets. Those values show that they guarantee the output will be with 10% of the nominal value. So, if we just throw one of these guys into our circuit, grab a sample and try to determine what the apparent gravity is, we can indeed only know it within 10% or so. This is the absolute accuracy.

However, we can easily calibrate out for this variation by comparing it to the local gravity. So, if I got dinty's location correct he's somewhere between Minneapolis and Chicago, looking in Wikipedia gives us a value of 9.803 for Chicago. Let's say he reads 270mV, so he calibrates his system to read .99963g (Chicago's local gravity) = 270 mV (270.1mV/g). He sends his system to the moon where it records 44.7mV, much lower than the expected 49.65mV, but because he knows that on this particular instrument that 1g=270.1mV, he can correctly deduce that the Moon's gravity is 0.1655.

So, now the overriding factor will be how linear the device is. We consult the datasheet and get a mere ±0.3%, significantly better than our absolute value of ±10%. However, we are feeding this to an Arduino with only 10-bits of resolution we can't expect to read anything this precise anyway, since we will only have something like 3mV of resolution on the DAC with of itself is ±1%. OP course, the absolute accuracy of the DAC is 2 bits at 200KHz....blah blah blah...

Suffice it to say the difference in g from one location on Earth to another will literally be lost in the noise when reading one of these things with an Arduino.
Last edited by some_call_me_tim on Fri Nov 19, 2010 4:06 pm, edited 1 time in total.

some_call_me_tim

Posts: 7
Joined: Mon Nov 15, 2010 6:00 pm
Location: Sonoran Desert

Re: ADXL335 - what's the value of g?

Some_call_me_Tim wrote:However, we can easily calibrate out for this variation by comparing it to the local gravity.

Ideally, yes. In practice...test your assumptions. That only works if:

• The deviation is fixed and does not include noise / drift / error / etc.
• The deviation is constant deviation, not a variation in response
• You check each axis individually (a three-axis sensor is generally three independent one-axis sensors on Si)

And even there, I may have missed some stuff. If precision is important to you, characterize your sensor. If you're not going to be actively standing over it and making adjustments if the output is weird, characterize your sensor. If you want it to reliably do something more interesting than ... oh, just characterize your sensor already. The datasheet is a starting point, not the last word.
tinsmith

Posts: 62
Joined: Thu Nov 18, 2010 9:18 pm

Re: ADXL335 - what's the value of g?

Ideally, yes. In practice...test your assumptions. That only works if:

* The deviation is fixed and does not include noise / drift / error / etc.
* The deviation is constant deviation, not a variation in response
* You check each axis individually (a three-axis sensor is generally three independent one-axis sensors on Si)
Each of those sources of error have to be tackled in different ways. Noise can be averaged out. Temperature drift can be eliminated by regulating the temperature. The output is ratiometric so you better reference the same input voltage for the ADC. I did forget to mention zero offset . :oops:

I only suggested a method for getting rid of the largest contributor to error. I should have also said that the more points you can calibrate against the better. Because there could be a significant offset at zero g (see, I forgot to look at the whole datasheet too). Testing the device at -1g, 0, and +1g should be trivial. If you use two point calibration (zero offset and gain). Then linearity is the predominate error of the sensor.

And as long as I'm being pedantic,
If precision is important to you, characterize your sensor.
That should be if accuracy is important to you. Accuracy is how close something is to the correct value. Precision is how much error is in the measurement. For example, x= 2+2 the answer x= 4 is accurate, while x=3.987654321 is very precise, it isn't very accurate.

Too make a long post short, you are correct if you want any kind of accuracy out of that sensor you need to calibrate/characterize it.

some_call_me_tim

Posts: 7
Joined: Mon Nov 15, 2010 6:00 pm
Location: Sonoran Desert

Re: ADXL335 - what's the value of g?

Some_call_me_Tim wrote:That should be if accuracy is important to you.

Yep. Sorry, I misspoke. Precision isn't going anywhere and is a matter of knowing, managing, and reporting your statistical error sources. Accuracy, you can calibrate and characterize and hopefully get a pretty accurate result if it's a good sensor...within the limits of your precision.
tinsmith

Posts: 62
Joined: Thu Nov 18, 2010 9:18 pm

Please be positive and constructive with your questions and comments.