Using MyoWare: a low-cost surface electromyography sensor for developing rehabilitation devices (Tutorial)



Electromyography (EMG) is a method to evaluate motor unit action potential activity in a muscle region. As action potentials (electrical signals) propagate through nerves to neuromuscular junctions, the change in electrical potentials (voltage) can be measured. EMG is performed in the clinical setting to diagnose functional abnormalities of muscle; in this procedure, a needle electrode is inserted directly into a muscle to monitor an area smaller than 1 square millimeter.

Surface EMG is a non-invasive method of measuring muscle activity. Rather than using needle electrodes, conductive gel electrodes are placed on the skin to measure overall activity of a large region of muscle fibers. The voltage measured represents the amount of force a muscle (or group of muscles) is exerting in real-time. Surface EMG is commonly used in biomedical engineering applications to connect human muscles to the outside world, e.g. interfacing a residual limb with a myoelectric prosthesis, controlling a limb within virtual reality, and providing biofeedback for muscular pain.

While state-of-the-art neuroprosthetic limbs are quite expensive, prototype devices using surface EMG can be built quickly for minimal cost. In this article, I will explain how to setup a $38 MyoWare EMG sensor, send its data to an Arduino, and trigger actions using that data. No experience is required, though there are a few joints to solder.

Myoelectric prosthesis controlled by surface EMG of the forearm. touch bionics i-limb

Parts needed

One should budget approximately $100 to get started from scratch. All parts except the disposable electrodes can be re-used for other projects as well.

  • MyoWare : $38 sensor available on Amazon, Sparkfun, Adafruit.
  • Arduino Uno: $17 for a starter bundle with useful circuit parts like LEDs, and wires with header pins (durable rigid pins to connect into “headers” for quickly wiring up circuit prototypes).
  • Soldering iron, solder, flux: starter kits are available online. Adafruit has a good beginner’s guide to soldering. You can also ask a friend for help; this step only takes about five minutes.
  • 22-gauge wire (3-conductors): One cable running multiple conductors (such as RGB cables) is more convenient and looks cleaner than 3 individual wires. These will connect the MyoWare to the Arduino and should be a few feet long so the Arduino can rest on a desk or on a belt without straining the wire.
  • A computer: For writing code and transferring to Arduino via USB. Mac, Windows, or Linux will work and should have a similar experience.
  • EKG electrodes: There are a few brands to choose from, but the electrodes must have center nubs to snap into MyoWare receptacles. 3 electrodes are required per use.

What is MyoWare?

MyoWare surface EMG sensor, with quarter for size comparison

MyoWare is a small surface EMG sensor developed by Advancer Technologies as a Kickstarter project a few years ago. It automatically analyzes the incoming raw voltage signal and outputs a smooth positive waveform of integer values, as depicted by the graph below (more details are found in the MyoWare datasheet). The new version of MyoWare also outputs the raw voltage data for customized filtering and processing.

MyoWare processes raw EMG and outputs a smooth integer values. From MyoWare datasheet

What is Arduino?

Arduino is an open-source project that has designed a family of simple computers that provide an interface between sensors and control of physical devices. Because the schematics to design the products are open-source, other companies may freely reproduce the models as well. These unofficial devices are often cheaper and generally reliable. The Arduino “Uno” is a good starter model with a fair amount of inputs and outputs.

Arduino devices are programmed using a simplified version of the C language. A user writes code on a computer and transfers this code to the Arduino by USB. Then, the Arduino can be powered by USB or a battery without the need for a computer. The Arduino website has useful Getting Started Guide and Tutorials.


Diagram of MyoWare connections to Arduino Uno
  1. Browse through the MyoWare data sheet for helpful information about the sensor.
  2. Find the three holes on the edge of the MyoWare that are labeled (+),(-), and SIG (signal). Solder a 22-gauge wire to each hole. Solder the other ends to header pins (pins can be found in an Arduino starter kit).
  3. Connect the MyoWare’s (+) wire to the +5 output header on the Arduino and (–) to the Arduino GND (ground) header. Connect the signal wire to A0 on Arduino. Connect Arduino to the computer via USB cable.
  4. Download and install Arduino editor. Alternatively, use the web-based Arduino Create developer environment.

Arduino Code

Arduino programs are called sketches and have .ino file extensions. Create a new sketch (File -> New) to generate the code below. The lines starting with // are comments for humans and ignored by the computer.

void setup() {
// put your setup code here, to run when Arduino is powered on:
void loop() {
// put your main code here, to run repeatedly:

void setup(){} is a function (a set of instructions) that is run when the Arduino is powered on. void loop(){} is a function that repeats continuously, approximately once every millisecond though the rate depends on the complexity of the code. Your program instructions will run in here.

“void” just means the function does not return any value when it is run. You can think of C functions like math functions, e.g. f(x) = 2x. If I perform f(3) in pre-calculus class, the “return value” is 6. Below is how the same mathematical function would look in Arduino code.

int f(int x){    // first int means the function returns an integer 
return 2 * x; // end each statement with a semicolon
// run our function & assign result to the variable someMathProblem
int someMathProblem = f(3);
void printMathResult(){
println(someMathProblem); // prints out 6
printMathResult(); // this runs the function that prints 6.
// Notice we cannot assign the result to a variable,
// because the function returns void [nothing]

You do not need to add the f(x) and printMathResult() functions to your Arduino file; they are only included here as an explanation of functions.

3. Next, assign outbound pin #13 to a descriptive variable name. Define your voltageThreshold (MyoWare outputs data on a scale of 0–1023, so 400 is approximately 40% activity) These variables are defined outside of the setup and loop functions. In the setup() function, begin listening to the incoming data from MyoWare using Serial.begin(9600). 9600 represents the baud rate, or the number of 0’s and 1’s (bits) Arduino will transmit per second. We also setup pin #13 to be an output rather than input.

int onboardLED = 13; // Arduino onboard LED (pin 13) you can control
int voltageThreshold = 400; // any reading higher will trigger an action
void setup() {
// put your setup code here, to run when Arduino is powered on:
pinMode(onboardLED, OUTPUT);

4. Add programming logic code to run repeatedly in loop():

void loop() {
// put your main code here, to run repeatedly:
int currentVoltage = analogRead(A0); // store the incoming voltage
Serial.print(currentVoltage); // prints voltage to monitor
if(currentVoltage > voltageThreshold){
// trigger actions
Serial.println("CONTRACTION!"); // prints string + new line
digitalWrite(onboardLED, HIGH); //this sends 5V, turning on LED
} else {
Serial.println(""); // adds a new line
digitalWrite(onboardLED, LOW);
// turn off the light if threshold is not met

If the currentVoltage coming from MyoWare is greater than the voltageThreshold we previously defined, then do all the statements within the first curly braces { }. If the currentVoltage is anything else (numbers less than the threshold or no value at all), then run the statements in the curly braces within else { }.

Use the check button to build and compile the code. The right arrow uploads it to your Arduino.

5. Build and send the code to Arduino, which must be connected by USB at this point. If building fails due to an error, take a look at the message and line number and make sure there are no spelling mistakes or missing parentheses or semicolons in the code. Also click Tools -> Board: -> and make sure Arduino Uno is selected.

The complete sketch code is available for download on Github.

MyoWare monitoring flexor digitorum superficialis contraction

6. Attach the MyoWare to a muscle via electrodes. You may need to trim the electrode adhesive borders so they fit properly. The sensor works well over many muscles including paraspinals. Try recording the flexor digitorum superficialis or biceps brachii first.

7. Open Tools -> Serial Monitor in the Arduino coding application to see voltage readings streaming in.

Example of Serial data from MyoWare. Values will range from 0 to 1023.


You now have a system that monitors surface EMG sensor data, prints the data, and analyzes the data to trigger actions using programming logic. The onboard LED is a basic feedback mechanism to show how relatively simple it is to use MyoWare.

Further Applications

A more useful application would do something more with the data. Here are some ideas for actions to trigger:

  • Assign color LEDs to a color based on the voltage — for example “blue” for calm muscle, “red” for max activity, and some purple gradient in between those extremes. This tutorial can get you started.
  • Apply increasing voltage to cheap cell phone motors for vibrational feedback of the contraction
  • Write a python (programming language) script to listen to the MyoWare serial data incoming to your computer, and connect your device to the world — play a sound, send a tweet.
  • Using python, create a real-time graph of the MyoWare voltage data
  • Using python, save all the voltage data for a session, and do your analysis on the computer
  • Use multiple MyoWare sensors at once to build a more comprehensive sensor system. The Arduino Uno can accept 8 inputs and larger Arduinos e.g. Mega2560) The trick with using multiple sensors is to pass a unique prefix assigned to each sensor to each voltage message. Then the receiver can read through the data stream and distribute values to the correct channel.

In future articles, I will show how to build some of these projects. Leave a comment about which would be most helpful to you!

George Marzloff, MD is a third-year resident in the Department of Rehabilitation Medicine at the Icahn School of Medicine at Mount Sinai. His interests include developing low-cost devices to improve patients’ functional abilities and quality of life.



George Marzloff
Association of Academic Physiatrists News

Physician in Spinal Cord Injury & Physical Medicine and Rehab @ Rocky Mountain Regional VAMC, Colorado. Interests: Rehab Engineering & software development