Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
test-and-measurement:analog-discovery-studio:ecg-demo:start [2021/10/13 21:06] – external edit 127.0.0.1test-and-measurement:analog-discovery-studio:ecg-demo:start [2024/04/16 21:00] (current) – title case Arthur Brown
Line 1: Line 1:
-====== DIY ECG With Analog Discovery Studio and LabVIEW ======+====== DIY ECG with Analog Discovery Studio and LabVIEW ======
 {{ reference:test-and-measurement:analog-discovery-studio:ecg-demo:labview_in_use.png?nolink&600 |}} {{ reference:test-and-measurement:analog-discovery-studio:ecg-demo:labview_in_use.png?nolink&600 |}}
 **Note:** //This is NOT a medical device. Should be used for educational purposes only.// **Note:** //This is NOT a medical device. Should be used for educational purposes only.//
Line 22: Line 22:
 <WRAP group> <WRAP group>
   * [[https://digilent.com/shop/analog-discovery-studio-a-portable-circuits-laboratory-for-every-student/|Analog Discovery Studio]] with Breadboard Canvas and MTE cables   * [[https://digilent.com/shop/analog-discovery-studio-a-portable-circuits-laboratory-for-every-student/|Analog Discovery Studio]] with Breadboard Canvas and MTE cables
-  * Analog parts and wires (all found in the [[https://store.digilentinc.com/analog-parts-kit-by-analog-devices-companion-parts-kit-for-the-analog-discovery/|Analog Parts Kit]])+  * Analog parts and wires (all found in the [[https://digilent.com/shop/analog-parts-kit-by-analog-devices-companion-parts-kit-for-the-analog-discovery/|Analog Parts Kit]])
     * 1 x [[https://www.analog.com/media/en/technical-documentation/data-sheets/OP282_482.pdf|OP 482 quad operational amplifier]]     * 1 x [[https://www.analog.com/media/en/technical-documentation/data-sheets/OP282_482.pdf|OP 482 quad operational amplifier]]
     * 2 x [[https://www.vishay.com/docs/85622/1n914.pdf|1N914 diode]]     * 2 x [[https://www.vishay.com/docs/85622/1n914.pdf|1N914 diode]]
-    * 1 x 47nF capacitor (473) +    * 1 x 47 nF capacitor (473) 
-    * 4 x 4.7KΩ resistor (yellow-purple-red-gold) +    * 4 x 4.7 KΩ resistor (yellow-purple-red-gold) 
-    * 1 x 10KΩ resistor (brown-black-orange-gold) +    * 1 x 10 KΩ resistor (brown-black-orange-gold) 
-    * 2 x 20KΩ resistor (red-black-orange-gold) +    * 2 x 20 KΩ resistor (red-black-orange-gold) 
-    * 3 x 100KΩ resistor (brown-black-yellow-gold) +    * 3 x 100 KΩ resistor (brown-black-yellow-gold) 
-    * 1 x 150KΩ resistor (brown-green-yellow-gold) +    * 1 x 150 KΩ resistor (brown-green-yellow-gold) 
-    * 2 x 470KΩ resistor (yellow-purple-yellow-gold)+    * 2 x 470 KΩ resistor (yellow-purple-yellow-gold)
     * Jumper wires     * Jumper wires
   * 3 x Alligator clips   * 3 x Alligator clips
Line 50: Line 50:
 === Building the Amplifier Circuit === === Building the Amplifier Circuit ===
 <WRAP column half> <WRAP column half>
-The amplitude of the potential difference on the skin is just in the millivolt or microvolt range, so it has to be amplified. To amplify the signal an instrumentation amplifier is built using OP482. The gain is set to 500 (A = (1 + 2 * R2/R1) * R3/R4). The **+** input should be connected to the right leg, above the ankle, the **-** input to the right hand, on the wrist. Between the surface electrodes and the inputs of the instrumentation amplifier 100kΩ resistors are connected to limit any current circulating towards the body (in case of faulty operation).+The amplitude of the potential difference on the skin is just in the millivolt or microvolt range, so it has to be amplified. To amplify the signal an instrumentation amplifier is built using OP482. The gain is set to 500 (A = (1 + 2 * R2/R1) * R3/R4). The **+** input should be connected to the right leg, above the ankle, the **-** input to the right hand, on the wrist. Between the surface electrodes and the inputs of the instrumentation amplifier 100 kΩ resistors are connected to limit any current circulating towards the body (in case of faulty operation).
 </WRAP><WRAP column half> </WRAP><WRAP column half>
 {{ reference:test-and-measurement:analog-discovery-studio:ecg-demo:amplifier_standard_schem.png?600 |}} {{ reference:test-and-measurement:analog-discovery-studio:ecg-demo:amplifier_standard_schem.png?600 |}}
Line 63: Line 63:
 === Filtering Out the Common Mode Signal === === Filtering Out the Common Mode Signal ===
 <WRAP column half> <WRAP column half>
-It can be seen, that the measured signal is too noisy, the heart signal can't be recognized. To correct this, the common mode signal from the output of the first amplifier stage is amplified and inverted using the fourth operational amplifier in OP 482 (A = - R6/R5). The amplified and inverted common mode signal (**G**) is connected to a current limiting resistor, then to the left wrist. Two antiparallel diodes are connected between the **G** surface electrode and the device's ground to limit the signal between around -0.6V and +0.6V, to prevent electrocution.+It can be seen, that the measured signal is too noisy, the heart signal can't be recognized. To correct this, the common mode signal from the output of the first amplifier stage is amplified and inverted using the fourth operational amplifier in OP 482 (A = - R6/R5). The amplified and inverted common mode signal (**G**) is connected to a current limiting resistor, then to the left wrist. Two antiparallel diodes are connected between the **G** surface electrode and the device's ground to limit the signal between around -0.6 V and +0.6 V, to prevent electrocution.
 </WRAP><WRAP column half> </WRAP><WRAP column half>
 {{ reference:test-and-measurement:analog-discovery-studio:ecg-demo:feedback_standard_schem.png?600 |}} {{ reference:test-and-measurement:analog-discovery-studio:ecg-demo:feedback_standard_schem.png?600 |}}
Line 117: Line 117:
 === Postprocessing === === Postprocessing ===
 <WRAP group><WRAP column half> <WRAP group><WRAP column half>
-The acquired signal is still as noisy as seen on the //Oscilloscope// in WaveForms, so it needs filtering. After the DC component is estimated and subtracted from the signal to remove any offset (there might remained some after the decoupling), the data enters a moving average filter, its parameters depending on the utility frequency. This filter eliminates almost completely the 50 Hz or 60 Hz component in the power spectrum, as well as its harmonics. The exiting signal is smoothed. As it can be seen on the power spectrum at [[test-and-measurement:analog-discovery-studio:ecg-demo:start#circuit_setup|Circuit Setup]], the most significant components of the signal are below 50 Hz, so filtering out everything above that should not damage the useful signal. However, as the QRS wave (the high amplitude part of the ECG signal) has a rise time of around 15 ms, a 25 Hz threshold should be considered, the cutoff frequency of the low-pass filter becoming 75 Hz.+The acquired signal is still as noisy as seen on the //Oscilloscope// in WaveForms, so it needs filtering. After the DC component is estimated and subtracted from the signal to remove any offset (some might remain after the decoupling), the data enters a moving average filter, its parameters depending on the utility frequency. This filter eliminates almost completely the 50 Hz or 60 Hz component in the power spectrum, as well as its harmonics. The exiting signal is smoothed. As it can be seen on the power spectrum at [[test-and-measurement:analog-discovery-studio:ecg-demo:start#circuit_setup|Circuit Setup]], the most significant components of the signal are below 50 Hz, so filtering out everything above that should not damage the useful signal. However, as the QRS wave (the high amplitude part of the ECG signal) has a rise time of around 15 ms, a 25 Hz threshold should be considered, the cutoff frequency of the low-pass filter becoming 75 Hz.
  
 After proper filtering, the maximum point of the data set is acquired and, with a peak detector, all the data points above 75% of this maximum and 10 ms wide are found (the P - preceding QRS - and T - proceeding QRS - signals of the should not reach that amplitude). The location of these points are multiplied with the time derivative of the signal and summed with the starting time to get the exact time of each peak. Time between two consecutive peaks is calculated and converted to frequency, then multiplied with 60 to get the number of beats (peaks) per minute. After proper filtering, the maximum point of the data set is acquired and, with a peak detector, all the data points above 75% of this maximum and 10 ms wide are found (the P - preceding QRS - and T - proceeding QRS - signals of the should not reach that amplitude). The location of these points are multiplied with the time derivative of the signal and summed with the starting time to get the exact time of each peak. Time between two consecutive peaks is calculated and converted to frequency, then multiplied with 60 to get the number of beats (peaks) per minute.
Line 136: Line 136:
 ==== Testing ==== ==== Testing ====
 <WRAP group><WRAP column half> <WRAP group><WRAP column half>
-To test the device, build the circuit on the Breadboard Canvas, turn on the Analog Discovery Studio and connect it to a PC. Open the ECG VI. Place one surface electrode on the inner side of your left wrist, one on the inner side of your right wrist and one on the inner side of your right ankle. With the alligator clips, connect the circuit to the electrodes, as shown in the image to the right. Start the VI with the pLay button. If you stay still for a few seconds, you will see on the plot pane your ECG signal and the estimated heart rate.+To test the device, build the circuit on the Breadboard Canvas, turn on the Analog Discovery Studio and connect it to a PC. Open the ECG VI. Place one surface electrode on the inner side of your left wrist, one on the inner side of your right wrist and one on the inner side of your right ankle. With the alligator clips, connect the circuit to the electrodes, as shown in the image to the right. Start the VI with the play button. If you stay still for a few seconds, you will see on the plot pane your ECG signal and the estimated heart rate.
 </WRAP><WRAP column half> </WRAP><WRAP column half>
 {{ reference:test-and-measurement:analog-discovery-studio:ecg-demo:limb_leads.png?nolink&200 |}} {{ reference:test-and-measurement:analog-discovery-studio:ecg-demo:limb_leads.png?nolink&200 |}}
Line 167: Line 167:
 For more information about how to use the software featured in this demo, please visit its respective guide: [[test-and-measurement:guides:getting-started-with-labview]]. For more information about how to use the software featured in this demo, please visit its respective guide: [[test-and-measurement:guides:getting-started-with-labview]].
  
-For technical support, please visit the [[https://forum.digilentinc.com|Digilent Forums]].+For technical support, please visit the [[https://forum.digilent.com|Digilent Forums]].
  
 {{tag>project analog-discovery-studio}} {{tag>project analog-discovery-studio}}