Introduction: DIY Muscle Sensor / EMG Circuit for a Microcontroller

Measuring muscle activation via electric potential, referred to as electromyography (EMG) , has traditionally been used for medical research and diagnosis of neuromuscular disorders. However, with the advent of ever shrinking yet more powerful microcontrollers and integrated circuits, EMG circuits and sensors have found their way into prosthetics, robotics and other control systems. Yet, EMG systems remain expensive and mostly outside the grasp of modern hobbyist.

This instructable will teach you how to make your own muscle sensor / EMG circuit to incorporate into your next project. Use it to control video games, robot arms, exoskeletons, etc.

Click on the video below for a demonstrations on how to hook up and use your EMG circuit board!

You can now also purchase  EMG sensors, kits, cables and electrodes at www.AdvancerTechnologies.com!
Muscle Sensor Kit (now also on SparkFun)
Muscle Sensor Electrodes

Note: This sensor is not intended for use in the diagnosis of disease or other conditions, or in the cure, mitigation treatment, or prevention of disease, in a man or other animals.

About Advancer Technologies 
Advancer Technologies is a company devoted to developing innovative game-changing biomedical and biomechanical technologies and applied sciences. Additionally, Advancer Technologies promotes all forms of interest and learning into biomedical technologies. To help culture and educate future great minds and concepts in the field, they frequently post informative instructions on some of their technologies. For more information, please visit www.AdvancerTechnologies.com .

Step 1: Materials

Click on the links to go to where you can buy items/order free samples.

Circuit Chips
3x TL072 IC Chip - Free Samples
1x INA106 IC Chip - Free Samples

Cables and Electrodes
1x EMG Cables (set of 3)... Note: you could optionally connect the alligator clips directly to the electrodes.
3x EMG Electrodes

Power
2x 9V Battery
2x 9V battery clips

Capacitors
• 2x 1.0 uF Tant
• 1x 0.01 uF Ceramic Disc
• 1x 1.0 uF Ceramic Disc

Resistors
• 3x 150 kOhm 1%
• 2x 1 MOhm 1%
• 2x 80.6 kOhm 1% (Note: You don't need exactly 80.6k resistors. Anything around 80k should suffice. Our MyoWare sensor uses 82k resistors for example.)

• 6x 10 kOhm 1%
• 1x 100 kOhm Trimmer
• 1x 1 kOhm 1%

Misc
• 2x 1N4148 Diode
Jumper wires
• 3x Alligator clip cables

Optional
• 1x Oscilloscope
• 1x Multimeter

Step 2: POWER SUPPLY

To start things off, you’ll need both a positive and negative voltage power supply. We will make these using two 9V batteries.

Now, everyone knows what a positive voltage power supply is, (e.g. common battery) but how do you go about making a negative voltage power supply?

Common electrical circuit rule of thumb is when you connect two batteries in series (eg positive terminal of battery 1 connected to the negative terminal of battery 2) then measure the voltage from the negative terminal of battery 1 and the positive terminal of battery 2, the measured voltage is equal to the summation of the voltages of battery 1 and battery 2.

For this circuit we want a +9V and a -9V power supplies. If we connect our two 9V batteries in series, we will get a power supply of +18V. So how do we get the -9V from these two?

It might help to think about what voltage actually means… voltage is an electrical potential difference. The keyword here is difference. Voltages are only meaningful in terms of the reference point (or more commonly referred to as ground). A voltage is the electrical potential between this reference point and the point you are measuring. Do you see the answer yet?

We do indeed get a +18V voltage reading if we use battery 1’s negative terminal as the reference point… but what if we choose the connection between battery 1’s positive terminal and battery 2’s negative terminal? If we use this point as our reference or ground, then battery 2’s positive terminals voltage will be +9V and battery 1’s negative terminal will be -9V!

Using your breadboard, 9V batteries and battery clips, connect the battery clip wires as shown. However, for the time being, disconnect the positive terminal of battery 2 and the negative terminal of battery 1. It is good practice to always disconnect your power while you assemble a circuit. At the end of the assembly we will reconnect these wires to power the circuit on. (You could also add switches to do this)


 

Step 3: SIGNAL ACQUISITION

Next, we will work on the signal acquisition phase of your EMG circuit which we will use to measure your body’s nervous system’s electrical impulses used to activate muscle fibers.

First, get out your INA106 IC chip (chip A) and insert it into your breadboard as illustrated above. The INA106 is a difference amplifier which will measure and amplify (G=110) the very small voltage differences between the two electrodes you place on your muscle.

Next, grab two 1 M ohm resistors, bend them and then plug them in to your breadboard like the two examples shown. One should connect pins 5 and 6 and the other should bridge pin 1 to your ground rail of your board.

Don’t worry about the other pins of the INA106 for now; we’ll come back to those later.

Step 4: SIGNAL CONDITIONING - Amplification

In this phase, we’re going to take those very small signals measured in the SIGNAL ACQUISITION phase and amplify them.

Let’s start first with two series of amplification; the first will be inverting amplifier with a gain of -15. An inverting amplifier does exactly what it sounds like. It amplifies your signal but also inverts it. You can find more info about inverting amplifiers here

We are going to first build an inverting amplifier with a gain of -15. To do this, we’ll need one of the TL072 chips (chip B), one 150 kOhm resistor and a 10 kOhm resistor. 

Place chip B as the picture indicates. Now use a jumper wire and connect pin 6 of chip A two rows past pin 8 of chip A. Grab one of the 10 kOhm resistors and plug one pin into this row as well. Connect the other pin to pin 6 of chip B. Bend a 150 kOhm resistor and connect one pin to chip B’s pin 6 and the other to pin 7. You can calculate the gain by G=-R2/R1 or in this case G=-150 kOhm / 10 kOhm. (See image 1)

Next, we are going to add a capacitor to AC couple the signal. AC coupling is useful in removing DC error offset in a signal. Read more about AC and DC coupling here

Continuing on, we are going to add an active high pass filter to get rid of any DC offset and low frequency noise. To do this you will need two 150 kOhm resistors and a 0.01uF capacitor. Use a jumper wire and the 0.01 uF capacitor to bridge the center gab of your breadboard as shown. (One end of the jumper wire should be connected to pin 7 of chip B). The 150 kOhm resistor will connect the capacitor you just placed to pin 2 of chip B. Now, bend the 150 kOhm resistor and push it into connect pins 1 & 2. (See image 2)

Also, go ahead and connect chip B’s pin 4 to your -9V rail, pin 8 to your +9V rail, and pins 3 & 5 to your GND rail.

 

Step 5: SIGNAL CONDITIONING - Rectification

In this phase, we will be rectifying the signal using an active full-wave rectifier . Our rectifier will take the negative portion of our signal and turn it positive so the entire signal falls within the positive voltage region. We will use this coupled with a low pass filter to turn our AC signal in to a DC voltage; readying the signal to be passed to a microcontroller.

You will need five of the 10 kOhm resistors, both 1N4148 diodes, and a second TL072 chip. Warning… this will be the most difficult phase to assemble! Pay close attention to the pictures!

First, plug in a TL072 chip (chip C) and connect -9V rail to pin 4, the +9V rail to pin 8 and GND to pin 3, as shown in the first image.

Next, place a 10 kOhm resistor (let’s call it resistor A) connecting pin 1 of the TL072 chip from the amplification phase and plug the other end into the row next to the 0.01uF capacitor’s row. Use a jumper wire to connect this row to pin 2 of the second TL072 chip. The next 10 kOhm resistor we’ll call resistor B. Resistor B’s first pin should be plugged into the row where resistor A’s second pin is plugged in and resistor B’s other pin should be plugged into the row two down. Another 10 kOhm resistor’s (resistor C) first pin should be plugged into the row where resistor A’s second pin terminated (same as resistor B) but the other pin should be plugged into the next immediate row over. (See image #2)

Now get out the two 1N4148 diodes. Diodes are polarized so be sure to pay attention what direction you plug them in! We’ll call these diodes A and B. Plug diode A’s positive end (end with black strip) into pin 1 of chip C and plug the negative end into the row of resistor C’s second pin. Get diode B and plug the NEGATIVE end into pin 1 of chip c and plug the POSITIVE end into the row of resistor B’s second pin. (See image #3)

Next, use two jumper wires to bridge the center gap for resistor C and B’s rows. Use another jumper wire to connect the jumper wire’s row connected to resistor B’s row to pin 5 of chip C. Use another 10 kOhm resistor to connect the jumper wire’s row connected to resistor C’s row to pin 6 of chip C. Finally, use the last 10 kOhm resistor to connect chip C’s pins 6 and 7. (See image #4).

Phew… that is for the rectifying phase! Next is the filter phase.
 

Step 6: SIGNAL CONDITIONING - Smoothing + Amplification

In this last phase of circuit assembly, we will be using an active low-pass filter to filter out the humps of our signal to produce a smooth signal for our microcontroller.

You will need the last TL072 chip (chip D), the two 80.8 kOhm resistors, the 100 kOhm trimmer, the 1 kOhm resistor and the 1.0 uF ceramic disc capacitor.

First, plug in chip D and connect +9V to pin 8, -9V to pin 4, and GND to pins 3 & 5. (image #1).

Now, grab one of the 80.6 kOhm resistors and connect one end to chip C’s pin 7. Connect the other end to chip D’s pin 6. Next grab the other 80.6 kOhm resistor use it to connect chip D’s pin 6 and 7. Do the same thing for the 1.0 uF capacitor. (image #2)

That’s the end of the filter circuit. However, since this is an active filter, there is a side effect of inverting the signal. We will need to invert the signal one more time (and have the ability to amplify it more if desired) using another inverting amplifier circuit with a trimmer configured as a variable resistor.

Use a jumper wire, connected to chip D’s pin 7, and the 1 kOhm resistor to bridge the board’s center gap. Use another jumper wire and connect the 1 kOhm resistor to chip D’s pin 2. Next, place the trimmer one row over with the pins laid out and a jumper wire connecting two of the pins as pictured. Finally, place the last two jumper wires as indicated. (image #3)

By using a screw driver and turning the trimmer, you will be able to adjust the gain of your signal to account for different signal strengths from different muscle groups. Start out with it set pretty low and go up from there (~20 kOhms).

Step 7: Circuit Review

(Optional) If you have an oscilloscope and a wave generator handy, now would be a good time to step through the circuit and test each phase.

If you do not have an oscilloscope handy, go back and review your circuit connections step by step to make sure you have place each component correctly. Pay close attention to the power pins and connections of your chips. If you have these incorrect, you could burn out your chips!

Step 8: Electrode Cables

Next, you'll need to make some changes to the EMG electrode cables since I have been unable to find a vendor who sells the cable's style DIN connector's female compliment.  (if any one has a suggestion please let me know!)

Grab a pair of scissors, wire cutters, wire strippers, pocket knife, etc.... basically anything sharp and strip about a 1/4" of the end of the DIN plug on all three cables (the plug end not the snap end).

Next, clip an alligator cable to each of the wires. We will use these to connect the electrode cables to our breadboard with some jumper wire. You could do as I have done and strip the wire and then solder on terminal pins but it is not necessary and the alligator clips will do fine.

Step 9: Surface Electrodes

For the electrode placement, you will need three surface electrodes.

After determining which muscle group you want to target (for example I will be using my right bicep) and cleaning the skin thoroughly, place one electrode on your skin above the middle of the length of the desired muscle. Let's call this the mid muscle electrode.

Next, place a second electrode at one end of the muscle. We'll call this the end muscle electrode.

Last, place the third electrode on a bony part of your body nearby the muscle group. We'll call this the reference electrode. For example, for the biceps, I am placing the reference electrode on the bony end of my forearm close to my elbow.

Using the snap connections of the electrode cables, snap each cable to each electrode. Make a mental note of which color cable is attached to which electrode.

Step 10: Connecting Electrode Cables

Now you are ready to connect your electrode cables to your circuit. Remember those pins on chip A that we put aside till later?

Connect the reference electrode to the GND rail of your circuit.
Connect the mid muscle electrode to chip A's pin 2
Connect the end electrode to chip A's pin 3

Lastly, we need to add some circuit protection via capacitors. Tanthium capacitors are polarized like the diodes we used earlier. These are easier to tell which is the positive pin and negative pin since one is always marked with a + sign indicating positive pin. Connect one 1.0 uF tant. capacitor between the +9V rail and GND rail, with the positive end connected to the +9V rail. Connect the other 1.0 uF capacitor to the -9V and GND rails, with the positive end connected to the GND rail.

Now you'll ready to power on your circuit!

Step 11: Connecting to a Microcontroller

Before connect your circuit to your microcontroller, you should power on your circuit (by connecting the battery wire's we disconnected earlier) and check the output voltage with a multimeter to make sure it is within your microcontroller's analog input pin's tolerances. To do this, connect the negative multimeter probe to your GND rail and connect the positive probe to pin 1 of chip D. Make sure the voltage measured is less than the max voltage of your input pin!

If you've done that check and everything thing looks fine, use jumper wires to connect pin 1 of chip D to an analog input pin of your microcontroller and your GND rail to the GND pin of your microcontroller.

Congratulations you're done!

Step 12: Arduino Demo

For this demo, we used an Arduino Duemilanove microcontroller hooked up to a PC running Processing visualization software. 

Remember to visit us at www.AdvancerTechnologies.com for kits and fully assembled sensors!

Step 13: EMG Circuit Schematic

Click the i box in the top left to see a larger version... or go to our website and click on the EMG schematic image .

Comments

author
FLIPPtronics made it!(author)2016-04-27

How much do the meterials fot this cost in total? Is it cheaper than the pre-build myoware muscle sensors?

author
Gundanium made it!(author)2016-04-28
Well it's not really apples to apples. The MyoWare sensor uses much more advanced circuitry, has built in protection against burning out the ICs, can be powered directly by an Arduino, and the embedded snaps eliminate cables. Electrode cables alone for this tutorial will cost you $5-15 depending on where you order it from. The electrical components cost about $20 from Digikey. However, it would cost you way more to build your own MyoWare than it is to purchase it. That's one reason we started selling the fully assembled versions instead of the kits with just the components packaged together... we were able to get the price of the fully assembled sensors well below the cost of the the component kits. 

So my two cents is...
  • If you want to explore how an EMG circuit works and intend on tweaking/playing around with the internal circuitry, then you would probably want to build your own using this tutorial.
  • If you just want a reliable sensor that requires little to no setup and you are more interested in its applications than the circuitry itself, you're much better off purchasing the MyoWare.
author
deselwa made it!(author)2016-11-15

hello sir

can i use electrolyte 1 uf 50v capacitor instead of tantalum and ceramic disk capacitor because in our country 1 uf tantalum and ceramic disk capacitor are not available.plz sir reply me fast

author
Gundanium made it!(author)2017-02-02

Yes

author
Rom%C3%A1nV1 made it!(author)2014-12-05

what programs and code for arduino you used for the data acquisition and the visual representation of the emg signals?, thanks for your time and for your project (:

author
Gundanium made it!(author)2014-12-08

Hi The sample code can be found on our website: http://www.advancertechnologies.com/p/muscle-sensor-v3.html

author
pedromogli made it!(author)2017-06-27

What I would like to know about calculations, is how you set the values for the resistors and capacitors. I am trying to do an analysis of this more detailed project to understand in depth, but I do not know how you found values for the other components.

author
MarcoP142 made it!(author)2017-06-06

Hi,

I tried your circuit, but this what I get on arduino serial plotter either connect or not to the subject.

error.pngerror2.png
author
Gundanium made it!(author)2017-06-07

There's a bug some where in your circuit; I'd step through each phase of the circuit and verify it outputs what you're expecting. That will help narrow down where it might be.

author
MarcoP142 made it!(author)2017-06-09

Now I'm getting a straight line

erro3.png
author
AhsanM18 made it!(author)2017-05-28

Sir, thanks very much, it helps a lot. I've made it, but having a confusion with its power supply, I've battery pack of 22.2 volts (I have an arduino and a solenoid to power up.) and would be using 7809 voltage regulator for straight 9 volts(POSITIVE). Now is it compulsory to have Negative 9 volts to the other power rail? If so, then what should I do? Other than the 7909 negative voltage regulator, because it is not available any where around. Kindly guide me, It'd help a lot.

18788503_1662870990420319_1405144382_n.jpg
author
Gundanium made it!(author)2017-06-07

Yes you need a negative power supply as this circuit design requires dual polarity power. An easy way to create a dual polarity supply is to put two batteries together in a series and use the connection between the two as your ground. Voltage is always relative so if you have two 9V batteries in series and define "ground" as +9V then +18V would be +9V relative to the 9V ground and 0V would be -9V relative to the 9V ground. This is called a virtual ground. You'll need to utilize something similar for your system.

author
MarcoP142 made it!(author)2017-06-06

Hi,

I tried your circuit, but this what I get on arduino serial plotter either connect or not to the subject.

error.pngerror2.png
author
pedromogli made it!(author)2017-05-22

Could you provide all the calculations necessary for the development of this circuit?

author
Gundanium made it!(author)2017-05-23

Hi! Most of the calculations should already be explained in the tutorial. Is there a specific part where you need clarification?

author
YousriG made it!(author)2017-05-10

can you please give me what is the maximum amplitude in volt of the real signal ?

author
bobolgb made it!(author)2017-04-21

would you send me the bom regarding myoware sensor

author
bobolgb made it!(author)2017-04-21

this one as the attachment,

WeChat Image_20170421173107.jpg
author
bobolgb made it!(author)2017-04-21

hi,Gundanium, I have the myoware sensor but I donot know the ICS on board, would you tell me the ICS part number? thank you very much

author
anj555 made it!(author)2017-04-16

This is a really good instructable with amazing information. I have one particular doubt that has been bugging me ever since I read this post though, and I would be really grateful for any clarification. From the EMG circuit Schematic given in step 13, we can see that the second op amp is used as a high pass filter with a cut- off frequency at 106.16 Hz and the fifth op- amp serves as a low pass filter with a cut- off at 1.98 Hz. Just wanted to know how this was physically possible. And if I am wrong about my earlier interpretation please do correct me.

author
tahmasbi made it!(author)2017-04-12

Hi

can i use AD620 instead of INA106 ??!

author
aparraro made it!(author)2017-03-20

What happened with the high pass filter at the end of the circuit? You show 5 tl0 in the schematic.

author
manu77 made it!(author)2017-03-16

Hi, I have trouble understanding the last part of the cirucuit. It is said that a low-pass filter is used in order to smooth the signal and to get rid of the humps which seems weird to me. Could you explain that to me please?

author
Gundanium made it!(author)2017-03-16

It's actually an integration circuit in this context. It integrates the rectified EMG signal to produced the EMG envelope

author
manu77 made it!(author)2017-03-20

Can an integration circuit behave like an envelope detector?

author
amr.saber45 made it!(author)2016-04-22

Hello

It's amazing what you done

It's open the way to alot of projects to be established

Thanks alot for you and your team

By the way

Please, I want the circuit if I used the ad620 instead of ina106

Cause I haven't any about electronics and I can't find ina106 in my country

Thanks alot again .

author
Gundanium made it!(author)2016-04-30

Hi, I would encourage you to try to figure this out on your own first. It shouldn't be too difficult to puzzle out if you read through the AD620 datasheet.

author
amr.saber45 made it!(author)2016-05-04

It's complicated :(
i haven't any knowledge

author
amr.saber45 made it!(author)2016-05-05

the legs are different

AD620-fbl.pngina.jpg
author
tjk353 made it!(author)2016-05-30

i figured it out bro

i think this is right

i am probably wrong

author
tjk353 made it!(author)2016-05-30

this is what i have done with the AD620 ic

Untitled4.png
author
Gundanium made it!(author)2017-03-06

Those battery connections are incorrect. Also, you've set Rg to 10kOhm which gives you a gain of 5.94 (49.4/10+1 = 5.94). The INA106 in this configuration has a gain of 110. If you want the same gain, you'll need to set Rg to 453 Ohms instead of 10 kOhms.

power.PNG
author
forgedimension3d made it!(author)2017-03-05

i also want to use ad620 instead of ina106, as i cant find one.

i have figured out all of the pins except pin 5 of ina. which pin would it be connected to if i were to use ad instead of ina?

author
Gundanium made it!(author)2017-03-06

Pin 5 of the INA106 isn't used in this configuration.

author
AndreasH62 made it!(author)2017-02-27

when using 2 batteries of 9V i get around -6 Volts at the output.
When i use only one battery of 9V i get around +3 Volts at the output! What could be the problem with the two batteries?

author
yunuse4 made it!(author)2017-02-21

And u used 1uF and 80.6k .l calculated f is 1.9746Hz but its must be 10-500Hz low-hıgh past filter isnt it ? why did u use 1uf and 80.6k ?

author
Gundanium made it!(author)2017-02-23

You're looking at this from the wrong angle. The 10-500Hz range applies to the raw EMG signal not a rectified signal. This "filter" is actually a simple integration circuit. This is what converts the rectified EMG to the EMG envelope.

6e5c4af6fce2c4ee606537008121512d_original.png
author
yunuse4 made it!(author)2017-02-24

ok Thank u very much.

author
Uzair+Hassan made it!(author)2017-02-24

can i Build Electrooculography (EOG) sensor using this circuit

author
yunuse4 made it!(author)2017-02-21

Hello

What is the total gain ? and I want to use +-12V is there any problem ?

Thank u

author
NilutpalB made it!(author)2017-02-21

Sir, can i use 1uf 63v electrolytic capacitor in place of the 1uf 50v
ceramic capacitor? If yes then how will i know which terminal needs to
be connected to which pin?

author
SiddharthG16 made it!(author)2017-02-02

Thanks a lot for the tutorial. Was able to
make this and the output is pretty much same as myoware sensor kit. In
India it cost me about 2K. The output voltage to uC is still about 3.8V
but adjusting the input voltage takes care of it. I suggest adding a
trimmer with your batteries to get the +/- voltage and start with a low
voltage (like 10V instead of 18) since it makes it a lot safer with
these expensive parts. (Check bottom part of circuit in attached image)

Nice instructions.

IMG_20170202_184530224.jpgIMG_20170202_184528102.jpg
author
NilutpalB made it!(author)2017-02-02

Hey bro from where did you ordered the 80.6k ohm resistor? i couldn't find them anywhere

author
SiddharthG16 made it!(author)2017-02-02

If you are in India, digikey might not help. I used kitsnspares.com for most of the stuff. However there are few components like 80.6k resistor which are not available anywhere for retail. So i had to order them directly from element14 (kitsnspares' parent site). I ordered 50 pieces (that was the minimum for wholesale order).

author
Gundanium made it!(author)2017-02-02

I should mention that you don't need exactly 80.6k resistors. Anything around 80k should suffice. The MyoWare uses 82k resistors for example.

author
NilutpalB made it!(author)2017-02-21

sir can i use 1uf 63v electrolytic capacitor in place of the 1uf 50v ceramic capacitor? If yes then how will i know which terminal needs to be connected to which pin?

author
NilutpalB made it!(author)2017-02-03

Good to know that the 82k will work since i have already ordered them. Desperately waiting for the components to come. Thanks again Sir.

author
SiddharthG16 made it!(author)2017-02-02

I see. in that case you have plenty of options like digibay, robokart or kits spares. there are many other sites from where you can get standard resistors.

author
NilutpalB made it!(author)2017-02-03

i have ordered all the components from the site electronicscomp.com. They have cash on delivery option too. Only the things that i couldn't find there was the 80.6k resistor and the EMG cables and the electrodes. So i had to compensate the 80.6k with the 82k resistor and i am still searching for the EEG/EMG lead cables since they are very less prone to noise compared to the simple copper ones. So did you used the EMG/EEG lead wires or just directly the copper wire attached to an alligator clip?

author
SiddharthG16 made it!(author)2017-02-04

I am using alligator cables directly connected to electrodes on one end and circuit on the other.

About This Instructable

548,016views

726favorites

License:

Bio: Brian Kaminski Owner - Advancer Technologies Brian graduated from North Carolina State University with a BS in Biomedical Engineering with a concentration in Biomechanics in May ... More »
More by Gundanium:Bionic Wolverine ClawsBionic Iron Man GloveBionic Iron Man Armor (w/ Sound Effects)
Add instructable to: