Alvipe / Open-Myo

Python module to get data from a Myo armband using a generic BLE interface
GNU General Public License v3.0
24 stars 14 forks source link

The bluetooth failed during operation #3

Closed fengyanWang closed 6 years ago

fengyanWang commented 6 years ago

Hello, when I use your library to extract the original emg signal, the following question always appears. I don't know why. Hope to reply! thank you!

**> raise BTLEException(BTLEException.DISCONNECTED, "Device disconnected")

bluepy.btle.BTLEException: Device disconnected**

Alvipe commented 6 years ago

Hi @fengyanWang, are you using the Bluetooth dongle included with the Myo Armband or a generic BTLE antenna (such as this one)? This code only works with generic antennas; the dongle included with the Myo uses a proprietary protocol built upon the standard BTLE protocol.

fengyanWang commented 6 years ago

@Alvipe Thank you for your reply, I use is raspberry pie 3 b + on own bluetooth to directly communicate and myo, after multiple tests, find that as long as you keep the arm posture change range is not big, the equipment in the 30 s will probably into dormancy, and then disconnect bluetooth, my model has been set up never sleep mode, don't know the reason?

Alvipe commented 6 years ago

I am aware of this problem but I'm afraid that I still don't know what can be done to solve it. The command to put the Myo in "no sleep" mode is taken from the Myo Bluetooth protocol, just like the rest of the Open Myo code. It's weird because this is the only feature taken from the official protocol that doesn't work, so I don't know if its a problem of the Myo internal firmware or if it's a problem of my code.

Right now the trick is to shake the arm from time to time to prevent the device from falling asleep, which I know is not the best solution. I hope I can fix it at some point.

Alvipe commented 6 years ago

Hi @fengyanWang, I've merged the fix made by @qtux and it should work now without going to sleep and disconnecting. Please update your code with this fix and tell me if it works correctly now.

Alvipe commented 6 years ago

I finally have tested the fix made by @qtux and it works flawlessly, which means that this issue can be closed.