# Reading from sensors on your mobile phone

Jiro's picks this week are Android Sensor support and iPhone and iPad Sensor support by the MathWorks Mobile Sensor Connectivity Team.

If you own a smart phone, you're probably holding a device with a number of sensors that is constantly collecting information from its surroundings. Many of the apps on your phone make use of these various sensors to operate. Now, you can read from your phone's sensors using MATLAB! If you have R2013a or newer and an Android phone or an iPhone/iPad, you will want to check this out.

After installing a free app for your Android or iPhone/iPad, you can now receive sensor data from you phone directly into your MATLAB session. It is written using MATLAB Classes, and it has a simple interface to read sensor data from your phone.

Establish connection with your phone:

sensor = sensorgroup('AndroidMobile')

sensor =
sensorgroup logging data from Android device on port 60000

Measurements: (showLatestValues)

Acceleration                        Orientation

Latitude                            Speed
Longitude
Altitude                            MagneticField


Read the latest values from the sensors:

showLatestValues(sensor)

Measurement              Latest Values              Units   Log Size
-------------  ----------------------------------  -------  --------
Acceleration         4.51       -3.30       -8.16  m/s^2    <1x3>
MagneticField   -3.56e-06   -2.49e-05    1.11e-05  Tesla    <2x3>
Orientation         27.08       27.14      -19.39  degrees  <2x3>

Waiting for: Latitude, Longitude, Altitude, and Speed.  More information.



Get specific measurements:

sensor.Orientation

ans =
20.6081   34.4375  -15.0781


The entry also comes with a MATLAB app that shows a live view of the data coming in, as well as an example of using the magnetic field information from the phone to rotate a 3D plot.

Learn more about these mobile supports from this page for Android and this page for iPhone/iPad.

Comments

Tell us about your applications using your mobile devices and MATLAB or leave a comment for the MathWorks Mobile Sensor Connectivity Team.

Published with MATLAB® R2013a

|

### 댓글

댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.