In this blog, I m going to measure an electrical activity of a beating heart through electrodes taped to the skin, using ECG 2 click bundle and Microchip SAM E51 Curiosity Nano. Firstly I will explain basics and setup, the demo will be in separate blog.
The contents of the sponsored ECG 2 click bundle are
- ECG 2 click
- ECG Cable
- ECG Sensors or ECG electrodes
Reason for using the word 'ECG Click' instead ECG 2 click - Mikroe manufactures and sells seven types of ECG click boards, my design ccan be used for any of the Mikroe Click boards :
- ECG Click
- ECG 2 Click
- ECG 3 Click
- ECG 4 Click
- ECG 5 Click
- ECG 6 Click
- ECG 7 Click
I have chosen ECG 2 click, though some vendors are citing this as OBSELETE and a Retired Product from their catalog and is no longer for sale.
These ECG boards are used not only to view an electrical activity but are used in heart rate monitoring applications, fitness applications, ECG bio-authentication etc. Mikroe has mentioned following disclaimer :
Disclaimer by Manufacturer (www.mikroe.com): ECG Click is a prototyping tool, not a medical grade device. Do not use it to diagnose patients.
So, in this blog, I will take this obselete and a retired product from prototyping tool to a medical grade. And I hope to shortly submit clinically/ICU related paper and analysis to medical experts based on my self-claimed and developed Novel ß-Bio Unified Theory.
I have used e14 Equation Editor, to write equations with subscripts.
Due to time constraint, this blog would consist of complete set up of the project, that is ECG, oximeter, respiratory, LEDs, keypad, buzzer, LCDs, accelerometer, Infineon AWS IoT Dongle, air purifier etc.
Table of Contents
1. Mikroe ECG 2 Click
1.1 Theory of Operation
1.2 ADC
1.3 ReRouting the right-leg drive signal
1.4 Measuring the right-leg drive signal
1.5 Wilson Center Terminal
1.6 Lead-Off Detection or Electrode-off detection
1.7 RLD Lead-Off Detection
1.8 Right Leg Drive Circuit
1.9 Pace Detection
1.10 Temperature
1.11 Programmable Gain Amplifier, PGA
1.12 Input Common-Mode and Differential Dynamic Range
1.13 16-bit delta-sigma, ΔΣ Modulator
1.14 Digital Filter
1.15 Register Map
2. ECG Cable
3. ECG sensors or ECG Electrodes
3.1 Importance of Sensor : Ag/AgCl
4. ECG(or EKG) Basics
4.1 What is ECG (or EKG)
4.2 Symptons when a doctor ask ECG (or EKG)
4.3 12-lead
5. How Measure Using ECG 2 Click and Microchip SAM E51 Curiosity Nano
5.1 Measuring Using Jack
5.2 Measuring Using Two Orange Connectors
5.3 Data Visualization Tool
5.4 Electrode Placement
6.Circuit Diagram & Set Up
7. Related Research Work(Undergoing)
1. Mikroe ECG 2 Click
ECG 2 Click contains 16-bit delta-sigma analog-to-digital converter, a built-in programmable gain amplifier (PGA), an internal reference, and an onboard oscillator.
{gallery}ecgclclk |
---|
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
ECG 2 Click Schematic
1.1 Theory of Operation
The ECG 2 Click's multiplexer give measurements of temperature, supply, input short, right-leg drive. The patient drive signal can be the average of any combination of electrodes. The internal oscillator runs at 2.048MHz. Let
- fCLK denotes the frequency of the signal at the CLK pin,
- tCLK denotes the period of the signal at the CLK pin,
- fDR denotes the output data rate,
- tDR denotes the time period of the output data,
- fMOD denotes the frequency at which the modulator samples the input.
As can be seen in the gallery of sub-section 1.2, 'Functional Block Diagram' has electromagnetic interference (EMI) filter on all of the channels, which is basically a RC filter with a bandwidth of -3 dB or ≈ 3 MHz. The CMRR is -105dB. As we will see, three integrated amplifiers generate the Wilson Center Terminal (WCT) and the Goldberger terminals (GCT) required for a 12-lead ECG but I will use 3-lead ECG in this blog.
The output is in 16 bits of data per channel in binary 2's complement format. The LSB=VREF÷((215) − 1).
1.2 ADC
As can be seen in the schematic and ECG 2 Click board's pic, the ADC is ADS1194. The noise performance can be optimized by adjusting the sampling rates from 125SPS to 8kSPS and PGA settings from 1, 2, 3, 4, 6, 8, and 12.
{gallery}ADC |
---|
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: Input-Referred Noise |
IMAGE TITLE: Input-Referred Noise, |
IMAGE TITLE: Typical WCT Performance |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: Serial Interface Timing |
IMAGE TITLE: Daisy-Chain Interface Timing |
IMAGE TITLE: Functional Block Diagram |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
1.3 ReRouting the right-leg drive signal
To get the RLD signal at the RLDOUT pin, the loop has to be closed.
The RLDIN signal can be multiplexed into any one of the input electrodes
- P-Side : Set to 110
- N-Side : Set to 111
It can also be used to dynamically change the electrode that is used as the reference signal to drive the patient body.
1.4 Measuring the right-leg drive signal
The measurement is done with respect to the voltage on the RLDREF pin.
If RLDREF is chosen to be internal, it would be at (AVDD+AVSS)2.
1.5 Wilson Center Terminal
1.5.1 In the below figure, it can be seen there are three integrated low-noise amplifiers which generate Wilson Center Terminal (WCT) voltage,which is used as the reference voltage for the measurement of the chest leads.
If the lead is 12-lead, then WCT voltage is defined as the average of Right Arm (RA), Left Arm (LA), and Left Leg (LL) electrodes. Any one of the eight signals IN1P to IN4N can be chosen to route to each of the amplifiers to generate the average.
- Each of these three amplifiers can be powered down individually with register settings.
- By powering up two amplifiers, the average of any two electrodes can be generated.
- Powering up one amplifier provides the buffered electrode voltage.
The below table describes the WCT Performance.
The above table shows the overall noise reduces when more than one WCT amplifier is powered up.
The below figure tells that when the right leg drive (RLD) is derived as the average of RA, LA, and LL, then WCT amplifier should be used only to drive very high impedances directly, and WCT signal can be buffered by setting the WCT_TO_RLD bit in the CONFIG4 register.
The below figure is implementation of other ADS1198 which gives augmented leads feature, which is missing in this ECG 2 Click.
1.6 Lead-Off Detection or Electrode-off detection
The electrodes used to measue ECG decay over time, thus, electrode connections must be monitored continuously. This is accomplished using Lead-Off Detection or Electrode-off detection of the ECG 2 Click board.
The functional block diagram in the above figure explains the basic principle, which is to inject an excitation signal and measure the response to find out if the electrode is off. The excitation signal can be
- dc excitation signal
- an out-of-band ac signal
1.7 RLD Lead-Off Detection
It is also necessary to determine whether the right leg electrode is suitably connected or not. The comparator's reference determine the acceptable RLD impedance threshold.
1.8 Right Leg Drive Circuit
It is known that power lines, fluorescent lights etc. interfere ECG. To avoid this common mode interference, Right Leg Drive (RLD) circuit is used.
The above circuit creates a negative feedback loop by driving the body with an inverted common-mode signal, which restricts the common-mode movement to a narrow
range.
1.9 Pace Detection
External hardware can be used for pace detection at two pins: TESTP_PACE_OUT1 and TESTN_PACE_OUT2.
This wont be taken in this project.
1.10 Temperature
This figure shows that the ECG 2 Click ADC's has on-chip temperature sensor, which uses two internal diodes.
It can be seen 8x is mentioned with 1x current density with one diode.
And the other diode has 2x and 1x mentioned which means it has acurrent density 16x than that of the other.
1.11 Programmable Gain Amplifier, PGA
The PGA is a differential input, differential output amplifier with seven gain settings. The default gain is 6, with resisor value of 120 kΩ
1.12 Input Common-Mode and Differential Dynamic Range
Let VMAX_DIFF denotes the maximum differential signal at the input of the PGA, and CM denotes the common-mode range.
The input CM range is : AVDD - 0.2 - 12× Gain VMAX_DIFF > CM > AVDD + 0.2 + 12× Gain VMAX_DIFF
The differential signal range is Max(INP−INN)<VREFGain,
The Full-Scale Range is ±VREFGain.
1.13 16-bit delta-sigma, ΔΣ Modulator
It has second-order modulator which samples the input signal at the rate of fMOD = fCLK8.
1.14 Digital Filter
The digital filter receives the modulator output and decimates the data stream, and is also used as an antialias filter. To implement software pace detection and ac lead-off detection, higher data rates are used. Each channel consists of a low pass filter of third-order sinc filter, sin xx.
1.15 Register Map
1) ID : This is ID Control Register and is Factory-Programmed, Read-Only.
- Bits[7:5] DEV_ID[5:3]
- Bit 4 This bit reads high.
- Bit 3 This bit reads low.
- Bit 2 DEV_ID2: Channel number identification
- Bits[1:0] DEV_ID[1:0]: Channel number identification
2) CONFIG1 , Configuration Register 1
- Bit 7 Must always be set to '0'
- Bit 6 DAISY_EN: Daisy-chain/multiple readback mode
- Bit 5 CLK_EN: CLK connection
- Bits[4:3] Must always be set to '0'
- Bits[2:0] DR[2:0]: Output data rate.
3) CONFIG2,Configuration Register 2
- Bits[7:6] Must always be set to '0'
- Bits 5 Must always be set to '1'
- Bit 4 TEST source
- Bit 3 Must always be set to '0'
- Bit 2 Test signal amplitude
- Bits[1:0] Test signal frequency
4) CONFIG3,Configuration Register 3
- Bit 7 PD_REFBUF: Power-down reference buffer
- Bit 6 Must always be set to '1'.
Bit 5 Reference voltage - Bit 4 RLD measurement
- Bit 3 RLDREF signal
- Bit 2 RLD buffer power
- Bit 1 RLD sense selection
- Bit 0 RLD lead off status
5) LOFF , Lead-Off Control Register
- Bits[7:5] Lead-off comparator threshold
- Bit 4 Lead-off detection mode
- Bits[3:2] Lead-off current magnitude
- Bits[1:0] Lead-off frequency
6) CHnSET, Individual Channel Settings
- Bit 7 Power-down
- Bits[6:4] PGA gain
- Bit 3 Always write '0'
- Bits[2:0] Channel input
There are 8 channels, n = 1 to 8.
7) GPIO
- Bits [7:4] GPIO data
- Bits [3:0] GPIO control
8) CONFIG4,Configuration Register 4
- Bits [7:4] Must always be set to '0'
- Bit [3] Single-shot conversion
- Bit [2] Connects the WCT to the RLD
- Bit [1] Lead-off comparator power-down
- Bit [0] Must always be set to '0'
9) WCT1
- Bit [4] Enable (WCTB + WCTC)/2 to the negative input of channel 4
- Bit [3] Power-down WCTA
- Bits [2:0] WCT amplifier A channel selection; typically connected to RA electrode
10) WCT2
- Bit [7] Power-down WCTC
- Bit [6] Power-down WCTB
- Bits [5:3] WCT amplifier B channel selection; typically connected to LA electrode.
- Bits [2:0] WCT amplifier C channel selection; typically connected to LL electrode.
2. ECG Cable
The ECG cable given with the kit can also be used for EMG(Electromyography). The cable is 24" in length and has a 3.5mm phone jack on one end with snap style receptacles for biomedical sensor pads.
The given cable is in red/white/black set (it also comes in red/blue/black set). It is a three conductor sensor cable with electrode pad leads.
The cable is used with adhesive ECG/EMG electrodes to record electrocardiograms with ECG Click or EMG Click.
On the cable, there are labels
- Red is labeled for LL (Left Leg)
- Black is labeled for LA (Left Arm)
- White is labeled for RA (Right Arm)
{gallery}CABLEECG |
---|
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
3. ECG sensors or ECG Electrodes
The ECG electrodes or sensors sponsored by Microchip is from the manufacturer 'Top Trace', can also be used for EMG as EMG sensors or electrodes.
These ECG/EMG electrodes are single use, disposable adhesive electrodes/sensors pads with stud adapter. These may be used for short-term monitoring of Neurofeedback and Biofeedback purposes.
Dimension of ECG/EMG electrodes is 51mm X 34mm.
Quantity : Pack of 30 pcs
Sensor : Ag/AgCl
{gallery}ECGSENSOR |
---|
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
3.1 Importance of Sensor : Ag/AgCl
Let me first explain AgCl, then I will explain Ag/AgCl
AgCl,Silver chloride, is a white crystalline solid which occurs naturally as the mineral chlorargyrite. This chemical compound AgCl was known to ancients. When AgCl is used as an electrode, it functions as a reversible redox electrode and used as a reference in reduction potential measurements. thus, it is commonly used in voltammetry, electrochemistry, pH meters etc.
The electrode used here in ECG is not AgCl but Ag/AgCl, that is Silver/Silver chloride, and these Ag/AgCl based electrodes are popular and widey used for clinical and biomonitoring purposes, and some biomonitoring applications might replace it by nano composites. Not only biological, these Ag/AgCl electrodes are used for low-frequency electric field detection in seawater.
In these sensors, the fabrication of the outer layer of the silver is converted to silver chloride.
Note : Some people may be allergic or sensitive to the adhesive of these electrodes which might cause some mild skin itchiness and redness but this usually resolves on its own and doesn’t require any treatment.
4. ECG(or EKG) Basics
4.1 What is ECG (or EKG)
An electrocardiogram (ECG or EKG) is a simple, non-invasive test that records the electrical activity of the heart.
An ECG/EKG can help diagnose certain heart conditions, heart inflammation (pericarditis or myocarditis), patient experiencing symptoms of an abnormal heart rhythm (arrhythmia) or warning signs of a heart attack or angina.
4.2 Symptons when a doctor ask ECG (or EKG)
chest pain, breathlessness, dizziness, fainting or a feeling of your heart racing, fluttering, thumping or pounding in your chest (palpitations), discomfort or pain in your chest, arms, shoulders, neck, jaw or back, dizziness, light headedness, feeling faint or feeling anxious, nausea, indigestion, vomiting, shortness of breath or difficulty breathing, sweating or a cold sweat
4.3 12-lead
Source : https://www.urmc.rochester.edu/pediatrics/cardiology-fellowship/ecg-placement.aspx
5. How Measure Using ECG 2 Click and Microchip SAM E51 Curiosity Nano
Below picture is the side view of the ECG 2 Click, where the measurement probes has to be added.
In this picture, there is a black jack and two orange connectors, how you can measure lets learn. Actually, ECG2 Click board allows you to take ECG in two ways :
- jack
- or two orange connectors
5.1 Measuring Using Jack
This jack is a 3.5mm phone jack, where the cable, ECG Cable mentioned in Section 2, will be inserted. This jack is a 3 wire measurement which has three electrodes marked with LL(Left Leg), RA(Right Arm), LA (Left Arm)
5.2 Measuring Using Two Orange Connectors
If you do not want to use jack, you can use these two orange connectors which are screw terminals
- Screw terminal 1, marked with LA (Left Arm) and RL(Right Leg)
- Screw terminal 2, marked with RA(Right Arm) and LL(Left Leg)
Thus, these screw terminals give 4-wire measurement where 4 electrodes will be on both arms and both legs.
5.3 Data Visualization Tool
There is a free data visualization tool, a free app, the MikroPlot but it is only for Windows (you can succeed installing it on Linux/Ubuntu ! ). There are some examples on internet, which shows the use of additional USB-UART clickboards like USB UART click, USB UART 2 Click or RS232 Click, but I will use Microchip SAM E51 Curiosity Nano for it.
5.4 Electrode Placement
As I have mentioned the lead I will use is 3-lead ECG and has RA,LA, LLmarked on the leads,
Source : https://litfl.com/ecg-lead-positioning/
6. Circuit Diagram & Set Up
I have connected this ECG 2 Click on mikroBUS Click socket No. 1 and LCD Mini Click on mikroBUS Click socket No. 2, of the Curiosity Nano Base evaluation kit.
This communicates with SAM E51 Curiosity Nano Evaluation Kit over SPI. Besides SCK, SDO, CS, SDI, three more pins of mikroBUS pins - PWM, AN and INT are used. ECG 2 Click runs on 3.3V and 5V power supply. Here I have configured both ECG 2 click and LCD Miniclick as SPI Slaves.
I will display the data over
- LCD MiniClick which is connected as SPI Slave
- Serial GTKTerm
- AWS IoT Console
- Android Applet
ECG 2 Click Pinouts
LCD MiniClick Pin out
Figure : Setup of ECG hardware
In the above figure, seven arrows can be seen and they are all part of this ECG Demos; these do not include PC/laptop screen, AWS console and android applet.
Below is the same setup with captions
Ongoing R&D work
{gallery}ecg23 |
---|
IMAGE TITLE: THEN IMAGE DESCRIPTION |
IMAGE TITLE: THEN IMAGE DESCRIPTION |
7. Related Research Work(Undergoing)
- Novel ß-Unified (Non Linear)Theory/Postulates/Propositions
- Novel ß-Bio Unified Theory, Novel ß-Bio-Equations, ß-Bio Propositions and ß- Bio Models
- Investigating Myocardial Infarction using Novel ß-Bio Model of Circulatory System
- Investigating Myocardial Infarction using Novel ß Bio-Electro-Magnetic Radiations Model
- Investigating Myocardial Infarction in Females using Novel ß-Bio Model of Circulatory System
- Investigating Myocardial Infarction in Females using Novel ß Bio-Electro-Magnetic Radiations Model
- Simulation of Novel ß Non-Invasive Cardiac Transcutaneous Pacemaker