Neural-Space / pewter

Data acquisition and visualization tool for Myo Armband
25 stars 10 forks source link

How to modify the sample rate of Myo? #5

Open RaphaelDuan opened 3 years ago

RaphaelDuan commented 3 years ago

Dear author,

I'm doing some research based on Myo Armband now. Pewter is powerful and well designed, but I was very confused about how to modify the default sample rate of the EMG signal. I tested it and I think the default sample rate was 200Hz, right?

Could you tell me where to modify the default sample rate? I can not find it. Thx so much.

mayorhao commented 1 year ago

Hi, @RaphaelDuan, Has you figured out how to set the sample rate? also, since the Thamlic is dead, could you share the Myo connect for the windows installer? Thanks a lot

david-olivier-cs commented 1 year ago

Hi @mayorhao I worked on a project using the myo a few years back. However, it's been years since I worked with this code.

Here is information that might be useful.

Digging through the myo.js (https://github.com/thalmiclabs/myo.js) file, which pewter uses to communicate with the myo, you can see that it uses a web socket to send commands to the armband.

Ex: Myo.socket.send(JSON.stringify(["command", { "command": "unlock", "myo": this.id, "type": "hold" }]));

Now, the myo.js file doesn't seem to be modifying the armband's output frequency. However, when looking at another project "myo-raw" (https://github.com/Alvipe/myo-raw), which communicates with the myo via Bluetooth and is implemented in Python, there is a line where the armband's output frequency is set :

https://github.com/Alvipe/myo-raw/blob/680775071d0dd4defb88b35f91d9122c0645eedb/myo_raw.py#L279

self.write_attr(0x19, pack('BBBBHBBBBB', 2, 9, 2, 1, C, emg_smooth, C // emg_hz, imu_hz, 0, 0))

Communicating with the myo via Bluetooth seems to allow finer configuration.