Metadata-Version: 2.1
Name: dl-myo
Version: 1.0.2
Summary: Yet another MyoConnect alternative without dongles
License: GPLv3
Author: Iori Mizutani
Author-email: iomz@sazanka.io
Requires-Python: >=3.8,<4.0
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: bleak (>=0.20.2,<0.21.0)
Description-Content-Type: text/markdown

# dl-myo (Dongle-less Myo)

[![build status](https://github.com/iomz/dl-myo/workflows/build/badge.svg)](https://github.com/iomz/dl-myo/actions?query=workflow%3Abuild)
[![image size](https://ghcr-badge.egpl.dev/iomz/dl-myo/size?label=image%20size)](https://github.com/iomz/dl-myo/pkgs/container/dl-myo)
[![codecov](https://codecov.io/gh/iomz/dl-myo/branch/main/graph/badge.svg?token=7bC3Aa1XNN)](https://codecov.io/gh/iomz/dl-myo)
[![python versions](https://img.shields.io/pypi/pyversions/dl-myo.svg)](https://pypi.python.org/pypi/dl-myo)
[![pypi version](https://img.shields.io/pypi/v/dl-myo.svg)](https://pypi.python.org/pypi/dl-myo)
[![license](https://img.shields.io/pypi/l/dl-myo.svg)](https://pypi.python.org/pypi/dl-myo)

dl-myo is yet another MyoConnect alternative for Myo Armband without an official Myo dongle.

If you are fed up with the dongle and still want to use Myo anyway (in Python), this is the right stuff to grab.

The GATT service naming convention reflects the official BLE specification for Myo (i.e., [myohw.h](https://github.com/iomz/myo-bluetooth/blob/master/myohw.h)); however, some services and characteristics differ for a uniform naming.

See [`myo/profile.py`](https://github.com/iomz/dl-myo/blob/main/myo/profile.py) for more detail.

<!-- vim-markdown-toc GFM -->

- [Features](#features)
- [Platform Support](#platform-support)
- [Install](#install)
- [Example](#example)
  - [Try the example with Docker](#try-the-example-with-docker)
- [Build with Poetry](#build-with-poetry)
- [Credits](#credits)
- [Author](#author)

<!-- vim-markdown-toc -->

## Features

Compared to other Myo libraries/SDKs:

- Full-scratched in Python, no dependency from other runtime (e.g., the official cpp SDK)
- Multi-platform support based on [Bleak](https://github.com/hbldh/bleak), instead of bluepy or pybluez
- Stream EMG data (filtered/raw) and IMU data simultaneously using [asyncio](https://docs.python.org/3/library/asyncio.html)
- A sample docker image provided -- runs just off the shelf

## Platform Support

| Linux | Raspberry Pi | macOS | Windows |
| :---: | :----------: | :---: | :-----: |
|  ✅   |      ✅      |  ✅   |   ✅    |

## Install

```bash
pip install dl-myo
```

## Example

The script scans a Myo device, connect to the device, prints the GATT profile from the device, collect EMG data for 5 seconds, and then disconnect.

Any Myo Armband should have the service UUID `d5060001-a904-deb9-4748-2c7f4a124842`.

```bash
python examples/sample_client.py
```

Otherwise, you can also bind to a specific MAC address. For example,

```bash
python examples/sample_client.py --mac D2:3B:85:94:32:8E
```

### Try the example with Docker

```bash
docker compose pull
docker compose run --rm dl-myo
```

## Build with Poetry

Install [Poetry](https://python-poetry.org/) first.

```bash
poetry build
```

## Credits

This project was first inspired by [Dongleless-myo](https://github.com/iomz/Dongleless-myo) (originally created by [@mamo91](https://github.com/mamo91) and enhanced by [@MyrikLD](https://github.com/MyrikLD)) which provides a great starting point using bluepy.

In addition to [Myo Bluetooth Official Protocol](https://github.com/thalmiclabs/myo-bluetooth/), I would like to mention that the following resources on GitHub have been very helpful:

- https://github.com/Alvipe/Open-Myo/issues/5
- https://github.com/NiklasRosenstein/myo-python/releases/tag/v1.0.4
- https://github.com/PerlinWarp/Neuro-Breakout
- https://github.com/balandinodidonato/MyoToolkit/blob/master/Software%20for%20Thalmic's%20Myo%20armband.md
- https://github.com/cortinico/myonnaise
- https://github.com/dzhu/myo-raw
- https://github.com/exelban/myo-armband-nn
- https://github.com/francocruces/MioConnect
- https://github.com/hcilab/MyoStream

## Author

[@iomz](https://github.com/iomz) (Iori Mizutani)

