Sensors on Smart Phones Rachel Shah and Varsha Vuyyuru Dr.Qing
Chao Zheng Lu UTK CURENT
Slide 2
Overview 1 Objective Our goal was to learn how sensors such as
the magnetometer and accelerometer were used to track location.
From this, we would be able to create a code that would track our
location.
Slide 3
Overview Programming Basics of Python Develop a Number Game
Phone Hardware Capture Phone Motion Data Applying Code to Android
Phone Phone Connectivity Using Wi-Fi and GPS for Localization
Tracking Locations Mapping out your path
Slide 4
Basics of Python 4 Basics of Python include: Print statement
For Loop While Loop Opening and closing files
Slide 5
Number Game 5 Setting Variables and User Input y = 5 y =
int(raw_input(input a number) While Statement While (x! = y): If (x
> y): x = int(raw_input(guess a smaller number)) else: x =
int(raw_input(guess a larger number)) Print Statement print correct
answer! raw_input(good Job!)
Slide 6
Python Programming on Androids 6 Python programming language is
very practical due to its ease to use and ability to create codes
and applications.
Slide 7
Accelerometer An accelerometer is a device that measures
acceleration in all dimensions. It can sense tilt and movement and
has 3 axis's. An application that uses the accelerometer is the
labyrinth game. 7
Slide 8
Accelerometer Code 8 f = open(droid,w) d.startSensingTimed(
1,100) Open File and Start Timer for I in range(40): a =
d.sensorsReadA ccelerometer() a = a.result[0] f.write({0}\n.f
ormat(a)) Print I Time.sleep(1) For Statement d.stopSensing
d.makeToast(finished ) f.close)() Stop Timer and Close File
Slide 9
Accelerometer Readings 9 Here, the accelerometer measures the
steps taken by measuring the frequency.
Slide 10
Magnetometer 10 Magnetometers are used to measure magnetization
of a material or to measure the strength of a magnet,
Slide 11
Magnetometer 11 Import time d = android.Android)()
d.makeToast(start!) f = open(droid,w) d,startSensingTimed(1,100 )
Set to Android, Open File and Start Timer For I in range(40) a =
d,sensorsReadMagnet ometer Mag = a,result[0] Magb = a,result[1]
Magc = a.result[2] f.wirte({0} {1} {2}\n.format(mag,m agb,magc))
Print 1 Time.sleep(!) Reading the Magnetometer D,stopSensing()
d.makeToast(finished!) f.close() Stop Timer and Close File
Slide 12
Data for Magnetometer 12
Slide 13
How a GPS Works GPS satellites transmit information about their
current time and position at regular intervals These signals are
intercepted by your GPS receiver which calculates how far away the
satellite is based on time it took for the message to arrive
13
Slide 14
GPS Code Setting the code to Android Import android Import time
d = android.Android() d.startLocating() Read location data for I in
range(10) Time.sleep(2) a = d.readLocation() Print a if not
a.result: continue Reading Coordinates if gps in a.result: x =
a.result[gps][latitude] y = a.result[gps][longitude] print
d.geocode(x,y) print ------------ d,stiopLocating() 14
Slide 15
The RSSI (Received Signal Strength Indication) takes signals
your phone detects from nearby access points It then refers to a
database where it refers to signal strength to get distance. The
RSSI determines where you are in relation to those access points 15
How to get your Location Based off of Wi-Fi
Slide 16
Tracking and Mapping your Location Using a code similar to the
previous GPS, we were able to receive coordinates and map our
location. 16
Slide 17
Future Technologies With the growing popularity of GPS, there
are many advance to come with it. For example, Self-driving cars
Self-driving aircraft for military use 17