Accelerometers on an android phone

I don’t know too much about cell phones, and I am somewhat intrigued by the recent generations of phones with their own open-source operating system, known as androids. An android exists on my Samsung cell phone. The phone is a common one, nothing special in itself. I can download apps, such as one for a graphing calculator. But one thing I found intriguing was an app called an AndroSensor, which among other things, gives the output of the built-in accelerometer.

Accelerometers, I am guessing, are the hardware responsible for “knowing” which way to orient the display whenever I hold the phone at strange angles with respect to myself. Knowing which way is down enables the cell phone to always present to me text and images in what I perceive to be a perpetually upright orientation.

Over the ‘net, there seems to be mixed reviews as to the accuracy of these devices. You can gauge the accuracy of your accelerometer by first taking a “snapshot” of your acceleration stats at any moment if your AndroSensor allows it (I had to enable it through the settings), then look carefully at the filename it saves it as so you can find it in your file area using your file app.

Luckily, it’s the first file on my file list, and I click on it. The accelerometer breaks down the acceleration into the three component vectors which we will call ax, ay, and az. And of course, these can be expressed as a Cartesian vector, which in my case is: $latex \vec{a} = [1.2558\ 4.9033\ 7.9679]$. This makes its magnitude: $latex |\vec{a}| = \sqrt{1.2558^2\ +\ 4.9033^2\ +\ 7.9679^2} = 9.4396$ m s-2.

You might guess that this is quite a deviation from the famous 9.8 m s-2 you were taught in high school science class. But I get other accelerations at any moment from my accelerometer by sitting in the same place, at my desk, in front of the same PC. What I did was sit for a couple of seconds while my android recorded its stats on to a comma-separated volume (CSV file), and I did some simple calculations on a spreadsheet. My file is not strictly a CSV file as advertised as semicolons, not commas, separate the fields. I needed to read in the file as “external data” in Excel. This was a little easier to do in Open Office, as I could set the delimiters right away by going through the “Open” dialog like any other spreadsheet file.

My AndroSensor also has a “record” function to record data repeatedly over time. Now, I am not meaning to take a scientific sample or anything, but none of the 21 accelerations I took were the same, and there was wide variation. Some were slightly greater than 9.8 m s-2, while others were well below 9.7 m s-2. The average resultant acceleration I obtained was 9.6952 m s-2.

I find it hard to believe that an android can generate that much variability. But even to be this accurate, you need to place it on a flat, heavy table that isn’t likely to be influenced by movement. I used my home office desk. If  you hold it in your hand, the variations in measurements get a little more strange due to involuntary hand movement, and you can get accelerations greater than 10 and less than 9.4. And that’s if you are stock still for the duration of the measurement.

If you take the value of 9.6952 as being the gravitational constant for the Greater Toronto Area, it still seems far off. Wolfram’s Alpha widget tells me that the GTA has $latex g = 9.80678$ m s-2. And since g is weaker at high altitudes, the widget tells me that $latex g = 9.76321$ m s-2 at Mount Everest in Nepal. It would seem that for a g value of 9.6952, I would need to be several kilometers above Mount Everest. So, I think that on a first blush, my accelerometer is ok for orienting my display but maybe not OK for getting the gravitational constant in my locale.

The gravitational constant would have only applied to all points on Earth if the Earth were a perfect sphere of uniform composition to the core and had a smooth surface with no irregularities. The Earth is none of these things, and the accepted value of $latex g = 9.8067$ m s-2 is changeable due to differences in composition and altitude, which affect both g‘s magnitude and direction. It is not always exactly 9.8067, and gravity doesn’t always pull exactly toward the Earth’s centre. But we are talking about small changes, not something like 9.6952, which seems way off.