Instructables

DIY Muscle Sensor / EMG Circuit for a Microcontroller

Featured
Picture of 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 .

 
Remove these adsRemove these ads by Signing Up

Step 1: Materials

Picture of 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%  
• 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

Picture of SIGNAL CONDITIONING - Rectification
EMGCircuitSignalCon-Rect2.bmp
EMGCircuitSignalCon-Rect3.bmp
EMGCircuitSignalCon-Rect4.bmp
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

Picture of 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

Picture of 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

Picture of 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 .
1-40 of 265Next »
RománV12 months ago

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 (:

Gundanium (author)  RománV12 months ago
Hi The sample code can be found on our website: http://www.advancertechnologies.com/p/muscle-sensor-v3.html

can u tell me the output voltage of this diy muscle sensor on pin 1 of chip D and ground and another question is can i use the schmitt trigger on the input of ardunio.

Hi,

I am doing a project on Measurement of ECG signals using
Textile electrode.

I have some doubts. I request you to help me.


  • I have two textile conductive fabric electrodes E1 & E2 (+/-)
    which can be placed in chest. Is it required to use electrode E3?
  • What type of electrode can be used for ground
    (E3)?... Conductive fabric?
  • Do I have to excite the electrode?

Please reply me as early as possible.

Kindly give me some materials on Textile electrodes
measurement and its signal conditioning circuits. (Email ID: aashajoe@gmail.com)

I am waiting for your reply sir.

I have a question about the basic materials required.

I don't see the Arduino or Breadboard listed in the materials.

What boards do I need to accomplish this project if I order everything in the materials list?

This is my first time working with electronics on this level. Thank you.

Hi, Actually i m making a battery plates tester, in which i pass 21Amp and 5V dc across the the plate, and the voltage drop across the plate is 0.3mv to 0.4mv , if drop is 0.3mv it is satisfactory, and if it is 0.4vm that is not satisfactory,

i m using instrumentation amplifier, ad620, to detect the small signal and amplify it to certain voltage, then i compare the two voltages by using comparator is lm324, but the problem is that it produces chattering in relay operation , i have added hyterisis but it still produces chattering

kindly help me

actually there are two wires in the EMG electrode cable.how can we connect to the circuit?

2015-02-07 17.48.47.jpg

Actually there are two wires in EMG electrode cable(red and white).how can we connect to the circuit?

2015-02-07 17.48.47.jpg

Hi, Gundanium. Im trying to build the sensor and was curious about what are the improvements I should make tô the project tô add two more channels? Should I double the circuit os there are other alternatives? Im no eng, but a biophysicist and enthusiast of tech and electronics. Thank you

Gundanium (author)  fernando.limoeiro20 days ago
You basically would need to duplicate the circuit 2 more times to add 2 more channels. There are technical obstacles that will prevent you from using more elegant solutions like muxing.
J_Aparecido7 months ago

Hello,

I managed to assemble this project is operating normally ... like a hint, how can I increase the sensitivity of the circuit? For example, if I want to monitor variations in electrical potential without even having muscle contractions, or in a state of relaxation or strees would be an example.

I tried to increase or decrease the gain resistor between pins 5 and 6, but to no avail, however lost sensitivity.

I'm starting in the area of electronics, if someone give some hint where I can find information on, I thank you.

And sorry, my english is not very good, I am "writing" with the help of a translator ...

Thank you,

Gundanium (author)  J_Aparecido3 months ago
Youd probably be best using the raw emg waveform rather than the envelope. Just use an instrumentation amplifier like the first stage of this circuit. Remove DC offset from its ouput with a high pass filter and then amplifier with as much gain as you need to get the sensitivity youre looking for.

Hello,

Thanks for the feedback, for a while I was not looking at the messages here. Thanks for the tip, I've done other attempts, I obtained some success, but not as expected ... I'll try this way.

thank you very much

anka-mehmet25 days ago

hi, can we connect servo motor on the breadboard or Arduino to control them with the EMG system, and if so where connected. thank you very much.

建宏賴1 month ago

Oh! I made one by MSP430 four years ago in Taiwan, the instrument amplifier I adopted is AD620, plus band pass filter from 60~1.0kHz to get signals. You can read the paper in Taichung Chin-E Univ. of technology.

The other signals like ECG, body temperature...etc. Did you ever tried?

photo.png

My project is about Headache measurement using EMG sensors. How could I get the EMG sensor electrodes that can collect the pulses in about 200mV.

husnalebiu1 month ago

hye Gundanium, my final year project is about wireless EMG for nominal switching controller. I want to control the on-off switching for lamp or bulb for 240V. from what I have proposed, my project concept is build an EMG circuit with a tranceiver and build one circuit with a transceiver as switch for my 240V bulb. The EMG circuit will be controlled the switch to on or off the bulb.So do I need isolation circuit in my EMG circuit? may you give me some idea about my proposed project.

Gundanium (author)  husnalebiu1 month ago
Yeah you will probably want isolation between the power source and the EMG circuit and between the EMG output and whatever connects to the bulb controller.
husnalebiu1 month ago

hye Gundanium, my final year project is about wireless EMG for nominal switching controller. I want to control the on-off switching for lamp or bulb for 240V. from what I have proposed, my project concept is build an EMG circuit with a tranceiver and build one circuit with a transceiver as switch for my 240V bulb. The EMG circuit will be controlled the switch to on or off the bulb.So do I need isolation circuit in my EMG circuit? may you give me some idea about my proposed project.

OppaC1 month ago

Hello! May I ask if I can also use this circuit for other applications, such as ECG?

Gundanium (author)  OppaC1 month ago
No. ECG waveform has a vastly different shape and requires different filtering. You could potentially use it as a crude heart rate sensor.
ReyhanS1 month ago

We used Arduino but we couldn't visualize it. Which program have you used for processing for Arduino? We used Firmata but we couldn't understand how to use both codes together. Can you please tell us how to make it step by step? Thanks for your consideration.

Gundanium (author)  ReyhanS1 month ago
Here's the Arduino and Processing code

https://github.com/AdvancerTechnologies/Muscle-Sensor-v3/tree/master/Example%20Code/BarGraph
Gundanium (author)  ReyhanS1 month ago
It's called Processing https://processing.org/

There's sample code on our product page: http://www.advancertechnologies.com/p/muscle-sensor-v3.html
ReyhanS2 months ago

How can you connect the circuit to computer and which program are you using for monitorizing output signals? Also can we get the signals from oscilloscope?

Gundanium (author)  ReyhanS2 months ago
The circuit outputs an analog signal so you need either an analog-to-digital converter or a microcontroller to convert it to a digital signal the computer can understand. I usually do with with an Arduino MCU. I'm using an Arduino sketch to send the sensor data over serial and Processing to take that data and visualize it. You can find the code on our website or on our GitHub repository.

As for an o-scope, the signal is analog so you can view it with an o-scope.
umranyaman062 months ago

i couln't find INA106 can u suggest another IC instead of that?

umranyaman062 months ago

i couln't find INA106 can u suggest another IC instead of that?

hai am bhavana, the project is very good , building our own EMG circuit for many applications, iam thinking to use this in my project, but my question is where can i get the software or program to be installed into arduino. please help in this regard
thank u
Gundanium (author)  chepuri bhavana2 months ago

http://www.advancertechnologies.com/p/muscle-sensor-v3.html

Gundanium (author)  chepuri bhavana2 months ago

It can be found on our website http://www.advancertechnologies.com/p/muscle-sensor-v3.html

Can u help me with connecting arduino to the computer and logging the data? Or share your code with me. My email id is abrahimshah99@gmail.com

Sudhir Sonkar3 months ago

Any alternate ic for ina106.

Gundanium (author)  Sudhir Sonkar2 months ago

I don't know of any that can simply swapped out. However, there are other ICs that are suitable for the first stage of the circuit. For instance, AD620 or the AD822* family of ICs (e.g. AD8226, AD8221). Our latest sensor uses the AD8226: http://www.advancertechnologies.com/p/muscle-sensor-v3.html

Can i use this sensor more than one time ?

Gundanium (author)  ahmed.yousif.96152 months ago

Yes. Why wouldn't you?

zohaib Shabir2 months ago

i am using proteus software and i do not have ina106 in my library .plz guide me what should i do. 2nd thing plz send me clear areas and schematic of DIY muscle sensor at zohaibshabir786@gmail.com

because it is not clear on website

Waiting for a kind response.

Regards

hi hello.. i want to use it for my fyp project this month.. can i know more detail about this project.. my email : bill_student46@yahoo.com . and may i now , can i get the signal by using labview software?

kkops4 months ago

can u suggest any reuseable EMG electrodes that will work with this circuit?

Gundanium (author)  kkops3 months ago
The conductive fabric tutorial on our website should work.
1-40 of 265Next »