Skip to content
 
 

Repository files navigation

dl-myo (Dongle-less Myo)

build status image size codecov python versions pypi version license

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); however, some services and characteristics differ for a uniform naming.

See myo/profile.py for more detail.

For further developments, see my project using this library: https://github.com/Interactions-HSG/MyoKTROS

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, instead of bluepy or pybluez
  • Stream EMG data (filtered/raw) and IMU data simultaneously using asyncio
  • A sample docker image provided -- runs just off the shelf

Platform Support

Linux Raspberry Pi macOS Windows

Install

To use the library in your own project, simply install it via pip:

pip install dl-myo

To run the examples in this repository, clone the code and install it locally in a virtual environment:

git clone https://github.com/iomz/dl-myo.git
cd dl-myo
python -m venv venv

# Activate the environment
# On Windows: venv\Scripts\activate
# On Linux/macOS: source venv/bin/activate

pip install .

Examples

sample_client.py

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.

python examples/sample_client.py

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

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

influxdb

The examples/influxdb/influx_client.py emits datapoints to be stored in InfluxDB. The docker-compose.yml lanches the required database for this by default.

docker compose up -d influxdb

then

python examples/influxdb/influx_client.py

Make use of the dashboard config examples/influxdb/myo.json.

influxdb

3D IMU Plotting

The myo_analysis/plot_imu_3d_myo.py script visualizes the real-time 3D orientation of the Myo Armband using matplotlib and quaternions. It uses multiprocessing to prevent the UI from blocking the Bluetooth asynchronous event loop.

python myo_analysis/plot_imu_3d_myo.py

Pong Game (Zero-Delay)

The examples/pong_myo.py is an interactive Pong game where you control the paddle using the Myo's gyroscope.

python examples/pong_myo.py

Try the example with Docker

NOTE: The docker example currently doesn't work on macOS or Windows (due to missing Bluetooth passthrough).

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

Build with Poetry

Install Poetry first.

poetry build

Credits

This project was first inspired by Dongleless-myo (originally created by @mamo91 and enhanced by @MyrikLD) which provides a great starting point using bluepy.

In addition to Myo Bluetooth Official Protocol, I would like to mention that the following resources on GitHub have been very helpful:

Author

@iomz (Iori Mizutani)

About

Yet another MyoConnect alternative without dongles

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages