If you ever wondered how the iPhone or iOS device count your steps, knows device landscape or portrait orientation or provides directions -- then this app will help you dig deeper. Most of the iOS devices have multiple sensors such as -- accelerometer, gyroscope and magnetometer. These sensors are first line of intelligence that captures the data to make the inference. Sensor Plots is a iOS data acquisition app that will collect the digital data for further analysis and illustration.
Accelerometer Reference Frame
Accelerometer is a sensor that measures the g-force, also called Proper Acceleration, that acts on the device. Its helps iPhone determine how the iPhone is held by the user. The data reported by the accelerometer are in a x,y,z co-ordinate system that is attached to the phone. It has a frame as shown in following picture.
A Simple Accelerometer Experiment
The values providing on are a measure of g-force acting on the system. The earth's gravitational force is downwards but an object that is seating in an elevator it is getting a opposite force upwards. So a phone is kelt on a table facing upwards it will measure x = 0, y = 0, and z = -1. If you change the orientation of the phone to vertical landscape position with home button towards your left the values will be x = 1, y =position w 0 and z = 0. With phone in vertical portrait with hime button down the values reported by accelerometer will be x = 0, y = 1 and z = 1. The Sensor Plots app screenshot below shows this data as phone is moved in sequence in these positions. The rms-value (red line) represents the root-mean-square value which is magnitude of the net force and is equal to square root of (x*x+y*y+z*z).
Take a Few Steps
Take few steps after visualize your effect your walking style has on the accelerometer. The data is shown in following picture. The sample rate for this was 48Hz. if you increase the sample rate you can analyze the style of walking and pattern.
Gyroscope measures rate of rotation, that is how fast something is rotating. It's measure is radians per second around a specific axis. It helps in determining how fast the phone is rotated by the user, it helps games to offer how fast phone is being rotated by the user. You can make the phone as steering wheel in some games.
Gyroscope Reference Frame
The gyroscope measure are also reported in three values - x, y and z. Each value is rate of rotation around the axis. The sign of the value is determined by Right Hand Rule: take you right hand and curl your fingers in semi-circle they will point in positive direction. The figure below shows the positive direction.
A Simple Gyroscope Experiment
If you keep your phone on the table with face up, then perform the following steps:
- Use your right hand curl with thumb facing upwards. The rotate the phone by 90 degrees in direction of your finger curl. You can correlate the values measured by iPhone gyro in graph below. The z-value (behind red rms line) goes up positive and then goes to zero when phone stops at 90 degree. Then rotate the phone back to where you started (opposite to direction of your curl) and you see z-values going negative and then back to zero.
- Then face your right hand thumb towards your right and curl your fingers. Move the phone around x-axis i.e. upwards unto 90 degrees. You can see the x-value rising (behind red res-value) and goes to zero as phone comes to stop. Them move the phone in same direction back, you can see the x-values going negative and back to zero.
Figure below shows the data as shown by the app Sensor Plots app.
It measures total magnetic field observed by the device, that is sum of earth's magnetic field, surrounding magnetic field and device bias. The values are measured in x,y,z similar to accelerometer axis but represent deviation from devices magnetic reference frame.
A Simple Magnetometer Experiment
Take your iPhone and calibrate it using your native Compass app. Align the phone towards magnetic north (phone y-axis). Start the Sensor Plots app and do a magnetometer test. The following figure shows the raw magnetometer values as sensed by a iPhone 6 and iPhone 6+. The earth raw magnetic field is around 50 micro Tesla at the equator. These readings include the total magnetic field at the iPhone sensor.