New Reply

Using iPhone accelerometer data

 
Share Thread Thread Tools
Aug21-09, 02:58 PM   #1
 

Using iPhone accelerometer data


I wanted to use the raw data from my iPhone accelerometer to track displacement. I downloaded an app called Accelerometer Data Pro. It is pretty fun. You slide a bar to start sampling, walk around the room, and then slide the same bar to stop sampling. The time series results can then be downloaded to your computer in csv format.

I tried using the simple equations of motion in an Excel spreadsheet to convert accelerations into displacements, but there is so much noise. I did a test where it picked up the phone, walked around, and placed it back in the same spot. I set the origin to be the original resting place of the unit. If everything worked correctly, I hypothesized, then I should be able to plot a path that curves around in space, and then returns back to the origin. ....That didn't happen.

I was wondering if anyone else had every played around with similar accelerometer data. What tricks did you use to filter out the noise in the data? Also, how did you subtract out the acceleration of gravity. Unless I hold the phone perfectly level, it is hard to differentiate the accelerations from motion, from gravity. The iPhone doesn't have gyros, so it is difficult to determin the orientation of the device at each data reading.
PhysOrg.com
PhysOrg
engineering news on PhysOrg.com

>> Company pioneering new types of material for 3-D printer 'ink'
>> Student-built innovations to help improve and save lives
>> Researchers use light projector and single-pixel detectors to create 3-D images
Aug21-09, 03:16 PM   #2
 
Recognitions:
Gold Membership Gold Member
Could you post the data?

Problems with noise can be smoothed out using a weighted moving average, depending on what kind of noise it is...
Aug21-09, 03:40 PM   #3
 
Quote by DavidSnider View Post
Could you post the data?

Problems with noise can be smoothed out using a weighted moving average, depending on what kind of noise it is...
The data is on my computer at home. I'll post it later tonight.
Aug21-09, 03:48 PM   #4
 
Recognitions:
Science Advisor Science Advisor

Using iPhone accelerometer data


I think you'll run into problems trying this. The problem is that the accelerometers are not oriented in the same position at all times. You might "think" that you're measuring vertical accleration, but it could be a mix of 2 or 3 components.

I originally thought the Nike+ system was based on acclerometers, but then thought they would run into the same problem and therefore need gryos or some other method to keep track of angle. It turns out it simple measures the time your foot is in contact with the ground and uses impirical data to guess your speed.

If you're trying to keep track of displacement maybe the best method with what you have is to identify the acclerometer that measures up (lets say while your phone is in your pocket) and then "watch" for the impacts and go the Nike way.
Aug21-09, 05:36 PM   #5
 
It won't work very well unless the iphone's axes always point in the same direction. As soon as you rotate the device at all, you've changed what the iphone thinks is the +x direction.
Aug21-09, 08:16 PM   #6
 
Quote by DavidSnider View Post
Could you post the data?

Problems with noise can be smoothed out using a weighted moving average, depending on what kind of noise it is...
Here is a sample file of raw accelerometer data measured at 60 Hz. To keep it simple, I put the phone flat on a table, I hit the start sampling button, took my hand away for a couple seconds, grabbed the phone and slid it across the table, let go of the unit for a second, grabbed it again, and slid it back to its original position. The sliding motion was along the y-axis. The z-axis acceleration is close to 1 which is gravity. The x-axis acceleration is from the caffeine induced shake from my hand.
Aug21-09, 08:21 PM   #7
 
Hmm. I guess you can't upload .csv files. I changed the extension to .txt, and tried again. Hopefully it will work this time.
Attached Files
File Type: txt capture4.txt (57.8 KB, 246 views)
Aug22-09, 01:01 PM   #8
 
I see the column of z axis data is almost always -1. This would lead me to believe that we're in units of g. z is the vertical axis of however the device was being held. Not sure on x and y.
Aug24-09, 09:36 AM   #9
 
Recognitions:
Science Advisor Science Advisor
I don't really see any decent data as I'm looking at it now. I used a simple trapezodial rule to get velocities and again to get displacements.

Even with a 1/2 second moving average, the accelerations seem too noisy to be useful. Looking at the displacements, I would expect a line which parabolically increases to a value then stops. From there, it should parabolically decrease back to a value close to the starting point. Mostly, all I see is a noisy line.

I wonder if decreasing the sampling rate would help?
Aug25-09, 08:00 PM   #10
 
hello there,
i am using a tilt pad gravis destroyer tilt
i have acquired the raw data from it by DirectInput,
it has 2-axis i was wondering if i could use it for detecting
displacement too

i see you guys are trying to do the same thing,
could you guys tell me how do you calculate from these raw
data velocity, acceleration, orientation
i have some ideas but im really confused right now
Aug27-09, 11:03 PM   #11
 
Here is another data set that is a little more interesting than what I posted previously. I attached a string to the belt clip on the case of my iPhone, and let it swing back and forth from a fixed point on my desk. The string was about 18 inches long. I tried several sampling rates, and looked at the resulting data. A sample rate of 60 Hz was the best for capturing enough data points to cover the entire period of the swing. I also selected the hi-pass filter option. The Accelerometer Data Pro software states that this filter can be used to remove the acceleration of gravity from the data. Check it out and have fun with it.
Attached Files
File Type: txt capture pendulum 60 hz hi pass.txt (49.8 KB, 136 views)
Aug27-09, 11:11 PM   #12
 
Attached is a time series graph of the x,y,z accelerations. It looks like a classical damped pendulum. The noise at the beginning and end are from my hand starting and stopping the swinging iPhone.

Edit: I forgot to mention that the acceleration values are measured with respect to gravity. For example, the iPhone sitting at rest on a desk would register a value of 1 along the z-axis.
Attached Thumbnails
pendulum data.png  
Aug28-09, 07:24 AM   #13
 
Recognitions:
Science Advisor Science Advisor
NOW you have something useable! Any plans for using these capabilities?
Aug28-09, 12:18 PM   #14
 
1. Accurately determine the period
2. Perform the same experiment in the two other dimentions.
3. Calculate the center of mass of the Iphone!!
Sep2-09, 11:09 AM   #15
 
Regarding data reduction, acceleration, velocity, and position are all vector quantities. Also, since, in reality, the phone is a rigid body (and not a particle), rotations must be accounted for in the equations of motion. While the accelerometers are incapable (on their own) of logging rotation about the vertical axis (invariant with the phone's orientation), this seemingly is overcome by placing the iPhone away from the center of rotation of the vehicle you wish to investigate (i.e. car, bike, aircraft).

Intuitively, the data obtained will be point-of-view of the body (i.e. Lagrangian), and not point-of-view of the observer (Eulerian). In other words, acceleration along any body principle axis may have components along all three global axes. This naturally varies with the orientation of the body coordinate system (CYSb) with respect to the global field CYSg as data are logged.

Thus, a transformation from CYSb to CYSg is necessary when the path traversed is not composed solely of 1:1:1 ordered triplets (ui,vi,wi), if one wishes to obtain a three dimensional path in time.

I'd have to give this some further consideration, but I'd rather get my hands on some data I have logged using the Accelerometer Data Pro app which I have purchased. Unfortunately, I am so far unable to extract data, despite having in best faith replicated the instructions (i.e. WiFi internal server's URL accessed by an independent computer).

Any advice or insights on that front would be of utility.
Sep2-09, 01:12 PM   #16
 
Blog Entries: 2
Quote by swied View Post
I tried using the simple equations of motion in an Excel spreadsheet to convert accelerations into displacements, but there is so much noise. I did a test where it picked up the phone, walked around, and placed it back in the same spot. I set the origin to be the original resting place of the unit. If everything worked correctly, I hypothesized, then I should be able to plot a path that curves around in space, and then returns back to the origin. ....That didn't happen.
I don't think you can determine your position like this. If you move very slowly the accelerometer doesn't detect anything. But still you change your position.

For example you move north then stop. Then you turn 90° to the right (very slowly) and move forward. The rotation is not detected.
Sep14-09, 05:55 PM   #17
 
Quote by swied View Post
I was wondering if anyone else had every played around with similar accelerometer data. What tricks did you use to filter out the noise in the data? Also, how did you subtract out the acceleration of gravity. Unless I hold the phone perfectly level, it is hard to differentiate the accelerations from motion, from gravity. The iPhone doesn't have gyros, so it is difficult to determin the orientation of the device at each data reading.
Hi! I'm developing an app on the iphone for research, using accelerometer raw data. It is very simple to differentiate motion accelerations against gravity acceleration. You can obtain the three components of the motion acceleration using an high-pass filter on the accelerometer raw data. Gravity is a constant acceleration, so using an high-pass filter (which pass high-frequencies and cut low ones) will remove this component. If you use this trick, when the iphone is quiet you wil see (0,0,0) but when the iphone is in motion you will see the motion components, without gravity. In this way the relative orientation of your device during the motion will not affect your data.

Feel free to ask me if you want ;)
New Reply

Tags
acceleration, displacement, iphone, motion, velocity
Thread Tools


Similar Threads for: Using iPhone accelerometer data
Thread Forum Replies
How to calculate horizontal angle from from (Iphone) Accelerometer data. Introductory Physics Homework 5