Introduction: DIY Emg Sensor With and Without Micro-controller
Welcome to knowledge sharing instructables platform .In this instructables i'm going to discuss how to make basic emg circuit and behind mathematical calculation involved in it . You can use this circuit to observe muscle pulse variations ,control servo ,as joystick,motor speed controller ,light and many such appliances.First picture indicates circuit diagram which is designed in ltspice software,second picture indicates simulation output of ltspice when input is given and third picture indicates output when no input is given.
Supplies
COMPONENTS REQUIRED.
LM741 IC -X 4
NE555 -X 1
RESISTOR
10K -X2
1K -X4
500 -X2
1.5K -X1
15K -X1
300K -X1
220K -X1
5K -X1
DIODES -X3
CAPACITOR -22 nf(for 555 TIMER IC).
CAPACITOR -1U -X3
ELECTROLYTIC CAPACITOR -1U (AT OUTPUT).
Step 1: Steps Involved in Construction of Emg
1 Instrumentation amplifier design.
2 High pass filter.
3 Half bridge wave rectifier .
4 Smoothening circuit.
(optional)
5 pwm signal generator.(to exclude microcontroller).
Step 2: INSTRUMENTATION AMPLIFIER.
1 Instrumentation amplifier.
In this step we require three Lm741 ic .Before making circuit connect the battery as shown in figure1
red indicate positive 9v and black indicate -9v and green wires as ground.
Now next stage is to make differential amplifier .Take one Lm741 ic connect pin 7 to positive and pin 4 to negative(not ground).Take 10k resistor connect between 2 and 6 of lm741 ic .Take second lm741 make the connection as same as first Lm741 ic .Now add 500 ohms resistor,one terminal of 500 ohm resistor to first inverting terminal of Lm741 ic and second terminal of 500 ohm resistor to second inverting terminal of Lm741 ic as shown in figure 2.
Design of instrumentation amplifier.
At this stage we have to take output of first Lm741 ic to one terminal of 1k resistor and another terminal of resistor 1k to inverting terminal of third Lm741 ic ,similarly output of second Lm741 ic to one terminal of resistor 1k and another terminal of resistor 1k to non inverting terminal of Third Lm741 ic.Add 1k resistor between inverting terminal of third Lm741 ic and pin 6 of Third Lm741 ic,and 1k resistor between non inverting terminal of third Lm741 ic and ground(not negative).This completes design of instrumentation amplifier.
Testing of instrumentation amplifier.
Take two signal generator .Set 1st signal generator input as 0.1mv 100 hz(ur wish try diiferent values) ,similarly set second signal generator input as 0.2mv 100hz.positive pin of 1st signal generator to pin 3 of first LM741 ic and negative pin to ground ,similarly positive pin of 2nd signal generator to pin 3 of second LM741 ic and negative pin to ground
calculation
gain of instrumentation amplifier
gain = (1+(2*R1)/Rf)*R2/R3.
here
Rf = 500 ohms.
R1 = 10k.
R2 = R3=1k
V1 = 0.1mv
V2 = 0.2mv
output of differential amplifier = V2 -V1=0.2mv-0.1mv=0.1mv
gain=(1+(2*10k)/500)*1k/1k=41.
output of instrumentation amplifier = output of differential amplifer*gain.
output of instrumentation amplifier = 0.1mv * 41=4.1v
And output of oscilloscope is 4v peak to peak in figure 4, deduced through tinker cad simulation software hence design is correct and we proceed to next step
Step 3: HIGH PASS FILTER.
High pass filter construction
At this stage we have to design high pass filter to avoid unnecessary voltage produced due to noise .To suppress noise we have to design filter of 50 Hz frequency to avoid unnecessary humming noise produced by battery.
construction.
Take output of instrumentation amplifier and connect it to one end of 1u capacitor and another end of capacitor is connected to one end of 15 k resistor and another end of 15k resistor to inverting terminal input of 4th Lm741 ic .Non inverting terminal of 4th Lm741 ic is grounded.Now take 300k resistor connect between pin 2 and 6 of 4th Lm741 ic.
calculation
c1 =1u.
R1 = 15k
R2 = Rf=300K
cutoff frequency of high pass filter.
Fh=1/2(pi)*R1*C1
Fh=1/2(pi)*15k*1u=50hz.
gain of the high pass filter
Ah=-Rf/R1
Ah=-300k/15k=20.
so output from instrumentation amplifier is passed as input to high pass filter which will amplify the signal 20 times and signal below 50 Hz are attenuated.
Step 4: SMOOTHING CIRCUIT
Smoothing circuit.
Microcontroller accepts reading from 0 to 5v ( any other microcontroller specified voltage) any other reading other then specified rating may give biased result hence pheripheral device like servo, led, motor may not work properly.Hence it is necessary to convert double sided signal to single sided signal.To achieve this we need to construct half wave brigde rectifier (or full wave bridge rectifer).
Construction.
Output from high pass filter is given to positive end of 1st diode ,negative end of 1st diode is connected to negative end of 2nd diode. Positive end of 2nd diode is grounded.The output is taken from junction of negative end diodes. Now output looks like rectifed output of sine wave .We cannot directly give to microcontroller for controlling pheripheral devices because output is still varying in half wave sin format .We need to get constant dc signal in range from 0 to 5v .This can be achieved by giving output from half wave rectifer to positive end of 1uf capacitor and negative end of capacitor is grounded .
CODE:
#include
Servo myservo;
int potpin = 0;
void setup()
{
Serial.begin(9600);
myservo.attach(13);
}
void loop()
{
val = analogRead(potpin);
Serial.println(val);
val = map(val, 0, 1023, 0, 180);
myservo.write(val);
delay(15);
Serial.println(val);
}
Step 5: WITHOUT MICRO-CONTROLLER VERSION(OPTIONAL)
Those who are fed up of aurdino programming or don't like programming no worries.We have solution for it .Aurdino uses pulse width modulation technique to run peripheral device (servo, led ,motor).We to need to design the same .Aurdino pwm signal varies between 1ms and 2.5ms. Here 1ms indicates least or off signal and 2.5ms indicates signal is fully on.In between time period can be used to control other parametres of pheripheral device like controlling brightness of led ,servo angle,controlling speed of motor etc.
Construction
we need connect output from smoothing circuit to one end of 5.1k resistor and another end to parallel connection of 220k and diode one point .one end of parallel connected 220k and diode is connected to pin 7 of 555 timer ic and another point pin 2 of 555 timer ic.Pin 4 and 8 of 555 timer is connected to 5 volt and pin 1 is grounded.A capacitor of 22nf and 0.1 uf is connected between pin 2 and ground .output is taken from pin three of 555 timer ic .
Congratulations you have successfully excluded micro controller.
Step 6: HOW TO USE THE CIRCUIT.
To use this circuit we need to have three gel electrode .First gel electrodes need to be place on mid muscle and second on end muscle ,third electrode on elbow.
The electrode placed on mid muscle(red electrode) should be given as input to pin 3 of 1st Lm741 opamp and end muscle(blue electrode) to pin 3 of 2nd Lm741 opamp and the electrode which is placed in elbow(black electrode) should be given to ground.