Skip to main content

A package for receiving data from sensor-streaming phone apps.

Project description

PyPI

PhoneSensors

phonesensors is a Python package to aid with receiving various sensor data from phones in a quick and easy way. It is meant to be used in conjunction with the SensorStreamer app for Android devices, but support for any other app streaming sensor data over a TCP socket can be implemented with ease by subclassing the BaseParser in parsers.py.

How to install

pip install phonesensors

How to use

Open the SensorStreamer app and make it a TCP server emitting JSON packets on a port of your choice. Port 5000 is used for this example. Find out the IP address of your device (e.g. 192.168.1.1). The following code snippet will print the sensor data being streamed from your device:

from phonesensors import SensorStreamerClient, Apps
with SensorStreamerClient("192.168.1.1", 5000, Apps.SENSORSTREAMER) as client:
  for data in client:
    print(data)

Data format

data in the above example code snippet is a SensorDataCollection instance. You can obtain the specific sensor data by accessing its attributes. The sensor data and timestamps are returned as numpy arrays:

acceleration_values = packet.acc.values
acceleration_timestamps = packet.acc.timestamps
proximity_values = packet.prox.values
proximity_timestamps = packet.prox.timestamps

Data from different sources may have different number of elements due to differences in sampling frequency. For example, acceleration_values, a 3D vector, may have 4 samples and thus be a (4,3) array. While proximity_values, a 1D scalar, may only have one sample and thus be a (1,) array.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phonesensors-0.0.3.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

phonesensors-0.0.3-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file phonesensors-0.0.3.tar.gz.

File metadata

  • Download URL: phonesensors-0.0.3.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.5

File hashes

Hashes for phonesensors-0.0.3.tar.gz
Algorithm Hash digest
SHA256 1930d6494852c6ac0fde24320acc4e4f8d0e4e04519b2bf8875b07524e9eac33
MD5 c0027317a607674a1b41f2f620684a32
BLAKE2b-256 27ef1b7f04c0cc15ee53f4d70677bdfb67ec7254aa6babd253474778621205ae

See more details on using hashes here.

File details

Details for the file phonesensors-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for phonesensors-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 aaacf1badbc2f86755e1240b75fac8a29f53812fe11b872ae7dc1dd5c54f87c6
MD5 93d7d0b464b28e9590fbea9d10054b1b
BLAKE2b-256 222fa12e49868e41bce52ee2c7ef21dd45788eb1326ba6784a1259ef83f76ac7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page