You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ESP32 Arduino library for connecting to a Myo armband via Bluetooth Low Energy (BLE).
Enables real-time streaming of EMG (electromyography) and IMU sensor data.
Features
BLE connection to Myo armband with auto-reconnect
Auto-scan by BLE name — no MAC address needed (myo myo;)
EMG data streaming (8 channels, 2 samples per notification packet)
IMU data parsing — Quaternion, Accelerometer, Gyroscope (int16 raw + scale factors)
Euler angles — Roll / Pitch / Yaw in degrees computed from quaternion
Sensor data (public members, updated by parse* methods)
int8_t emg[2][8]; // 2 samples x 8 channelsint16_t imu_quat[4]; // w, x, y, zint16_t imu_accel[3]; // x, y, zint16_t imu_gyro[3]; // x, y, z
MyoPose currentPose; // REST, FIST, WAVE_IN, WAVE_OUT, FINGERS_SPREAD, DOUBLE_TAPbool armSynced; // true after arm-sync gestureuint8_t arm; // 0 = right, 1 = left
Python Data Collector
collect_data.py receives labeled samples from the ESP32 and saves them to a CSV file.
pip install pyserial
python collect_data.py
Then in the Arduino Serial Monitor:
h — send CSV header (once at the start)
0–9 — record a sample with that label
s / m / l — vibrate for tactile feedback during recording
The script shows a live counter per label and prints ESP32 status messages (Pose:, Battery:, etc.) separately. Press Ctrl+C to stop and see the label distribution.
BLE UUIDs
Service
UUID
Control / Info / Command
d5060001-a904-deb9-4748-2c7f4a124842
IMU
d5060002-a904-deb9-4748-2c7f4a124842
Classifier / Pose
d5060003-a904-deb9-4748-2c7f4a124842
EMG
d5060005-a904-deb9-4748-2c7f4a124842
Battery (standard BLE)
0000180f-0000-1000-8000-00805f9b34fb
Changelog
2024 – Extensions (2)
BLE auto-scan by device name — myo myo; finds any Myo without knowing the MAC address
Unlock/lock commands — unlock() sends hold-unlock to prevent auto-lock during sessions
Arm sync state — parsePose() now handles all classifier events (sync, unsync, lock, unlock)
Euler angles — getEuler(roll, pitch, yaw) converts quaternion to degrees
Python data collector — collect_data.py saves labeled CSV samples automatically