Control anything using your muscles – How to build an EMG amplifier

Attention: I have since improved upon this circuit. Version 2 is covered here.

Introduction

If you are a Star Wars fan like me, you probably wish that the Force was real so you could manipulate objects without touching them. What if I told you that the Force actually did exist and you had the ability to control it? No, this Force isn’t controlled via your midi-chlorian count. And it’s not part of some ancient religion. So what force am I talking about? The muscular force!

Before you close the page, hear me out. When you contract your muscles, they generate electrical signals that can be measured by sensors placed on the surface of your skin. This is called electromyography (electrical-muscle-recording). By measuring these signals, you can wirelessly transmit this information to a robotic vehicle, for example, to control it’s speed or the direction it is heading.

deka_arm.jpg

A very cool and incredibly important application of this technology is allowing amputees to move robotic limbs using electrical signals generated by the remaining nerves in the stump or other muscles on their body.

In this post, I will present a low-cost circuit that will allow you to measure these electrical signals and use them to control whatever your imagination can come up with!

A Short Lesson on Physiology

512px-Basis_of_Membrane_Potential2.png
Synaptidude, via Wikimedia Commons

Electrical activity in your body is based on the concentration of ions inside and outside your cells. Ions have either a positive or negative charge depending upon where they lie on the periodic table. Your body is able to manipulate these ion concentrations to make work happen, such as contraction of a muscle fiber. When the ion concentrations change, this generates a changing electrical field. The field is extremely small, but the joint action of millions of cells acting together results in a detectable electrical potential. This potential can be detected by placing electrodes either inside the muscle belly or by placing electrodes on the skin above the muscle of interest. Since sticking a needle in your arm isn’t very fun, we will be using surface electrodes to measure these signals.

The amplitude of the generated bio-potential is proportional to the number of activated motor units. Rather than generating a binary signal (muscle relaxed/contracted), we can produce a signal proportional to the intensity of the muscle contraction. One caveat with this is muscle fatigue. Sustained flexion of a muscle will cause some motor units to fatigue, such that they no longer contribute to the overall potential. After several seconds, the EMG signal amplitude will start to decrease.

The actual mechanisms behind the contraction of muscles are extraordinarily complex. Since physiology wasn’t my favorite class, my gross over-simplifications are probably not quite correct. If you are interested in learning more about the details behind muscular contraction, Wikipedia has a nice overview.

The Electromyograph

We now turn our focus to the actual device, the electromyograph (EMG), that detects these electrical potentials. The signal characteristics are as follows

  • Frequency content: 25 Hz to several KHz
  • Signal Amplitude: 100 μV to 1 mV
  • Electrode Impedance: 200 to 5000 Ω (depending on electrode-electrolyte interface)

Our goal is to design an amplifier that can measure this signal. Since our intention isn’t to use the EMG for diagnostic purposes but rather to control some other device, the signal will need to be heavily filtered as well. Ideally, we would like the output of the amplifier to be a very smooth signal proportional to the intensity of the muscular contraction.

The Biopotential Amplifier

DISCLAIMER: Do not power this circuit using mains voltage. Be smart and use battery power only. A failure in a power supply connected to mains could result in severe electrocution or death. In addition, using battery power will drastically improve performance since mains voltage will couple into the amplifier circuitry.

Schematic.PNG

Above is a schematic of the EMG amplifier I designed. The design is based on an ECG amplifier design which can be found in Medical Instrumentation: Applications and Design, written by John G. Webster. I was lucky enough to take Biomedical Instrumentation with Professor Webster himself while I was a student at UW-Madison. Webster was one of the founding members of the field of biomedical instrumentation.

Back to the circuit! The EMG amplifier consists of four stages:

  1. Instrumentation Amplifier
  2. Bandpass Filter
  3. Full Wave Precision Rectifier
  4. Lowpass Filter

The instrumentation amplifier amplifies the differential voltage between the electrodes A and B. There is also a third electrode REF that ties the body to ground; REF should be placed on the body away from A and B. R4 controls the gain of the instrumentation amplifier while R7 controls the common-mode rejection; R7 should be adjusted to minimize the output when the muscle is not being contracted. R8 can be increased/decreased to increase/decrease the gain of the amplifier, respectively. However, having R8 too large may result in saturation of the op-amps due to the DC offset voltage being amplified too much. If more amplification is necessary, it is better to place a second amplifier after the bandpass filter.

The bandpass filter is used to simultaneously reject the DC offset voltage between the electrodes and filter out unwanted high-frequencies. The lower cutoff of the filter is set to τ = 1 MΩ × 0.1 μF = 100 ms (10 Hz) while the high cutoff is set to τ = 200 kΩ × 10 nF = 2 ms (500 Hz).

A full wave precision rectifier takes the absolute value of the output of the bandpass filter. An active rectifier was used instead of a passive diode rectifier to avoid any voltage drop across the diodes. A full wave rectifier was used instead of a half wave rectifier to preserve as much of the signal energy as possible.

Finally, a low pass filter is placed at the output of the full wave rectifier to obtain a smooth signal corresponding to the intensity of the muscular contraction.

Building the EMG Amplifier Circuit

DISCLAIMER: Do not power this circuit using mains voltage. Be smart and use battery power only. A failure in a power supply connected to mains could result in severe electrocution or death. In addition, using battery power will drastically improve performance since mains voltage will couple into the amplifier circuitry.

Below is a breadboard setup of the EMG amplifier. The red and black wires going out of the picture on the bottom left go to electrodes A and B. The REF electrode connection is not shown but would be connected to the ground rail. The orange wire going out of the picture on the right is the output of the circuit.img_0377

For specific parts, I used LM741 op-amps. The diodes used were 1N4148. It is important that the resistors used in the instrumentation amplifier stage are 1% tolerance or better to improve the CMRR. It is preferable to use an instrumentation amplifier IC rather than building one from three separate op-amps as better tolerances and part matching can be achieved and the part count is significantly less. I didn’t have any instrumentation amplifiers on hand and decent ones cost in excess of $10, so I decided to work with what I had in my parts bin.

For electrodes, I used the standard 3M™ Red Dot™ electrodes. I was able to buy a pack of 50 off Amazon for about $10. To connect the electrodes to the EMG amplifier circuitry, I found a cable that had snaps on one end for connecting to the electrodes and a stereo 3.5mm jack on the other end. A PCB-mount stereo jack allows the electrodes to be plugged directly into the breadboard. An important point is that twisting the lead wires of the electrodes will help somewhat to eliminate EM interference.

50-electrodes-rondes-3m-red-dot-2237_1
3M Red Dot electrode

EMG Amplifier Output

To demonstrate the EMG amplifier, I connected the output to an oscilloscope. I connected electrodes A and B to my forearm and the REF electrode to my shoulder. I squeezed an object for 1 second, rested 1 second, then squeezed again harder for 1 second.

The ‘2’ marker on the left hand side indicates the 0 V level. As you can see from the plot, the baseline is not at 0 V. This is due to the EMG amplifying the common-mode voltage. Adjustment to R7 is necessary to decrease this voltage to a minimal level. Any movement of the electrodes will result in a temporary shift in the electrode offset voltage, causing the baseline to shift temporarily.

img_0380_cropped
Timescale – 500 ms/div, Vertical Scale – 500 mV/div

Room for Improvement

A few readers may have noticed that I decided to implement most of the filtering in hardware rather than software. This was purely personal preference. Moving the filtering to software would drastically decrease the part count. The only real filtering that needs to be done is removing the DC offset after the instrumentation amplifier stage. The EMG signal would then need to be biased to Vcc/2 for interfacing with a microcontroller. The filtering and absolute value circuitry can then be implemented in software. Replacing the op-amps with an instrumentation amplifier IC and moving the filtering to software would reduce the part count from 28 to a handful of components!

Conclusion

In this post, I have presented a circuit that allows you to measure electrical signal generated by motor neurons. While building a medical grade EMG amplifier is an expensive and complicated device, a hobbyist-grade EMG amplifier can be built for less than $20 in parts. With this low-cost amplifier and some improvements on the design I presented, the possibilities for controlling your environment are only limited by your imagination!

References

Advertisements

One thought on “Control anything using your muscles – How to build an EMG amplifier

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s