Have you felt it when your heart "skips a beat" OR a "flutter" in your heart? If you're wondering what it was, its called an "arrhythmia". Not to worry, general heart-rate variability (HRV) is normal and dependent on emotional arousal, although some types of arrhythmias can indicate cardiac anomalies.
What we want to present in this article is a unique and easy way to measure ECG as well as R-R intervals with surprisingly high accuracy.
ECG/EKG (Electro-cardiogram) is an electrical signal taken from electrodes connected to the body and its an electrical signal. Compared to optical means of heart rate measurement, the ECG still provides the most accurate heart rhythm.
A single ECG waveform is made up of the P,Q,R,S,T points as shown in the picture below. Each of these is of significance in a detailed cardiac study and is not possible to explain everything here. Of particular interest to us relevant to this project is what is called the "QRS" complex. Part of this QRS complex is the "R" apex point which corresponds to the depolarization of the right and left ventricles of the heart.
What we are now interested in is the distance between two R peaks in a continuously displayed or recorded ECG measurement. The time it takes for the heart to produce two consecutive R peaks is known as the R-R interval and which is of significance for HRV studies.
The R-R interval is generally used to detect several different kinds of arrhythmias (which are quite a few) and not all of them will not be discussed here.
Besides the clinical significance of heart-rate variability, there is a physiological significance too. Reduced HRV is also an indicator of parasympathetic and sympathetic nervous system activity, which includes emotional arousal and other functions of the autonomous nervous system. This means that R-R intervals can be indirect "markers" for phycological activity.
There are several ECG AFE chips available including those from TI and Analog Devices. ProtoCentral also carries the popular ADS1292R-chip based breakout board. But the new features of the MAX30003 have us all excited:
- Simple to use, just two electrodes and it provides surprisingly good ECG, thanks to the onboard analog and digital high-pass and low-pass filters. Baseline wander removal is also built-in and very efficient.
- Very wide dynamic range. A common issue with some ECG circuits is that motion of the subject will cause "artifacts" that can sometimes saturate the amplifiers resulting in no ECG signal. This one doesn't seem to be affected by motion a lot.
- Built-in R-R detection. This is the kicker! The built-in circuitry does automatic R-R interval detection using the very popular and widely-used Pan-Tompkins algorithm. This means that the microcontroller does not have to do any filtering, threshold calculation or peak detection. Leaves the MCU's time free to do other stuff specific to your application.
We used the ProtoCentral Single-lead ECG monitor breakout board based on the MAX30003 single-channel AFE chip from Maxim Integrated to acquire ECG using two electrodes connected to the chest. This board is connected to an Arduino Uno using a standard SPI interface. Connections are made as given in the following table:
Unlike the traditional 3-electrode system which requires a driven right leg (DRL) electrode for common mode rejection, the MAX30003 is very unique in the fact that it works off of 2 electrodes only, making it easier to use.
The Arduino sketch for use with this hookup reads the real-time ECG and R-to-R interval data from the MAX30003 over SPI, puts it in a data packet and sends it over the Uno's USB-UART interface. This Arduino sketch is available in the links at the end of this article.
We also made a GUI with processing that takes this data from the serial port and plots the data in real-time with also the R-to-R interval time (in milliseconds) and the instantaneous heart rate *based on the current R-R value.
The R-to-R interval displayed here is the time between the last detected R peak and the previously detected R peak to get an instantaneous value of the R-R interval as well as heart rate. The instantaneous heart rate would be different from the regular heart-rate(if you would use a medical monitor) in the fact that generally heart-rate is calculated from a window of 5-10 secs of stored ECG data, rather that taking the immediate time.
Check out our video for the device in action.
We had a good experience interfacing with this board and assured that it can save the user a lot of time otherwise writing robust R-R detection algorithms. We have done testing to show that it is quite robust, although more testing has to be done to test the device for robustness.
We would like to see what can be made with this board, including internet-connected arrhythmia monitoring patches and even some kind of emotion monitor that uses the parasympathetic nervous system's correlation with R-R to detect change in emotions. We will soon post another Hackster article about the performance of this device in the presence of motion artifacts. Please leave your ides in the comments below.