Developing the Internet of Things: Thalmic Labs Myo Gesture Control Armband
Hardware innovations are continuing to dissolve the boundaries between human and machine. Our bodies are being placed front and center as a new form of input within the Internet of Things. Emerging haptic technologies have applications that stretch across contextual wearable computer devices, human-computer interactions (HCI), entertainment, video games, virtual reality, industrial, military, and much more!
In todays post, learn how Appmethod gives your Connected Apps new reach with the Myo Gesture Control Armband. Find out how easy it is to get the C++ SDK provided by Thalmic Labs loaded into Appmethod and deployed as a Windows Connected App.
Gesture Control and the Internet of Things
What makes the Internet of Things such an anticipated frontier is not just the Gadgets and Devices or the applications they talk to, but rather the experiences created by the interplay between them. Things need to be categorized by their capability to create new forms of user experiences. Gesture, as a property of Things, enables a user to bridge the human computer interface with body in motion.
Designing Internet of Things driven experiences will become the next logical step following traditional multi-device based UX/UI design. What kind of new design restrictions need to be considered with dealing with gesture based input? What does it mean when your users can suddenly control your connected app by waving their hands around in free space?
The age of implemented Science Fiction is upon us and connected apps should transform users into superhero's.
Meet the Myo Gesture Control Armband from Thalmic Labs
The Myo Gesture Control Armband from Thalmic Labs enables the wearer to use natural arm movements and hand gestures to control and interact with Devices, Gadgets, and Connected Apps. The Myo is a sort of bracelet, worn just below the elbow, that interprets electrical signals produced by muscle contractions in the forearm. Eight banded segments containing electrical sensors measure the electrical signals traveling across the user's skin.
Making different kinds of fists creates unique muscle contractions in the forearm. These muscle contraction patterns are read by the Myo and are translated into specific commands. For example a closed fist is one state while pressing the pinky to the thumb is another. The Myo is currently capable of detecting the following fist patterns: wave left, wave right, spread fingers, closed fist, and thumb-to-pinky.
The Myo also has built in motion detection that tracks yaw, pitch and roll.
The Myo communicates over Bluetooth Smart 4.0 on Windows, Mac, Android and iOS. Thalmic Labs provides a USB dongle for platforms without built in Bluetooth Smart support.
Appmethod and the Myo SDK
An SDK (Software Development Kit) takes care of the low level processing and communication that occurs between the Thing and the Connected App. Leveraging an SDK makes it much more straight forward for developers to implement new experiences with a Gadgets or Device (AKA a Thing).
Not all Things have an SDK, but some do, like the Myo. It is provided by Thalmic Labs at their developer portal.
Combining the Myo SDK with Appmethod makes it possible to extend connected apps to process gesture input.
Hello Myo! A Sample Demo App Built with Appmethod
For this demo we will be building to the Windows 64-bit platform.
First head over to the Thalmic Labs Developer Portal download page and grab both the Connect for Windows and Windows SDK Beta.
If you haven't already done so, go download a free copy of Appmethod.
Setup the Myo SDK with Appmethod
- Start a new project:
File -> New -> Multi-Device Application - C++ -> Blank Application - Set the Target Platform to 64-bit Windows.
- Save the project.
- Build the project (shortcut key Alt+F9).
- Navigate to your Appmethod project folder on your local file system and open the /Win64/Debug folder.
- From the downloaded Myo SDK find /SDK/bin/myo64.dll and copy it into your Appmethod project /Win64/Debug folder.
- Copy the /SDK/include/myo folder from the Myo SDK into the root folder of the Appmethod project.
- Open a command prompt and navigate to your Appmethod project /Win64/Debug folder.
1mkexp myo64.a myo64.dll
- Add the generated myo64.a file to the Appmethod project:
Project -> Add to Project
navigate to /Win64/Debug and open Myo64.a
You made need to set Windows Explorer file type visibilty to Any file (*.*)
Build the Hello Myo Test Application
From the Tool Palette add a TMemo, TRectangle, and TTimer to the Thalmic Labs Myo API Refrence.
The Myo Gesture data will be traced out to the TMemo. The TRectangle will perform translations, scaling, and rotation based on gesture input. The Timer will be used to constantly poll the Myo for new data.
Open up the code view for the Appmethod projects main .cpp file. This is by default Unit1.cpp.
Add the following headers:
#define _USE_MATH_DEFINES #include <cmath> #include <iostream> #include <iomanip> #include <stdexcept> #include <string> #include <algorithm>
From the Myo SDK folder navigate to /SDK/samples and copy the DataCollector class (lines 17 to 125) from hello-myo.cpp to Unit1.cpp.
Change the DataCollector::print function as follows:
void print() { Form2->Memo1->Lines->Clear(); if ( onArm ) { Form2->Memo1->Lines->Add( String().sprintf(L"[ Arm: %c ]", ( whichArm == myo::armLeft ? 'L' : 'R' ) ) ); std::string poseString = currentPose.toString(); Form2->Memo1->Lines->Add( poseString.c_str() ); if ( poseString == "fist" ) { Form2->Rectangle1->Scale->X = 2; Form2->Rectangle1->Scale->Y = 2; } else { Form2->Rectangle1->Scale->X = 1; Form2->Rectangle1->Scale->Y = 1; } } Form2->Memo1->Lines->Add( String().sprintf( L"roll_w: %d", roll_w ) ); Form2->Memo1->Lines->Add( String().sprintf( L"pitch_w: %d", pitch_w ) ); Form2->Memo1->Lines->Add( String().sprintf( L"yaw_w: %d", yaw_w ) ); Form2->Rectangle1->RotationAngle = ( roll_w )*36; Form2->Rectangle1->Position->X -= ( yaw_w - 8 ); Form2->Rectangle1->Position->Y += ( pitch_w - 8 ); }
note: In my project the main form is Form2 but it may also be named Form1.
Next create global variables for the DataCollector and myo::hub
DataCollector collector; myo::Hub hub("com.example.hello-myo");
Define the applications point of entry using the TForm function as follows:
__fastcall TForm2::TForm2(TComponent* Owner) : TForm(Owner) { try { Memo1->Lines->Add( "Trying to find the Myo" ); hub.addListener( &collector ); Timer1->Enabled = true; } catch (const std::exception& e) { Memo1->Lines->Add( String().sprintf( L"Error connecting to Myo: %d", e.what() ) ); } }
Lastly, define the Timer event handler:
void __fastcall TForm2::Timer1Timer(TObject *Sender) { hub.run( 1000/20 ); collector.print(); }
For more information on the Myo Hub and what it does, check out the Thalmic Labs Myo API Refrence.
Before launching this test application ensure that the Myo is properly synced by using the My Connect for Windows application provided by Thalmic Labs on their downloads page.
More information about properly setting up and syncing the Myo can be found at the Thalmic Labs Getting Started Page.


I am trying to install AppMethod 1.4 to try out the myo gesture code, but it keeps asking for serial nunmber which I have not received. Kindly help.