Elemyo | Last update on 24 September 2025

Servo motor control with EMG sensor MYO v1.5

EMG Servo Motor control. Muscle control for robotic hand

In this overview, we will cover all the basic questions related to control by Electromyography (EMG) signals using sensor MYO v1.5.
The content of the overview:
What is EMG
Go to the section
How to control servo with EMG
Go to the section
Step-by-step servo control with MYO v1.5
Go to the section

1
What is EMG
EMG (electromyography) - is a method of detecting and recording the electrical activity (biopotentials) generated by muscles. One of the key characteristics of EMG signal is the signal amplitude. The EMG amplitude depend of many factors, but one of main is muscle contraction power. When a muscle is relaxed, the EMG amplitude is close to zero. As the muscle contracts, the amplitude increases with increasing of muscle contraction power. This relationship between muscle activity and EMG amplitude can be used to control external devices, for example simple servo motor or high-tech bionic prosthesis.
EMG and ECG signals registrated by sensors MYO v1.5

Fig. 1. EMG and ECG signals registrated by sensors MYO v1.5


2
How to control servo with EMG
For using the EMG signal for control, it is necessary to know the signal amplitude in real time. The raw EMG signal is a non-periodic signal with a typical bandwidth of 10-500 Hz (main energy in the range of 10-250 Hz). To calculate the non-periodic signal amplitude we can use, for example, peak-to-peak amplitude in certain time window. Or we can calculate the envelope of the signal and use its value as signal amplitude. In this review we will take the second approach.
The signal envelope is constructed as follows:
  • Filtration of the EMG signal by bandpass filter (type 10-500 Hz).
  • Rectification of the filtered EMG signal.
  • Calculation of the average value of the rectified and filtered EMG signal. To calculate the average value we can use a moving average method, for example exponential moving average.
Now we have the EMG signal amplitude and we can easily use it for servo control. The are several ways to control a servo using a single EMG sensor. The main is:
  • Direct motion control: the servo rotates proportional to the EMG amplitude.
  • Discrete: the servo angle programs by long/short muscle contractions. For example: single short muscle contraction rotator servo to min, but single long contraction rotate servo to max.
If you are using 2 EMG sensors, you can control the servo as follows:
  • While the flexor muscle contracts - the servo rotates to its max. While the extensor muscle contracts - the servo rotates to its min.

3
Step-by-step servo control with MYO v1.5
All you need is: Arduino board, EMG sensor MYO v1.5 and servo motor.
Required components for EMG Servo Motor Control

Fig. 2. Required components for EMG Servo Motor Control with Arduino

Software installing:
  • 1. Install Arduino IDE: https://www.arduino.cc/en/software
  • 2. Download the ELEMYO library from the official Elemyo GitHub page at: https://github.com/ELEMYO/Elemyo-library. To download, click on the "Code" menu (green) and select "Download ZIP".
  • 3. Launch the Arduino IDE program and install the ELEMYO library. To do this, go to the menu "Sketch -> Include Library -> Add .ZIP Library" and select the downloaded archive. Wait for the library to be installed and restart the Arduino IDE.
Connection to Arduino:
  • Connect the MYO v1.5 sensor and servo to the Arduino as shown in the figure.
Servo motor control with EMG sensor MYO v1.5 by Elemyo

Fig. 3: Connection to Arduino

Uploading servo control example:
  • After installing ELEMYO library and connecting the servo and MYO v1.5 to the Arduino all that remains is to upload the example from ELEMYO library to Arduino. We provide two examples for servo control:
  • 1. "Servo Motion Control.ino". This sketch allows you to control the servo motor continuously - the angle of rotation of the motor shaft is proportional to the degree of muscle tension. This example requires calibration: the maximum EMG amplitude needs to be changed for the maximum servo angle. Instructions are provided below.
  • 2. "Servo Discrete Control.ino". This sketch allows you to control the servo motor in the following way: single short contraction of the muscle will turn the servo to the minimum angle, and single long contraction will turn the servo to the maximum angle. This example requires calibration: the maximum EMG amplitude needs to be changed. Instructions are provided below.
Placing the sensor on the body:
  • To record muscle EMG signals the MYO v1.5 sensor must be placed on the skin over the muscle. The proper position of the sensor relative to the target muscle is shown on the figure below. The sensor should be positioned so that its long side is along the muscle fibers of the target muscle (to put it simply, along the body of the muscle).

    Proper position could have an effect on EMG signal quality, so it is important to consider which muscle is the target and place sensor according your choice.
Sensor placement for EMG sensor MYO v1.5 for proper muscle activity registration

Fig. 4. Proper positioning of the sensor, relative to the target muscle.

Calibration:
  • 1. "Servo Motion Control.ino". Upload the sketch to the Arduino controller and open "Tools" -> "Serial Monitor". You'll see two columns with current data: the first is the raw EMG data, the second is the EMG amplitude. Place the sensor on the muscle and contract it. While the muscle is contracting, get the value from the second column and write it value "EMG_MAX" at row 49 instead of 600.
  • 2. "Servo Discrete Control.ino". Upload the sketch "EMG_Simple_Read.ino" to the Arduino controller and open "Tools" -> "Serial Monitor". You'll see two columns with current data: the first is the raw EMG data, the second is the EMG amplitude. Place the sensor on the muscle and contract it. While the muscle is contracting, take the value from the second column and write half of that value to "THRESHOLD" value at row 49 instead of 200.
Testing:
  • 1. "Servo Motion Control.ino". Upload the sketch and open the Serial Plotter. Place the sensor on the skin under the muscle and begin contracting the muscle. In the Serial Plot, you'll see the amplitude increase and the servo begin to rotate.

    NOTE: Arduino IDE 2.*.* has a very short time window for the Serial Plot, making it difficult to observe the EMG signal. It is better to use Seria Plot from Arduino IDE 1.*.*
  • 2. "Servo Discrete Control.ino". Upload the sketch and open the Serial Monitor. Place the sensor on the skin under the muscle and begin contracting the muscle. During a short-term contraction (less than 0.5 seconds), the servo will rotate to its minimum angle, and you will see the line "Type 1 - short muscle contraction" in the serial monitor. During a long-term contraction (more than 0.5 seconds), the servo will rotate to its maximum angle, and you will see the line "Type 2 - long muscle contraction" in the serial monitor.

Thank you for reading.

If you have any questions - feel free to contact us via email: info@elemyo.com

Author: Elemyo