Introduction: #MyoCraft: Gesture-Enable Your Arduino Project With a Myo Armband

Picture of #MyoCraft: Gesture-Enable Your Arduino Project With a Myo Armband

You can build a lot of cool stuff with an Arduino. Wouldn't it be nice to be able to control it with a flick of your wrist?

Let me show you how to add wireless gesture control to an Arduino project using a Myo armband. We’ll do this via MyoDunio (available for free in the Myo Market) running on a PC. This sample was built to connect up to the display you see above, but it's definitely not specific to it, and you can use it to activate any pin on your board.

Let’s go!

Step 1: Requirements

Picture of Requirements

Before we get started, you’ll need the following items.

  1. A Myo armband running the latest firmware
  2. An Arduino board like the Uno
  3. The Arduino software/IDE
  4. A Windows PC
  5. An Arduino project you want to to gesture-enable. We hooked our board up to a bunch of LEDs. If you're not sure, something basic like this would probably work.
  6. The MyoDuino project. You will also need the Microsoft Visual C++ Runtime, if you don't already have that installed.

Step 2: Import Sample Library

Picture of Import Sample Library

Make sure you have extracted the MyoDuino project somewhere. Open up the Ardunio SDK and add the MyoDuino/Arduino/Myo Controller folder as a library.

Step 3: Open the Sample

Picture of Open the Sample

Import the MyoController example project.

Step 4: Set Up Your Arduino

Picture of Set Up Your Arduino

The sample is set up to use pins 4-8, with one pin for each hand pose (wave in, wave out, fist, fingers spread, and double tap). When a new pose is detected, that pin is set to HIGH. When the “rest” pose is detected (which generaly happens between every pose), all the pins are set to LOW. You can either make sure your project works with that setup or..

Step 5: (Optionally) Change the Sample

Picture of (Optionally) Change the Sample

(The above code is copyright 2014 Thalmic Labs Inc. and licensed under the MIT License)

If you don't like the pin activation scheme, change the sample. If you check out the code (attached) you will see it's pretty straightforward to change which pins are activated by which gesture. Just change the defines up top.

So

#define FIST_PIN 4

could be changed to

#define FIST_PIN 5

to make the 5th pin active on a fist.

All five Myo poses are supported. You can use as many or a few as needed.

Step 6: Upload Your Sketch

Picture of Upload Your Sketch

Upload the project to your Arduino via USB, and leave it connected.

Step 7: Launch MyoDuino

Picture of Launch MyoDuino

Make sure you are wearing your Myo armband, it's connected to your computer via Bluetooth, and your are synced. Then, navigate to MyoDuino/bin/ and launch MyoDuino.exe. Set the COM port to the one your Arduino is on (you can see this in Tools->Ports in the Arduino IDE). It’s up to you whether you want locking to be on or off, but I recommend off for our test.

Now you should be staring at a terminal window. It will tell you which arm you are wearing the armband on and the current gesture (for debugging purposes). Make sure this window is in the foreground, and start making poses!

Step 8: Next Steps

Picture of Next Steps

Easy peasy. This was a pretty simple hack, but it’s a good place to start.

From here, you could obviously go crazy with complicated Arduino setups, but you could also modify the source code of MyoDuino itself. The Myo Armband has a built in 9-axis IMU that normally captures arm motion, but isn't being used here. By expanding MyoDuino you could create motion gestures to really open up your control options.

You could also build your own pose “edge” behaviour, like you see in Myo Scripts (Meaning that you get one event when a pose is started, and another when one stops). As it stands this will keep setting the relevant pin to HIGH over and over as long as you hold a pose, which may not be ideal for your application.

Finally, if you want to enable casual usage you could tweak the locking behaviour so it won’t lock you out in the middle of a pose.

That's all beyond the scope of this guide though! If some of those ideas sound interesting to you, you can get started at http://www.myo.com/makers

Comments

tomatoskins (author)2015-03-10

That's awesome! Like you said at the beginning you can build anything with an Arduino!

kg18 (author)2017-01-21

Hi There,

Thanks a lot for this informative article. I followed the steps outlined and could get to Step 7, where I have to lauch MyDuino to connect to Uno on the COM port that Uno is running. Whenever I try and do this, I get an error "Serial Port Cannot be opened". Uno by itself is functioning fine and so does Myo. However, I am stuck on step 7 where the gestures from Myo are communicated to Uno. Please help.

ChamyM (author)2016-11-14

Usando la Librería puedo realizar cualquier programa?

Quiero mover unos servomotores.. alguien que me pueda ayudar?

quien me puede dar una idea o de mas

?

sheikh_jalal (author)2016-05-09

is there any gesture beside this 5 gesture that i could make with myoarmband?

wmi_mobile (author)2015-11-17

Hey, Paul.

A high-school myo-developer here.

While we(as a group) are trying to hook up a bluetooth module to our arduino uno board, we thought we might as well receive the signals straight from the arm band to our arduino board.

We tried many things, but couldn't really figure out what we might need to do in order to "make things happen."

Please help us with this matter, and if you have the time, could you help us with pairing our arm band with another bluetooth module?

Thanks - WMI

DanishA6 (author)2015-10-15

Are there any other guestures available?

Jaybuilder (author)2015-05-21

Works great! But I was wondering if there is a way to do this without the Arduino being connected to the computer directly. Maybe using a Bluetooth module on the Arduino to communicate with the Myo? Do you know where I could find info on how to do that?

The Myo Bluetooth protocol is published here: http://developerblog.myo.com/myo-bluetooth-spec-released/

As far as I know, no one has implemented it and released a library yet though. I don't think it would be that hard, but the big thing to watch out for is making sure your bluetooth module is actually able to operate as a BLE client. From what I've seen, a lot of BLE capable modules can only act as a host, and even if the hardware can do client the libraries provided by the vendor aren't quite there for client mode.

I'll keep that in mind thanks!

King717 (author)2015-03-11

Cost?

Paul Bernhardt (author)King7172015-03-11

The Myo armband costs $199 USD, and you can get it directly from Thalmic Labs or on Amazon.

CementTruck (author)2015-03-11

rock-paper-scissors-lizard-spock over the web

kbyrne5 (author)2015-03-10

Amazing! Imagine what this could do for the deaf community!

About This Instructable

27,283views

137favorites

License:

Bio: I'm a Developer Evangelist at Thalmic Labs! We make the Myo gesture control armband! My views are my own.
More by Paul Bernhardt:#MyoCraft: Gesture-Enable your Arduino Project with a Myo Armband
Add instructable to: