Skip to main content

Study Watch Python SDK

The adi-study-watch provides an object-oriented interface for interacting with ADI's VSM study watch platform.

Installation

pip install adi-study-watch

Description

A user application can use the SDK to receive complete packets of bytes over a physical interface (USB or BLE) and decode it. The functionality is organized into applications, some of which own sensors, some own system-level functionality (i.e. file system), and while others own algorithms. The hierarchy of objects within the SDK mirrors the applications present on the device. Each application has its own object within the SDK hierarchy, which is used to interact with that application. A brief guide on using the SDK and few examples have been added below.

Firmware Setup

https://github.com/analogdevicesinc/study-watch-sdk/blob/main/firmware/Study_Watch_Firmware_Upgrade.pdf

Getting started with SDK

Import the adi-study-watch module into your application code

from adi_study_watch import SDK

Instantiate the SDK object by passing the com port number

sdk = SDK('COM28')

The application objects can be instantiated from the sdk object. In order to instantiate an application object, we'll have to pass a call-back function as an input argument which can be used to retrieve the data from the application object. Define a callback function as displayed below.

def adxl_cb(data):
    print(data)

Once the call-back function is defined, you can instantiate the application object as shown below.

adxl_app = sdk.get_adxl_application()
adxl_app.set_callback(adxl_cb)

Each application object has various methods that can be called by referring to the application. An example of retrieving the sensor status is shown below. Almost all method in an application returns result in a dict.

packet = adxl_app.get_sensor_status() # returns dict
print(packet)

Basic Example:

import time
from datetime import datetime
from adi_study_watch import SDK

# callback function to receive adxl data
def callback_data(data):
    sequence_number = data["payload"]["sequence_number"]
    for stream_data in data["payload"]["stream_data"]:
        dt_object = datetime.fromtimestamp(stream_data['timestamp'] / 1000)  # convert timestamp from ms to sec.
        print(f"seq :{sequence_number} timestamp: {dt_object} x,y,z :: ({stream_data['x']}, "
              f"{stream_data['y']}, {stream_data['z']})")


if __name__ == "__main__":
    sdk = SDK("COM4")
    application = sdk.get_adxl_application()
    application.set_callback(callback_data)

    # quickstart adxl stream
    application.start_sensor()
    application.enable_csv_logging("adxl.csv") # logging adxl data to csv file
    application.subscribe_stream()
    time.sleep(10)
    application.unsubscribe_stream()
    application.disable_csv_logging()
    application.stop_sensor()

All streams packet structure : https://analogdevicesinc.github.io/study-watch-sdk/python/_rst/adi_study_watch.core.packets.html#module-adi_study_watch.core.packets.stream_data_packets

Documentation : https://analogdevicesinc.github.io/study-watch-sdk/python

Examples : https://github.com/analogdevicesinc/study-watch-sdk/tree/main/python/samples

License : https://github.com/analogdevicesinc/study-watch-sdk/blob/main/LICENSE

Changelog https://github.com/analogdevicesinc/study-watch-sdk/blob/main/python/CHANGELOG.md

Metadata

Release files for adi-study-watch 4.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adi-study-watch 4.1.0
File Size Uploaded Provenance Actions
adi_study_watch-4.1.0.tar.gz 93.4 kB Without provenance Details for adi_study_watch-4.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for adi-study-watch 4.1.0
File Interpreter ABI Platform Actions
adi_study_watch-4.1.0-py3-none-any.whl Python 3 none any Details for adi_study_watch-4.1.0-py3-none-any.whl

Total release size: 276.1 kB

Release files / adi_study_watch-4.1.0.tar.gz

Download URL adi_study_watch-4.1.0.tar.gz
Size 93.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5d048d9a9e63feb9faa6e5db8e70006e955b19420ba1771f7d77c8bff9d27312
BLAKE2b-256 checksum
How to use checksums
ecff644b8c3edbfcca906e3b4c46554cdf5c43243792af10672278d8b83b1283
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.0

Release files / adi_study_watch-4.1.0-py3-none-any.whl

Download URL adi_study_watch-4.1.0-py3-none-any.whl
Size 182.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64dd8a4d5aefbfd711a2e191ab837c0387caa2da25772dc8cc517a77346b86d3
BLAKE2b-256 checksum
How to use checksums
e8cee8f07fa28e8e2a1419e7c6a546b722ce5c9c4654fc462890bebfb235b66d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.0

Security for adi-study-watch 4.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page