Typing With EMG Using MyoWare





Introduction: Typing With EMG Using MyoWare


L. Elizabeth Crawford & Dylan T. Vavra


In this tutorial, we are going to show you how to create a simple at-home electromyography (EMG) system - at the cost of about $100 - that will sense muscle activation from the surface of the skin and use it to send a keypress to a computer, bypassing the keyboard. We used a classic MaKey MaKey and a MyoWare sensor to accomplish this, along with a bit of coding. This project also requires some soldering. Useful tips for soldering technique and safety can be found here.

First, we will show you how to accomplish this using one MyoWare sensor. Then, we will show you how to add a second one to the system (for our purposes, we used two).

Our hope is that others will be able to mimic this DIY EMG technology, adapt it to their specific needs, and use it for any number of interesting applications. We used it in our Experimental Psychology lab at the University of Richmond to replicate research showing that people mimic others' facial expressions.

Step 1: Gather Your Materials.


  • Computer
  • MaKey MaKey with accompanying USB cable (you should be able to do this with an Arduino Leonardo as well, but we haven't tried it)
  • USB Power isolator (unless running off of a battery-powered laptop), such as the Adafruit USB Isolator - 100mA Isolated Low/Full Speed USB (not pictured)
  • MyoWare sensor(s)
  • Electrodes (x3 per MyoWare sensor) - we used Covidien Kendall Disposable Surface EMG/ECG/EKG Electrodes 1" (24 mm)
  • Breakaway headers (we used L-shaped headers)
  • Wires with male connector on one end, female on the other
  • Solder
  • Electrical tape


  • Soldering iron
  • Wire cutter
  • Wire splitter


  • Arduino IDE with MaKey MaKey addon

Step 2: Prepare the MyoWare Sensor.

1. Break off a set of three breakaway headers for soldering to the MyoWare.

2. With the MyoWare sensor positioned with the bicep face up, insert the shorter end of the three headers from below into the holes that have a "+" (plus sign", a "-" (negative sign), and "SIG" next to them. (See picture above.)

3. Solder the headers in place.

Step 3: Connect the MyoWare Sensor to the MaKey MaKey.

1. Pick three wires (ideally of different colors), male on one end, female on the other. The length of the wires you need depends on how far you want the MyoWare to be from the MaKey MaKey. To have the MyoWare on the face and the MaKey MaKey resting on a table, you'll need about 18 inches.

2. Decide which function the wire of each color will serve. One will be used for power (plugging into the + connector on the MyoWare sensor), one will be used for ground (plugging into the - connector on the MyoWare sensor), and the third will be used as the signal wire (plugging into the SIG connector on the MyoWare). In the pictures shown in this instructable, we're using green for power, brown for ground, and gray for signal.

Step 4: Upload Sketch to the MaKey MaKey.

1. Install Arduino IDE on your computer (Tutorial here).

2. Install the MaKey MaKey addon for Arduino (Tutorial here) by opening your Arduino preferences (File > Preferences), going to Additional Board Manager URLs text box, and pasting in:


3. In the Arduino IDE, click file, pull down to create a new sketch. Copy and paste this code into the text window:

/* thresholds for registering a key press*/
const int thresh1 = 1000;
/*assignment of inputs on MaKey MaKey*/
const int sensor1Pin = A3;
#include "Keyboard.h"
int LED (9);
void setup()
pinMode(LED, OUTPUT);
/*The code below samples the MyoWare every 50 ms, sends its value to the serial port, and if the value is above threshold, sends a keypress. You can sample more frequently by reducing the delay. This will make the values harder to read in the serial window.*/
void loop()
{ int sensor1Val = analogRead(sensor1Pin);
if(sensor1Val >= thresh1)
// Sends keypress of letter "c"
//wait 50 ms before sampling again
//wait 50 ms before sampling again

4. Connect the MaKey MaKey to your computer. Pull down the tools menu and make sure the selected board is Arduino Leonardo or MaKey MaKey. Pull down the tools menu to Port, and make sure the selected port has the name of your selected board. Upload your sketch to the board by clicking the right facing arrow at the top of the Arduino IDE.

Step 5: Connect All of Your Components Together.

1. Connect wires from the MyoWare sensor to the MaKey MaKey as follows:

  • The "+" on the MyoWare goes to the 5V slot on the MaKey MaKey.
  • The "-" on the MyoWare goes to the ground ("earth") on the MaKey MaKey.
  • The "SIG" on the MyoWare goes to the A3 slot on the MaKey MaKey.

2. Snap three electrodes to the MyoWare.

3. Plug in the MaKey MaKey. If using a computer connected to a power outlet, plug the MaKey MaKey into a USB power isolator and then plug that into the computer's USB port. (This is a safety precaution so that if something goes wrong with the power supply in your computer, the wearer is not directly connected to the electrical grid. It is unlikely that such a problem would occur, but we'd rather you be safe.) If using a laptop running off of a battery (i.e., NOT PLUGGED INTO THE WALL) you're safe without the isolator.

4. Check to see that everything is powered up. The MaKey MaKey red LED and the MyoWare green LED should both be lit.

5. Cleanse the skin where you want to attach the MyoWare with rubbing alcohol to remove dirt and oils.

6. Peel off the adhesive backing on the electrodes and attach the MyoWare to the skin. You want the two electrodes that are on the MyoWare to be on top of the muscle that you want to record from. The electrode attached to the wire serves as a comparison, and should be placed off of the muscle in an area that will not be active when the target muscle is contracted.

7. Check the adhesive on the electrodes to make sure you have a good seal to the skin. You may need to press the edges of the adhesive rings into the skin to get a good seal.

Step 6: Setting Thresholds in Arduino IDE

1. With everything connected and powered on, open the serial monitor in the Arduino IDE by clicking on the magnifying glass tool in the top right corner.

2. The serial monitor should now show the signal values from the MyoWare. As you flex and relax the muscle, you should see the values change accordingly. You should also see the red LED on the MyoWare light up when you contract the muscle hard enough.

3. While watching the serial monitor, contract the muscle with different intensities, being sure to relax in between contractions in order to get back to baseline. Determine a threshold value above which you want the contraction to produce a keypress. Higher values will require a stronger contraction to regist the keypress; lower values will make it more sensitive to small contractions but also more prone to false alarms.

4. In the Arduino sketch, change the threshold value (const int thresh1) from 1000 to your chosen threshold.

5. Close the serial monitor, re-upload the sketch, and start typing with EMG. You may find you need to readjust the threshold to get the sensitivity where you want it. You can also experiment with the delay so that it samples more or less frequently.

Step 7: Enjoy Using Your New Home-made EMG System!

You can place the electrodes in a multitude of places on the body (for instance, on the face, as our lab cyborg Kyle Lee depicts above).

Experiment with locations to put the electrodes and with the many possibilities of what you could use the keypresses to do.

Also, continue reading to learn how to add another MyoWare sensor to this system.

Step 8: Add a Second Sensor to Your EMG System.

1. Repeat Step 2 for a second MyoWare sensor.

2. To attach multiple sensors to one MaKey MaKey, you'll need a way to get power to each one. We did a bit of wire stripping, soldering, and taping to create a Y-shaped connector (see picture above), splitting the single output from the MaKey MaKey's power supply in to two wires that connect to the "+" power input on each of two MyoWares.

3. Connect the "SIG" slots on the MyoWare sensors to different A-slots on the right side of the MaKey MaKey (the code we provide below assumes you're using A3 and A4).

4. Upload the sketch for two sensors:

/* this sketch reads two MyoWare sensors signals and sends a keypress 'b' when one goes above threshold and 'c' when the other goes above threshold.*/
/* set thresholds*/
const int thresh1 = 1000;
const int thresh2 = 1000;
/*assignment of inputs on MaKey MaKey*/
const int sensor1Pin = A3;
const int sensor2Pin= A4;
#include "Keyboard.h"
int LED (9);
void setup()
pinMode(LED, OUTPUT);
void loop()
{ int sensor1Val = analogRead(sensor1Pin);
int sensor2Val = analogRead(sensor2Pin);
if(sensor1Val >= thresh1)
// Send keypress c
if(sensor2Val >= thresh2)
// Send keypress b
//wait 50 ms before sampling again

5. Now both muscle readings should be visible in the serial monitor. Set each threshold separately in the Arduino sketch, just as in Step 6, and then reload the sketch.

Now your EMG system will have two separate inputs!

If you get to feeling a little wild, you could follow similar procedures to add more MyoWare sensors to the system. If you get to feeling REALLY wild, you could even add another MaKey MaKey to the system. We encourage you to experiment with this design.



    • Microcontroller Contest

      Microcontroller Contest
    • Spotless Contest

      Spotless Contest
    • Science of Cooking

      Science of Cooking

    We have a be nice policy.
    Please be positive and constructive.




    Hey, great Project. I am about to build one for Therapeutic reasons for a Patient and stumbled upon your proj. Is there any specific reason you used the MaKeyMaKey instead of a Arduino?

    We happened to have a MaKey MaKey on hand, but you can use any Arduino that can send keypresses. This includes Leonardo or any other ATMega32u4 board, but not UNO. (See www.Arduino.cc/en/Reference/MouseKeyboard.) I'd love to see what you end up doing.

    ill let you know! thanks for your reply!

    ...just a k-4th technology teacher trying to stumble upon a fun/interesting makey makey project. And I stumbled upon *this*.


    -keep them coming.


    I've been (trying) to teach myself basic electronics and arduino/raspberry pi programming; just out of curiosity. ( via random books from Amazon and youtube videos )

    Got a rather decently stocked Raspberry pi starter-kit.

    Subscribbed to Hackerboxes* for two months to fill in the gaps with some really fun variables to work with. * Are you familiar with Hackerboxes? It's like Loot Crate. It's a monthly subscription service that sends you theme-based arduino projects, and such.

    So now. I have ALL these new toys to play with ( that are WELL beyond my skill set) and I have a head full of ideas... And I want my first build to be somewhat interesting and cool. Sure. I could turn a bunch of curious 4th graders on to coding leds to light up on command and such... But wouldn't it be cool to also be able to say, "yeah. But did you know that this little $20 device can also do 'T H I S' ?" ( and then control a LED screen, make a wifi connection, control and object or simple machine, make a simple game, make a sound, know the temperature, find objects with rfid and even be able to detect if YOU are there with sensors.) -and I am not just rambling about things that I could maybe do someday; no, a two month subscription of Hackerboxes has totally thrown all of these options into my lap. And my brain is in a bit of a whirl-wind at the moment.

    So. If there are any scary-smart people in here that might want to pitch a random thought about what they would do with any of those variables and 'toys', I would be grateful to here your thoughts. I'm not asking for schematics, ( Half the fun is figuring that part out ) .

    I am just fishing for ideas. A cool starting point. maybe a simple demonstration that might inspire a kiddo. *That one kiddo. A misfit-kiddo. A kiddo that has failed at everything else at school.

    Those misfit kiddos have unrecognized skills. Put them on fantasticcontraption.net or MinecraftEDU and they are ninjas! They think visually. And they are really good at making things. And their classroom teachers never notice, because it is not valued.

    I want to master basic electronics for those kids.

    They deserve a purpose.

    Someone in the know throw me a bone.

    I want to get this started, I just don't want to do it sloppy.

    Opps. I got off topic. My bad.

    how much does this cost?

    About $100. (Sorry -- should have included that. We'll update.)