Proof of concept – Using mobile’s motion sensors to identify point on a ball

AIM:
To experiment with accelerometer of mobile to successfully identify points on a football. We calculate the rotation angle of various point from a given reference.

THINGS REQUIRED :

1)Android Phone
a)Nexus 4
Invensense MPU-6050 Six-Axis (Gyro + Accelerometer), Magnetometer
b)Galaxy S
3-axis Magnetometer (Compass), Bosch Sensortec SMB380 3-axis accelerometer,
2)Football with point markings
3)Stable mount

REAL EXPERIMENTATION:

1) Working of Android Sensors  : We documented in this  post how android sensors work to help determine position of a point using rotational matrix. We define a reference point and calculate rotation of device with respect to it.

2) Marked ball with points and mounted it on a stable base.

IMG_20140308_013736

3) Understanding the angle changes in various orientations: 
The main idea is to first mark a reference point and then determine coordinates of other points with respect to reference by calculation the rotation of phone around x, y, z axis. This can be done by two methods:
A) Holding phone with its face towards the user as if clicking picture of point to be identified.
B) Holding phone with face upward.

I started by experimenting the change of angle at various planes/positions and how much accurate it was.

Z Axis :Rotating phone on a table top with face upwards results in change of only the angle with respect to Z axis. X,Y angles remain unaffected.  This lead to conclusion that if I have to identify various longitudes for a given latitude, say equator. The results obtained were pretty accurate.
Range : -180 degrees to +180 degrees. +ve in the clockwise direction from reference point.

Y Axis : Rotating phone around central vertical axis(length) of phone like a ball spinning changes Y axis angle. Thus if the phone is held vertically with face towards user and rotated around a spherical ball, change in Y axis can be used to identify longitude change on particular latitude .
Range : -180 degrees to +180 degrees. +ve in the anti- clockwise direction from reference point.

X Axis : Moving  phone up down like a see-saw along central horizontal axis (width)  changes X axis angle. This easily disparates Northern and southern hemisphere of ball. Thus it is used to measure latitudes. 
Range : -90 degrees to +90 degrees.  +ve tilt is towards ground -ve tilt towards ceiling.

It was kind surprising that I did not realize before experimenting that only 2 angles changes  would be required to define the latitude and longitude of the point. Clearly there are 2 options :

A) Phone held vertically like a camera then
Longitude : Y axis angle change.
Latitude : X Axis

B) Phone held horizontally with face upwards
Longitude : Z axis angle change.
Latitude : X Axis

Clearly if I hold phone like camera (option A) there would be a lot of hand movement making it difficult to correctly judge a point  because of continuous change in  latitude reading. Also since phone would be vertically held, covering a big area of ball, its very confusing for user to how to hold phone properly to get readings.

For above reasons (B) is the most viable option. I will try and align  the center top portion where speaker is with the ball, before taking readings. See picture below:

4) Identifying point on ball on a particular latitude i.e longitude changing
Lets start by identifying points on equator of ball (note this is a roughly drawn line ). I am just going to measure  change in Z axis angle and see what values I get. My aim is to see the change in readings of the point and determine fluctuation of z component for the same point at various attempts.

IMG_20140309_054856

Point.

Attempt 1

Attempt 2

Attempt 3

Avg.

Error 1

Error 2

Error 3

1

-38.8

-30.38

-36.3

-35.16

3.64

4.78

1.14

2

-61.7

-52.25

-54.3

-56.08

5.62

3.83

1.78

3

-80.1

-68.79

-73.3

-74.06

6.04

5.27

0.76

4

-101.47

-90.2

-91.9

-94.52

6.95

4.32

2.62

5

-123

-123.86

-116.1

-120.98

2.02

2.88

4.88

6

-146

-148

-135.7

-143.23

2.77

4.77

6.53

7

-162

-163.41

-154.82

160.07

1.93

3.34

5.25

8

174

172

179

175

1

3

4

9

158

156.5

164

159.5

1.5

3

4.5

10

136

137.3

142.39

138.5

2.5

1.2

3.89

11

116.97

117.8

121.95

118.9

1.93

1.1

3.05

12

100.2

99.3

101.52

100.34

0.14

1.04

1.18

13

90.4

89.8

91.3

90.5

0.1

0.7

0.8

14

83.56

82.5

84.2

83.42

0.14

.92

.78

15

74.35

71.3

74.64

73.43

0.92

2.13

1.21

16

61.3

62.6

59.4

61.1

0.2

1.5

1.7

17

47.8

45.39

49.5

47.56

0.24

2.17

1.94

18

31.6

27.7

25.2

28.16

3.44

.46

2.96

19

14.5

14.8

14.1

14.46

0.04

.34

.36

 Assuming that average of 3 readings of angle made with Z axis is the real  reading of angle at that point. Thus error is deviation of the observed reading from avg.

Average Error from attempt 1
41.12/19= 2.164

Average Error from attempt 2
46.75/19=2.46

Average Error from attempt 3
49.33/19=2.59

Average fluctuation in Z Axis Angle = 2.4 degrees

Range of error – 0.04 to 6.95

Thus, We saw in the above experiment that longitudes of a point on a particular latitude on sphere is liable to fluctuate on an average 2.4 degrees. 

5) Identifying point on ball on a particular longitude i.e latitude changing

We now repeat the same exercise for various points on a latitude on the ball with aim
1) to determine fluctuation of X angle
2) to determine fluctuation in Z angle, when it is ideally expected to not change.

IMG_20140309_052858

Point

Attempt 1  X

Attempt 1  Z

Attempt 2  X

Attempt 2  Z

Attempt 3 X

Attempt 3 Z

Average X from attempt 1,2,3

20

9.6

0.52

11.3

1.18

8.27

0.05

9.72

21

14.3

2.2

16.1

1.9

12.5

-2.3

14.3

22

19.9

1.4

21.1

0.9

17.9

-0.9

19.63

23

27.9

3.9

32.9

0.97

29.3

-1.4

30.03

24

40.38

1.5

36.3

-6.37

38.1

-4.5

38.26

25

52.75

-2.9

53.8

-0.7

48.1

-1.5

51.55

26

57.9

5.56

60.7

4.1

54.1

-5.9

57.56

27

61.5

6.18

70.1

7.2

61.8

0.95

64.46

28

76.11

4.4

72.1

-7

69.5

-8.9

72.57

29

-15.45

-3.5

-17.2

1.87

-17

1.74

-16.55

30

-24.32

-3.88

-23.6

0.4

-26

-2.5

-24.64

31

-32.7

-8.13

-32.1

-7.07

-30

-10.1

-31.6

Average Error(Z)  from attempt  1 – 44.07/12 = 3.67 degrees
Average Error(Z)  from attempt  2 – 38.96/12 = 3.24 degrees
Average Error(Z)  from attempt  3 – 40.74/12 = 3.39 degrees
Average Error(Z) = 3.43 degrees

Point

Error (X) Attempt 1

Error (X) Attempt 2

Error (X) Attempt 3

20

.12

1.58

1.45

21

0

1.8

1.8

22

.27

1.47

1.73

23

2.13

2.87

0.73

24

2.12

1.96

0.16

25

1.2

2.25

3.45

26

.34

3.14

3.46

27

2.96

5.64

2.66

28

3.54

.47

3.07

29

1.1

.65

.45

30

0.32

1.04

1.36

31

1.1

.5

1.6

Average Error(X)  from attempt  1 – 15.2/12 = 1.27
Average Error(X)  from attempt  2  – 23.37/12 =1.9
Average Error(X)  from attempt  3- 21.92/12 = 1.82

Thus, We saw in the above experiment that latitude of a point on a particular longitude on sphere is liable to fluctuate on an average by 1.66 degrees. Also even though determing points on a given longitude that angle wrt to Z Axis should have been 0, we see that there is avg error of  3.43 degrees introduced.

 

CONCLUSION

The above experiments proves that its viable to use accelerometer and magnetometer to determine coordinates of a point on sphere. Next we are going  to repeat the same experiment with a real globe.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s