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 relative ease.

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 then print the sensor data packets being streamed from your device:

from phonesensors import SensorStreamerClient
with SensorStreamerClient("192.168.1.1", 5000) as client:
  for packet in client:
    print(packet)

packet is a SensorDataCollection instance. You can obtain the specific sensor data by accesing 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.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

phonesensors-0.0.2-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for phonesensors-0.0.2.tar.gz
Algorithm Hash digest
SHA256 b85cd9faa51d4cb9068f0dfad661b6868b9ac3174f281e44904f779ddd741e89
MD5 1f4e247fbf421442414fc85598a4387f
BLAKE2b-256 efd5152ee79cf05ee7525a565d5f9812621a9c1ca9f42703ba5f1a5f287d6263

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for phonesensors-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8a165a3a9ffb148473e4b3d06a3d1a8672436c54d0e520ff84d764439db123b2
MD5 37e6146ac9344a7e8510b65e7b655194
BLAKE2b-256 a83e3d73641bf57c3c1df77a9a3512a565128c93f0082d0d737b9e3d938352ec

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