Skip to main content

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

Project description

License PyPI Flake8

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-1.0.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

phonesensors-1.0.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for phonesensors-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8c06899fd77ec92cbc40b6a561d0f6f66032892358126304b86dff85edcae595
MD5 937d2bfbd639b2bc2d5e9829f47cc6e9
BLAKE2b-256 c0ee2a6c51357a14bd7841509ddd7463bdc209ebfae09236dc82dc8fb1831b25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for phonesensors-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2dc2319e361e7a95a38ce0841a878349db3d40bac9b3beef276737903cf97fb
MD5 94dc938f07ef8508b9eedda1045d1dc8
BLAKE2b-256 883d0ed81c86187fe53343ced9170b101b696e0a475c9822e85c59b75821b4b9

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