Skip to content
PerlinWarp edited this page Oct 20, 2021 · 6 revisions

Welcome to the pyomyo wiki!

Python Open-source Myo library (PyoMyo) is a driver made for the Thalmic Labs Myo that implements a Bluetooth protocol over Serial using the included dongle.

The Myo

An image of the Myo armband from the front.

The Myo is a consumer 8 channel armband capable of recording sEMG data at 200 Hz. The raw signal is digitised with an 8-bit analog-to-digital converter giving measurements from -128 to 127. This 8-bit signed data can be streamed directly (mode 0x03) or data can be filtered and then sent (mode 0x02). Data can also be rectified (by taking the absolute value) and filtered on the band and then streamed over Bluetooth Low Energy (BLE) at 50 Hz (mode 0x01).

The included BlueGiga BLE dongle (FCC ID 2ACKV-TLD1B) uses a virtual COM port to send BLE data without needing a BLE library, this helps to get cross platform BLE support which can be difficult otherwise.

In pyomyo:

  • emg_mode.PREPROCESSED (0x01) - 50Hz Sends 50Hz data that has been rectified and filtered, using a hidden 0x01 mode.

  • emg_mode.FILTERED (0x02) - 200Hz Alvipe added the ability to also get filtered non-rectified sEMG (thanks Alvipe).

  • emg_mode.RAW (0x03) - 200Hz
    This data is unrectified but scales from -128 and 127.

Pyomyo often uses the preprocessed 50Hz mode as the data is already filtered, see Neuro-Breakout/MyoEMGPreprocessing.ipynb for more detail.

Comparison to other libraries:

To interface with the Myo, Thalmic Labs provide Windows software that interfaces with the proprietary Bluetooth Dongle, which since 2018 can no longer be officially downloaded, but can be found online. However Thalmic Labs did release the BLE specification and many third-party libraries for using the Myo exist, each with different limitations.

Multiple libraries have been developed to interface with the Myo using Python. Judging by GitHub stars, currently the most popular are Dzhu’s myo-raw and Rosenstein’s Myo-Python with 188 and 178 stars respectively.

Myo-Python

Myo-Python is a Windows-only foreign function interface for calling the C code of the now unsupported official C library. Myo-Python was last updated in 2019.

Myo-Raw

Myo-raw is a Python 2 implementation that communicates over the Bluegiga BLED112 proprietary dongle using a virtual serial port. It claims to access the “raw” sEMG and IMU data collected by the Myo and supports Windows, Linux and macOS.

Pyo Myo

PyoMyo was originally forked from myo-raw with many useful additions from Alvipe added, these include a commands to read battery level, stop the Myo sleeping and change the colour of the LEDs.

Bug fixes for Myo-Raw:

  1. Stopped the Myo disconnecting after 30 seconds.
  2. Correctly handelled Bluetooth values to stop crashing.
  3. Refactored code to upgrade from Python2 to Python3.

Added Features:

  1. The ability to use all three of Myo's modes.
  2. Multithreading support.
  3. Windows + Linux support.
  4. Examples for multithreading, use with live plotting for matplotlib and pygame.